Prevent XL Vask list automation execution
This commit is contained in:
@@ -67,7 +67,7 @@ class xlvaskUsageLogsRoute
|
||||
->setAdditionalWhereClause("`Customer` NOT IN ('" . implode("', '", $xlvask_usage_log::$default_customers) . "')")
|
||||
->listObjectsWithPaginationIfSet(
|
||||
function ($log) use ($response_includes_items_link, $response_includes_items, $xlvask_usage_logs, $user, $xlvask, $automation_service, &$linked_order_ids_by_wash_id) {
|
||||
$automation = $automation_service->evaluateUsageLogRow($log, (int)$user->id, true);
|
||||
$automation = $automation_service->evaluateUsageLogRow($log, (int)$user->id, false);
|
||||
// Remove the 'id' field from the log
|
||||
$id = (int)$log['id'];
|
||||
unset($log['id']);
|
||||
|
||||
@@ -14,3 +14,16 @@ it('exposes direct linked order metadata on XL Vask usage order rows', function
|
||||
->and($route)->toContain("'linked_order_id' => \$linked_order_id")
|
||||
->and($route)->toContain("'usage_log_id' => \$id");
|
||||
});
|
||||
|
||||
it('does not execute XL Vask usage automation while listing usage order rows', function (): void {
|
||||
$route = file_get_contents(WD . '/routes/xlvaskUsageLogsRoute.php');
|
||||
|
||||
expect($route)->not->toBeFalse();
|
||||
|
||||
$route = (string)$route;
|
||||
|
||||
expect($route)
|
||||
->toContain('$automation = $automation_service->evaluateUsageLogRow($log, (int)$user->id, false);')
|
||||
->and($route)->not->toContain('$automation = $automation_service->evaluateUsageLogRow($log, (int)$user->id, true);')
|
||||
->and($route)->toContain("requirePermission('manage_xlvask_usage_automation')");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user