Refactor user retrieval logic to improve existence check for customer numbers

This commit is contained in:
Jeppe Bundgaard
2026-02-26 22:51:37 +01:00
parent 0ce9e79cb7
commit fc9d7882ae
2 changed files with 3 additions and 2 deletions
@@ -947,8 +947,9 @@ class InvoicingPeriodRoute
?array $meta = null
): array
{
$user = (new users_o())->getUserByCustomerNumber((int)$customer_number);
return [
'id' => $user_id ?? (new users_o())->getUserByCustomerNumber((int)$customer_number)->id,
'id' => $user_id ?? ($user->exists() ? $user->id : null),
'customer_number' => $customer_number,
'customer_name' => $customer_name,
'transactions' => $parsed_transactions = array_map(function ($transaction) {