Add governed XL Vask AI invoice automation (#343)

This commit is contained in:
Jeppe B
2026-08-04 11:32:49 +02:00
committed by GitHub
parent 842b06c93f
commit 40b104abed
17 changed files with 2841 additions and 261 deletions
@@ -326,6 +326,7 @@ class xlvask_usage_logs_o extends db
public static function sourceHashForAutomation(array $payload): string
{
$payload = self::normalizeSourcePayload($payload);
$encoded = json_encode(
self::sortSourceValue($payload),
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRESERVE_ZERO_FRACTION
@@ -352,6 +353,14 @@ class xlvask_usage_logs_o extends db
$payload['WashItems'] = $decoded;
}
}
if (isset($payload['WashItems']) && is_array($payload['WashItems'])) {
$payload['WashItems'] = array_values($payload['WashItems']);
usort($payload['WashItems'], static function (mixed $left, mixed $right): int {
$leftJson = json_encode(self::sortSourceValue($left), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRESERVE_ZERO_FRACTION) ?: '';
$rightJson = json_encode(self::sortSourceValue($right), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRESERVE_ZERO_FRACTION) ?: '';
return strcmp($leftJson, $rightJson);
});
}
return $payload;
}