fix: bypass invoice quota checks for super_admin in all upload and creation endpoints
This commit is contained in:
@@ -53,10 +53,12 @@ if ($decoded['role'] !== 'super_admin' && $company['tenant_id'] !== $tenantId) {
|
|||||||
$targetTenantId = $company['tenant_id'];
|
$targetTenantId = $company['tenant_id'];
|
||||||
|
|
||||||
// 3. Check quota (preview — don't increment yet)
|
// 3. Check quota (preview — don't increment yet)
|
||||||
try {
|
if ($decoded['role'] !== 'super_admin') {
|
||||||
QuotaMiddleware::checkInvoiceQuota($targetTenantId);
|
try {
|
||||||
} catch (\Exception $e) {
|
QuotaMiddleware::checkInvoiceQuota($targetTenantId);
|
||||||
json_error('تم استنفاد رصيد الفواتير لهذا الشهر. قم بترقية باقتك.', 429);
|
} catch (\Exception $e) {
|
||||||
|
json_error('تم استنفاد رصيد الفواتير لهذا الشهر. قم بترقية باقتك.', 429);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Generate batch ID
|
// 4. Generate batch ID
|
||||||
|
|||||||
@@ -50,7 +50,9 @@ try {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Check quota for each invoice (preventive)
|
// Check quota for each invoice (preventive)
|
||||||
QuotaMiddleware::checkInvoiceQuota($tenantId);
|
if ($decoded['role'] !== 'super_admin') {
|
||||||
|
QuotaMiddleware::checkInvoiceQuota($tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
$invoiceData = [
|
$invoiceData = [
|
||||||
'id' => Database::generateUuid(),
|
'id' => Database::generateUuid(),
|
||||||
|
|||||||
Reference in New Issue
Block a user