Update: 2026-05-08 14:34:10
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user