CoolCMS API

ComplaintFormTrait

Add/edit form of a complaint, saved through the generic object-graph `save()`.

Unlike Order, items and attachments are simple admin-editable snapshots with no catalog calculation. The status is set on this form only on creation (initial status selection); on edit statusId is not rendered and buildComplaintEntity() leaves the entity status alone. Every later status change goes only through the status action (ComplaintStatusChangeFormTrait, api/eshop/complaint/transition, ComplaintTransitionManager::apply()); otherwise the generic save() would bypass the stock return and the e-mail.

The order picker triggers the orderPrefill AJAX button (ComplaintOrderPickerTrait), which prefills the customer and items (one row per piece, ComplaintManager::getOrderPrefillData()). Bulk creation of multiplier rows on a submitted (AJAX) form must use addCopy($i) plus Container::setValues(); setDefaults() is a no-op there.

After a stock return (stockDocumentId) the items are locked (the server enforces it in Api ComplaintManager::beforeSave()): the multiplier is not added at all (the template shows only a table) and buildComplaintEntity() keeps the item collection as loaded. POST does not contain the items, so rebuilding from POST would delete them. The note, contact and attachments are still saved.

Table of Contents

Properties

$complaintOrderPrefillWarnings  : array<int, string>

Methods

createComponentEditForm()  : Form
addComplaintCustomerFields()  : void
addComplaintDateFields()  : void
addComplaintDescriptionFields()  : void
addComplaintInitialStatusField()  : void
addComplaintItemsMultiplier()  : void
Rows of the claimed items, one piece per row.
addComplaintOrderField()  : void
addComplaintOrderPrefillButton()  : void
Hidden AJAX button that picker.js clicks after an order is selected.
addComplaintSolutionFields()  : void
buildComplaintEntity()  : Complaint
buildComplaintItemFromRow()  : ComplaintItem|null
complaintControlValue()  : mixed
complaintFormComponent()  : IComponent|null
complaintItemsLocked()  : bool
Items of the edited complaint are read-only after a stock return.
complaintSetControlValue()  : void
loadComplaintSelectData()  : void
prefillComplaintFromOrder()  : void
refOrNull()  : T|null
saveComplaintForm()  : bool
setComplaintFormDefaults()  : void
wireComplaintMultiplierButtons()  : void

Properties

$complaintOrderPrefillWarnings

private array<int, string> $complaintOrderPrefillWarnings = []

Labels of rows whose AJAX prefill failed (shown as an alert).

Methods

addComplaintItemsMultiplier()

Rows of the claimed items, one piece per row.

private addComplaintItemsMultiplier(Form $form) : void
Parameters
$form : Form

addComplaintOrderPrefillButton()

Hidden AJAX button that picker.js clicks after an order is selected.

private addComplaintOrderPrefillButton(Form $form) : void
Parameters
$form : Form

buildComplaintEntity()

private buildComplaintEntity(ArrayHash<string|int, mixed> $values) : Complaint
Parameters
$values : ArrayHash<string|int, mixed>
Return values
Complaint

complaintControlValue()

private complaintControlValue(Container $container, string $field) : mixed
Parameters
$container : Container
$field : string

complaintFormComponent()

private complaintFormComponent(Container $container, string $name) : IComponent|null
Parameters
$container : Container
$name : string
Return values
IComponent|null

complaintItemsLocked()

Items of the edited complaint are read-only after a stock return.

private complaintItemsLocked() : bool
Return values
bool

complaintSetControlValue()

private complaintSetControlValue(Container $container, string $field, mixed $value) : void
Parameters
$container : Container
$field : string
$value : mixed

refOrNull()

private refOrNull(T> $class, int|null $id) : T|null
Parameters
$class : T>
$id : int|null
Tags
template
Return values
T|null

saveComplaintForm()

private saveComplaintForm(ArrayHash<string|int, mixed> $values) : bool
Parameters
$values : ArrayHash<string|int, mixed>
Return values
bool

wireComplaintMultiplierButtons()

private wireComplaintMultiplierButtons(Multiplier $multiplier, string $snippet) : void
Parameters
$multiplier : Multiplier
$snippet : string
On this page

Search results