Refactor customer number handling for clarity.

Reassign the customer number to a variable before reuse, improving code readability and reducing redundant calls to the value method. This change streamlines object property creation and simplifies maintainability.
This commit is contained in:
Jepp9350
2025-05-20 14:05:47 +02:00
parent d65d49b31e
commit a45e2706c3
+3 -2
View File
@@ -295,11 +295,12 @@ class users_o extends db
$phone = $this->phone->value();
$phone = $phone === null ? null : (int)$phone;
$display_name = $this->display_name->value();
$customer_name = $this->getCustomerName($this->customer_number->value());
$customer_number = (int)$this->customer_number->value();
$customer_name = $this->getCustomerName($customer_number);
// Create the array with the object properties
$array = [
'id' => (int)$this->id,
'customer_number' => (int)$this->customer_number->value(),
'customer_number' => $customer_number,
'customer_name' => $customer_name,
'display_name' => $display_name === 'Unnamed' ? $customer_name : $display_name,
'group_id' => (int)$this->group_id->value(),