Replace getCustomerByIdOrCustomerNumber with getUserByCustomerNumber across services and remove deprecated method.

This commit is contained in:
Jeppe Bundgaard
2026-01-06 15:50:59 +01:00
parent 49589de98e
commit 0eddf69ae4
5 changed files with 12 additions and 27 deletions
+3 -3
View File
@@ -88,7 +88,7 @@ class ordersRoute
];
}
// Get the customer
$tmp_customer = (new users_o())->getCustomerByIdOrCustomerNumber((int)$order['customer_id']);
$tmp_customer = (new users_o())->getUserByCustomerNumber((int)$order['customer_id']);
// Add the customer name to the order
$order['customer_name'] = (new users_o())->getCustomerName((int)$tmp_customer->customer_number->value());
$order['user_id'] = (int)$tmp_customer->id;
@@ -155,7 +155,7 @@ class ordersRoute
$response->error('Department not found', 400);
}
// Make sure the customer number set is valid
$targetUser = (new users_o())->getCustomerByIdOrCustomerNumber((int)$data['customer_id']);
$targetUser = (new users_o())->getUserByCustomerNumber((int)$data['customer_id']);
if (!$targetUser->exists()) {
$response->error('Customer not found', 400);
}
@@ -915,7 +915,7 @@ class ordersRoute
/** Departmental access */
// If the customer ID is set, validate it
if (isset($data['customer_id'])) {
if (!(new users_o())->getCustomerByIdOrCustomerNumber((int)$data['customer_id'])->exists() || empty($data['customer_id'])) {
if (!(new users_o())->getUserByCustomerNumber((int)$data['customer_id'])->exists() || empty($data['customer_id'])) {
$response->error('Customer not found or invalid', 400);
}
$order->customer_id->set((int)$data['customer_id']);