StockBatchLinePickerTrait
Picker of a concrete batch on an issue line (multiplier `lines`); an optional choice instead of automatic `FEFO`.
Autocomplete only (targetPresenter: null, no modal; batches are searched by number/warehouse,
not by grid). The draft keeps the chosen selected_batch_id until post(); applyIssue()
validates it: it must fully cover the line and belong to that item x warehouse, otherwise
InsufficientStockException. Empty means FEFO.
$this->stockBatchManager is injected by the constructor of
StockDocumentPresenter.
Table of Contents
Methods
- addStockBatchLineControls() : void
- Batch picker fields on a line: hidden `selectedBatchId` + text label `selectedBatchLabel`.
- stockBatchLinePicker() : PickerConfig
- resolveStockBatchLineLabel() : string|null
- stockBatchLineLabel() : string
- suggestStockBatchLines() : array<int, array{id: int, label: string}>
Methods
addStockBatchLineControls()
Batch picker fields on a line: hidden `selectedBatchId` + text label `selectedBatchLabel`.
protected
addStockBatchLineControls(Container $parent[, string $targetField = 'selectedBatchId' ][, string $displayField = 'selectedBatchLabel' ]) : void
Parameters
- $parent : Container
- $targetField : string = 'selectedBatchId'
- $displayField : string = 'selectedBatchLabel'
stockBatchLinePicker()
protected
stockBatchLinePicker([string $formName = 'editForm' ][, string $container = 'lines' ][, string $targetField = 'selectedBatchId' ][, string $displayField = 'selectedBatchLabel' ]) : PickerConfig
Parameters
- $formName : string = 'editForm'
- $container : string = 'lines'
- $targetField : string = 'selectedBatchId'
- $displayField : string = 'selectedBatchLabel'
Return values
PickerConfigresolveStockBatchLineLabel()
private
resolveStockBatchLineLabel(int $id) : string|null
Parameters
- $id : int
Return values
string|nullstockBatchLineLabel()
private
stockBatchLineLabel(StockBatch $batch) : string
Parameters
- $batch : StockBatch
Return values
stringsuggestStockBatchLines()
private
suggestStockBatchLines(string $query) : array<int, array{id: int, label: string}>
Parameters
- $query : string