CoolCMS API

OrderCustomerLookupPickerTrait

Picker of the card-index customer (Invoicer `Customer`), next to {@see OrderCustomerPickerTrait} (which searches `User`).

Two pickers sit over one form with different hidden inputs (userId there, customerId here), but both fieldMaps fill the same customer* snapshot fields, so the later choice overwrites the earlier one. The client fieldMap responds immediately (first contact); submitButton: 'customerRefresh' then force-submits the form and the server authoritatively fills the address select (customerContactId, OrderFormTrait) and the same fields from the same first contact. Both use the same data, so they do not overwrite each other; the server only adds the addresses to choose from and a reference the client cannot see. Choosing a specific (not the first) address is handled by customerContactRefresh (OrderFormTrait::refreshOrderCustomerContact()). Both follow SellerPickerTrait.

IMPORTANT: a legacy contact without the filled companyName/firstname/lastname triple has no source for a structured name, and name is deliberately not guessed back. The prefill then leaves customerCompanyName/customerFirstname/customerLastname empty and the admin must type them; the other fields (address, e-mail, phone, company ID, VAT ID) are prefilled normally.

Table of Contents

Properties

$orderCustomerLookupManager  : CustomerManager

Methods

orderCustomerLookupPicker()  : PickerConfig
loadOrderCustomerWithContacts()  : Customer|null
Loads the customer with contacts for the address select (`customerContactId`) and the server refresh handlers. `id <= 0` safely returns null, like {@see \App\UI\Admin\Invoicer\Presenters\Traits\Pickers\SellerPickerTrait::loadSeller()}.
orderCustomerContactLabel()  : string
orderCustomerContactOptions()  : array<int, NotTranslate>
Builds the `customerContactId` select items: contact id mapped to a meaningful summary (name or company, street, city). A legacy contact without the structured triple (see the class docblock) falls back to `CustomerContact::getName()`, never to an empty label.
orderCustomerContactPrefillData()  : array<string, string>
Builds the same dictionary as {@see orderCustomerLookupPrefillData()}, but for any contact (not just the first); used after a specific address is chosen in the `customerContactId` select (`OrderFormTrait::refreshOrderCustomerContact()`). The shared data source guarantees that the client `fieldMap` (first contact) and the server refresh (first or chosen contact) never produce different values for the same contact.
orderCustomerLookupFieldMap()  : array<string, string>
orderCustomerLookupLabel()  : string
orderCustomerLookupPrefillData()  : array<string, string>
resolveOrderCustomerLookupLabel()  : string|null
suggestOrderCustomerLookups()  : array<int, array{id: int, label: string, data: array}>

Properties

Methods

orderCustomerLookupPicker()

protected orderCustomerLookupPicker([string $formName = 'editForm' ][, string $targetField = 'customerId' ]) : PickerConfig
Parameters
$formName : string = 'editForm'
$targetField : string = 'customerId'
Return values
PickerConfig

loadOrderCustomerWithContacts()

Loads the customer with contacts for the address select (`customerContactId`) and the server refresh handlers. `id <= 0` safely returns null, like {@see \App\UI\Admin\Invoicer\Presenters\Traits\Pickers\SellerPickerTrait::loadSeller()}.

private loadOrderCustomerWithContacts(int $id) : Customer|null
Parameters
$id : int
Return values
Customer|null

orderCustomerContactOptions()

Builds the `customerContactId` select items: contact id mapped to a meaningful summary (name or company, street, city). A legacy contact without the structured triple (see the class docblock) falls back to `CustomerContact::getName()`, never to an empty label.

private orderCustomerContactOptions(Customer $customer) : array<int, NotTranslate>

The summary is ready text from the card index, not a translation key, hence NotTranslate; otherwise the form's domain translator looks it up as a key and Tracy reports a missing translation.

Parameters
$customer : Customer
Return values
array<int, NotTranslate>

orderCustomerContactPrefillData()

Builds the same dictionary as {@see orderCustomerLookupPrefillData()}, but for any contact (not just the first); used after a specific address is chosen in the `customerContactId` select (`OrderFormTrait::refreshOrderCustomerContact()`). The shared data source guarantees that the client `fieldMap` (first contact) and the server refresh (first or chosen contact) never produce different values for the same contact.

private orderCustomerContactPrefillData(CustomerContact $contact) : array<string, string>
Parameters
$contact : CustomerContact
Return values
array<string, string>

orderCustomerLookupFieldMap()

private orderCustomerLookupFieldMap() : array<string, string>
Return values
array<string, string> —

data key mapped to the order form field

orderCustomerLookupPrefillData()

private orderCustomerLookupPrefillData(Customer $customer) : array<string, string>
Parameters
$customer : Customer
Return values
array<string, string> —

data key (fieldMap) mapped to the value from the first contact

resolveOrderCustomerLookupLabel()

private resolveOrderCustomerLookupLabel(int $id) : string|null
Parameters
$id : int
Return values
string|null

suggestOrderCustomerLookups()

private suggestOrderCustomerLookups(string $query) : array<int, array{id: int, label: string, data: array}>
Parameters
$query : string
Return values
array<int, array{id: int, label: string, data: array}>
On this page

Search results