Update: 2026-05-08 04:58:23
This commit is contained in:
@@ -123,8 +123,21 @@ try {
|
||||
'api_success' => $apiResponse['success'],
|
||||
], $decoded);
|
||||
|
||||
// Smart Notifications
|
||||
\App\Services\SmartNotifications::invoiceApproved(
|
||||
$invoice['tenant_id'], $invoice['uploaded_by'] ?? $decoded['user_id'],
|
||||
$id, $invoice['invoice_number'] ?? $id
|
||||
);
|
||||
\App\Services\SmartNotifications::checkQuotaWarning($invoice['tenant_id']);
|
||||
|
||||
// Gamification
|
||||
\App\Services\GamificationService::award($decoded['user_id'], $invoice['tenant_id'], 'invoice_approved');
|
||||
if ($apiResponse['success'] ?? false) {
|
||||
\App\Services\GamificationService::award($decoded['user_id'], $invoice['tenant_id'], 'jofotara_submitted');
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
if ($db->inTransaction()) $db->rollBack();
|
||||
error_log("JoFotara Approve Error: " . $e->getMessage());
|
||||
json_error('خطأ غير متوقع: ' . $e->getMessage(), 500);
|
||||
safe_error($e, 'invoices/approve');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user