Update: 2026-05-04 00:23:45

This commit is contained in:
Hamza-Ayed
2026-05-04 00:23:45 +03:00
parent 671db50f16
commit cd85fcf2bd
2 changed files with 164 additions and 113 deletions

View File

@@ -48,8 +48,19 @@ try {
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
");
// Determine tenant_id: Super Admin chooses, Admin uses own
$tenantId = null;
if ($decoded['role'] === 'super_admin') {
if (empty($data['tenant_id'])) {
json_error('يجب اختيار المكتب المحاسبي', 422);
}
$tenantId = $data['tenant_id'];
} else {
$tenantId = $decoded['tenant_id'];
}
$stmt->execute([
$decoded['tenant_id'], // Correctly using tenant_id from JWT
$tenantId,
$encryptedName,
$encryptedNameEn,
$data['tax_identification_number'],