CustomerPickerTrait
Customer picker for the invoice and the invoice template, pattern of {@see SellerPickerTrait}.
fieldMap fills the customer snapshot from the first contact of the picked customer. Two
variants: customerPicker() fills the billing fields customer*, customerDeliveryPicker() the delivery fields customerDlv* (they share generic data keys). The
snapshot is editable.
Table of Contents
Properties
Methods
- customerDeliveryPicker() : PickerConfig
- customerPicker() : PickerConfig
- customerDeliveryFieldMap() : array<string, string>
- customerFieldMap() : array<string, string>
- Returns the mapping data key (from {@see customerPrefillData()}) to billing field. Shared by the picker (client `fieldMap`) and the server-side prefill (snippet redraw after a pick).
- customerLabel() : string
- customerPrefillData() : array<string, string>
- loadCustomer() : Customer|null
- Loads the customer including contacts for the server-side prefill of the invoice snapshot.
- resolveCustomerLabel() : string|null
-
suggestCustomers()
: array<int, array{id: int, label: string, data: array
}>
Properties
$customerManager
public
CustomerManager
$customerManager
Attributes
- #[Inject]
Methods
customerDeliveryPicker()
protected
customerDeliveryPicker(string $formName, string $targetField[, string|null $submitButton = null ]) : PickerConfig
Parameters
- $formName : string
- $targetField : string
- $submitButton : string|null = null
Return values
PickerConfigcustomerPicker()
protected
customerPicker(string $formName, string $targetField[, string|null $submitButton = null ]) : PickerConfig
Parameters
- $formName : string
- $targetField : string
- $submitButton : string|null = null
Return values
PickerConfigcustomerDeliveryFieldMap()
private
customerDeliveryFieldMap() : array<string, string>
Return values
array<string, string> —mapping to the delivery fields (customerDlv*)
customerFieldMap()
Returns the mapping data key (from {@see customerPrefillData()}) to billing field. Shared by the picker (client `fieldMap`) and the server-side prefill (snippet redraw after a pick).
private
customerFieldMap() : array<string, string>
Return values
array<string, string>customerLabel()
private
customerLabel(Customer $customer) : string
Parameters
- $customer : Customer
Return values
stringcustomerPrefillData()
private
customerPrefillData(Customer $customer) : array<string, string>
Parameters
- $customer : Customer
Return values
array<string, string>loadCustomer()
Loads the customer including contacts for the server-side prefill of the invoice snapshot.
private
loadCustomer(int $id) : Customer|null
Parameters
- $id : int
Return values
Customer|nullresolveCustomerLabel()
private
resolveCustomerLabel(int $id) : string|null
Parameters
- $id : int
Return values
string|nullsuggestCustomers()
private
suggestCustomers(string $query) : array<int, array{id: int, label: string, data: array}>
Parameters
- $query : string