From b913ff25c89dd73a73d0cc6b9f088248732a5282 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Fri, 8 May 2026 14:34:10 +0300 Subject: [PATCH] Update: 2026-05-08 14:34:10 --- app/modules_app/invoices/submit_jofotara.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/modules_app/invoices/submit_jofotara.php b/app/modules_app/invoices/submit_jofotara.php index e168b58..2a6d6f9 100644 --- a/app/modules_app/invoices/submit_jofotara.php +++ b/app/modules_app/invoices/submit_jofotara.php @@ -34,9 +34,9 @@ $db = Database::getInstance(); // 1. Fetch Invoice $query = $role === 'super_admin' - ? "SELECT i.*, c.name as company_name, c.tax_identification_number, c.jofotara_client_id, c.jofotara_secret_key, c.address as company_address + ? "SELECT i.*, c.name as company_name, c.tax_identification_number, c.jofotara_client_id_encrypted, c.jofotara_secret_key_encrypted, c.address as company_address FROM invoices i JOIN companies c ON i.company_id = c.id WHERE i.id = ?" - : "SELECT i.*, c.name as company_name, c.tax_identification_number, c.jofotara_client_id, c.jofotara_secret_key, c.address as company_address + : "SELECT i.*, c.name as company_name, c.tax_identification_number, c.jofotara_client_id_encrypted, c.jofotara_secret_key_encrypted, c.address as company_address FROM invoices i JOIN companies c ON i.company_id = c.id WHERE i.id = ? AND i.tenant_id = ?"; $params = $role === 'super_admin' ? [$invoiceId] : [$invoiceId, $tenantId]; @@ -60,8 +60,8 @@ if ($stmtCheck->fetch()) { } // 3. Verify JoFotara credentials -$clientId = $invoice['jofotara_client_id'] ?? ''; -$secretKey = $invoice['jofotara_secret_key'] ?? ''; +$clientId = Encryption::decrypt($invoice['jofotara_client_id_encrypted'] ?? '') ?: ''; +$secretKey = Encryption::decrypt($invoice['jofotara_secret_key_encrypted'] ?? '') ?: ''; if (empty($clientId) || empty($secretKey)) { json_error('يجب ربط الشركة بمنظومة جوفتورة أولاً (Client ID + Secret Key)', 422);