Update: 2026-05-07 02:01:59

This commit is contained in:
Hamza-Ayed
2026-05-07 02:01:59 +03:00
parent e5b70a01ef
commit 57ac6047b8
4 changed files with 143 additions and 37 deletions

View File

@@ -122,16 +122,31 @@ try {
// Mark queue item done
$db->prepare("UPDATE invoice_processing_queue SET status = 'done', invoice_id = ?, processed_at = NOW() WHERE id = ?")->execute([$invoiceId, $queueId]);
// Update batch progress
$db->prepare("UPDATE invoice_batches SET processed_images = processed_images + 1 WHERE id = ?")->execute([$batchId]);
$db->commit();
echo "Success: Created Invoice $invoiceId\n";
// Send silent push update for progress
$stmt = $db->prepare("SELECT total_images, processed_images, uploaded_by FROM invoice_batches WHERE id = ?");
$stmt->execute([$batchId]);
$currentBatch = $stmt->fetch();
if ($currentBatch) {
$notifier = new NotificationService();
$notifier->sendDataNotification($currentBatch['uploaded_by'], [
'type' => 'batch_progress',
'batch_id' => $batchId,
'processed' => $currentBatch['processed_images'],
'total' => $currentBatch['total_images']
]);
}
// Increment Quota
QuotaMiddleware::incrementInvoiceUsage($tenantId);
} catch (Exception $e) {
$db->rollBack();
echo "DB Error: " . $e->getMessage() . "\n";