Update: 2026-05-04 20:03:11

This commit is contained in:
Hamza-Ayed
2026-05-04 20:03:11 +03:00
parent 691305340a
commit 3ea64d59ce
6 changed files with 243 additions and 350 deletions

View File

@@ -62,7 +62,7 @@ try {
// 3. Decrypt sensitive fields for display (Robustly)
$dec = function($val) {
if (empty($val)) return '';
$result = Encryption::decrypt((string)$val);
$result = \App\Core\Encryption::decrypt((string)$val);
return ($result !== false && $result !== null && $result !== '') ? $result : (string)$val;
};
@@ -71,9 +71,16 @@ try {
$inv['supplier_tin'] = $dec($inv['supplier_tin']);
$inv['buyer_name'] = $dec($inv['buyer_name']);
// Note: company_name and tenant_name from JOIN are usually plaintext
// Only decrypt if you are absolutely sure they are encrypted in the source table.
// For companies.name, it's plaintext.
if (!empty($inv['company_name'])) {
$inv['company_name'] = $dec($inv['company_name']);
}
if (!empty($inv['tenant_name'])) {
$inv['tenant_name'] = $dec($inv['tenant_name']);
}
}
if (empty($invoices)) {
error_log("INVOICES LIST: No invoices found for role: $role, tenant_id: $tenantId");
}
json_success($invoices);