Files
api/services/nginx/app/cron/RunXLVaskModuleCron.php
T
Jeppe B b107ba649c Wire XL Vask usage-log sync, order linking, and order creation (#353)
Wires the three broken paths in the cron-driven XL Vask integration:

- runSyncUsage() now calls the revision-aware importUsageLogsWithSummary() on xlvask_usage_logs_o (was a no-op stub; the upstream API was never queried for washes).
- linkImportedUsageLogsToOrders() persists xlvask_potential_order_matches rows so the accept/compare/link/deny UI has data to render.
- When automatic_order_creation_enabled is on and the wash qualifies, falls through to createOrderFromWash() → orders_o::addXLVaskOrder().
- Removes the obsolete TODO in RunXLVaskModuleCron.php.
- Returns linked + orders_created alongside the existing counters so ops can observe the pipeline.
2026-08-09 13:38:27 +02:00

32 lines
956 B
PHP

<?php
/**
* This script is used to run the XL Vask module's cron tasks.
* It is run as a cron job.
*
* index.php runs this script.
*/
// prevent direct access
use classes\xlvask;
if (!defined('WD')) {
exit;
}
$start = microtime(true);
// Load the XL Vask module
$xlvask = new xlvask;
try {
if ($xlvask->config->enabled->isTrue() && $xlvask->config->synchronization_enabled->isTrue()) {
$xlvask->getTasks()->runCronTasks();
}
} catch (Exception $e) {
// This is automatically running, but an XL Vask module failure here
// would otherwise stop the entire module from being synchronized at
// all (usage logs, vehicles, etc.), so surface the breadcrumb.
error_log('[cron-run-xlvask-module] runCronTasks failed: ' . $e->getMessage());
}
$end = microtime(true);
//$slack = new \classes\slack();
//$slack->send_message("The booking sync script has finished. It took " . round($end - $start, 2) . " seconds to run.");