@@ -128,9 +128,19 @@ final class RequisitionExpiry
|
||||
$basisField = is_array($rules) && is_bool($rules['approval_includes_tax'] ?? null)
|
||||
? ($rules['approval_includes_tax'] ? 'total_minor' : 'subtotal_minor') : null;
|
||||
$approvalAmount = is_array($basis) && $basisField !== null ? ($basis[$basisField] ?? null) : null;
|
||||
$steps = array_map(static function (array $step): array {
|
||||
// ApprovalStep preserves SQL timestamps without a cast. Attach the
|
||||
// application timezone in the read DTO, never rewrite the snapshot.
|
||||
$value = $step['decided_at'] ?? null;
|
||||
if (is_string($value) && preg_match('/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?$/D', $value)) {
|
||||
$step['decided_at'] = CarbonImmutable::parse($value, (string) config('app.timezone'))->toIso8601String();
|
||||
}
|
||||
|
||||
return $step;
|
||||
}, $row->snapshot['steps']);
|
||||
|
||||
return ['id' => $row->id, 'data' => $row->data, 'reason' => $row->reason,
|
||||
'request' => $row->snapshot['request'], 'steps' => $row->snapshot['steps'], 'created_at' => $row->created_at,
|
||||
'request' => $row->snapshot['request'], 'steps' => $steps, 'created_at' => $row->created_at,
|
||||
'items' => $items, 'rules' => is_array($rules) ? Arr::only($rules, ['first_limit_minor', 'second_limit_minor', 'approval_includes_tax', 'rules_provisional', 'routing_plan_revision']) : [],
|
||||
'approval_amount_minor' => is_int($approvalAmount) && $approvalAmount >= 0 ? $approvalAmount : null,
|
||||
'approval_uses_separate_basis' => is_array($rules) && is_array($rules['approval_basis'] ?? null)];
|
||||
|
||||
Reference in New Issue
Block a user