diff --git a/assets/pasted-20260211-124352-68ac57b9.png b/assets/pasted-20260211-124352-68ac57b9.png new file mode 100644 index 0000000..3e2f865 Binary files /dev/null and b/assets/pasted-20260211-124352-68ac57b9.png differ diff --git a/assets/pasted-20260211-131304-152989f6.png b/assets/pasted-20260211-131304-152989f6.png new file mode 100644 index 0000000..3e2f865 Binary files /dev/null and b/assets/pasted-20260211-131304-152989f6.png differ diff --git a/config/__pycache__/wsgi.cpython-311.pyc b/config/__pycache__/wsgi.cpython-311.pyc index 3595d64..cc90925 100644 Binary files a/config/__pycache__/wsgi.cpython-311.pyc and b/config/__pycache__/wsgi.cpython-311.pyc differ diff --git a/config/wsgi.py b/config/wsgi.py index 0b34d00..28f3157 100644 --- a/config/wsgi.py +++ b/config/wsgi.py @@ -21,34 +21,55 @@ except ImportError: pass # --- FIX: Preload libraries for WeasyPrint/Pango --- -# Ensure LD_LIBRARY_PATH includes standard paths -if 'LD_LIBRARY_PATH' not in os.environ: - os.environ['LD_LIBRARY_PATH'] = '/usr/lib/x86_64-linux-gnu:/usr/lib' -else: - if '/usr/lib/x86_64-linux-gnu' not in os.environ['LD_LIBRARY_PATH']: - os.environ['LD_LIBRARY_PATH'] += ':/usr/lib/x86_64-linux-gnu' +# Manually load libraries using absolute paths +import ctypes +import ctypes.util +import traceback +import sys -# Manually load the library +lib_paths = [ + '/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0', + '/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0', + '/usr/lib/x86_64-linux-gnu/libfontconfig.so.1', + '/usr/lib/x86_64-linux-gnu/libcairo.so.2', + '/usr/lib/x86_64-linux-gnu/libpango-1.0.so.0', + '/usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0', +] + +for path in lib_paths: + try: + ctypes.CDLL(path) + except OSError: + pass + +# Try to import weasyprint try: - if not ctypes.util.find_library('libgobject-2.0-0'): - # Try to load known paths directly - candidates = [ - 'libgobject-2.0.so.0', - '/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0', - '/usr/lib/libgobject-2.0.so.0' - ] - for c in candidates: - try: - ctypes.CDLL(c) - break - except OSError: - continue -except Exception: - pass -# --------------------------------------------------- + import weasyprint +except Exception as e: + # Log error to file and stderr + error_msg = f"WeasyPrint Import Error: {str(e)}\n{traceback.format_exc()}" + sys.stderr.write(error_msg) + try: + with open("weasyprint_wsgi_error.log", "w") as f: + f.write(error_msg) + except Exception: + pass -from django.core.wsgi import get_wsgi_application + # Fallback to mock + import types + class MockHTML: + def __init__(self, string=None, base_url=None): + pass + def write_pdf(self, target=None): + raise OSError("WeasyPrint system dependencies are missing. PDF generation is disabled.") + + mock_wp = types.ModuleType("weasyprint") + mock_wp.HTML = MockHTML + sys.modules["weasyprint"] = mock_wp +# --------------------------------------------------- os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') +from django.core.wsgi import get_wsgi_application + application = get_wsgi_application() \ No newline at end of file diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 47ba767..14d2920 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/templates/core/cashier_registry.html b/core/templates/core/cashier_registry.html index d32758f..a9c3958 100644 --- a/core/templates/core/cashier_registry.html +++ b/core/templates/core/cashier_registry.html @@ -25,7 +25,7 @@ + +
+ + +
+
+ + +
+
+ + +
+ + + + + + {% endfor %} @@ -89,7 +126,7 @@
- +
@@ -130,7 +167,7 @@ if (data.success) { if (stayOpen) { document.getElementById('addCustName').value = ''; - document.getElementById('addCustPhone').value = ''; + document.getElementById('addCustPhone').value = '968'; document.getElementById('addCustEmail').value = ''; document.getElementById('addCustAddress').value = ''; alert('{% trans "Customer added. You can add another one." %}'); diff --git a/core/templates/core/suppliers.html b/core/templates/core/suppliers.html index 2e2753c..7b078b6 100644 --- a/core/templates/core/suppliers.html +++ b/core/templates/core/suppliers.html @@ -126,7 +126,7 @@
- +