Add governed XL Vask AI invoice automation (#343)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user