CompanyPlant
in package
Update plant by code (admin).
Expects in $data:
- company_plant_code (string, required)
- company_plant_name (string|null)
- company_plant_display (string|null)
- company_legal_entity_code(string|null)
- location_code (string|null)
- currency_code (string|null)
- sort_order (int|null)
- status (int|null)
- modifiedby (string, required)
Table of Contents
Properties
Methods
- __construct() : mixed
- create() : array<string, mixed>|false
- Create a plant under a legal entity.
- createByAdmin() : void
- Create a plant (admin).
- getAll() : array<int, array<string, mixed>>
- Get all plants for given statuses.
- getAllforCompany() : array<int, array<string, mixed>>
- Get all plants for a company.
- getAllforLegalEntity() : array<int, array<string, mixed>>
- Get all plants for a legal entity.
- getByCode() : array<string, mixed>
- Get a single plant by its code.
- listCodesForCompany() : array<int, string>
- List all plant codes for a company.
- suggestNextCode() : array{prefix: string, pad: int, code: string}
- Suggest next plant code by prefix, optionally within a legal entity.
- updateByCode() : void
- Update plant by code (admin).
- updateEditableFields() : bool
- Update editable fields of a plant by code.
Properties
$mySql
protected
MySql
$mySql
Methods
__construct()
public
__construct(MySql $mySql) : mixed
Parameters
- $mySql : MySql
create()
Create a plant under a legal entity.
public
create(string $legalEntityCode, string $plantCode, string $plantName, string $display, string $locationCode[, string|null $currencyCode = null ][, int $status = 1 ][, string $user = 'admin' ]) : array<string, mixed>|false
Parameters
- $legalEntityCode : string
- $plantCode : string
- $plantName : string
- $display : string
- $locationCode : string
- $currencyCode : string|null = null
- $status : int = 1
- $user : string = 'admin'
Return values
array<string, mixed>|falsecreateByAdmin()
Create a plant (admin).
public
createByAdmin(array<string, mixed> $data) : void
Expects in $data:
- company_plant_code (string, required)
- company_plant_name (string, required)
- company_plant_display (string, required)
- company_legal_entity_code(string, required)
- location_code (string, required)
- currency_code (string, required)
- sort_order (int|null)
- status (int, required)
- createdby (string, required)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>
getAll()
Get all plants for given statuses.
public
getAll(array<string|int, int> $statuses) : array<int, array<string, mixed>>
Parameters
- $statuses : array<string|int, int>
Return values
array<int, array<string, mixed>>getAllforCompany()
Get all plants for a company.
public
getAllforCompany(string $companyCode) : array<int, array<string, mixed>>
Parameters
- $companyCode : string
Return values
array<int, array<string, mixed>>getAllforLegalEntity()
Get all plants for a legal entity.
public
getAllforLegalEntity(string $legalEntityCode) : array<int, array<string, mixed>>
Parameters
- $legalEntityCode : string
Return values
array<int, array<string, mixed>>getByCode()
Get a single plant by its code.
public
getByCode(string $plantCode) : array<string, mixed>
Parameters
- $plantCode : string
Return values
array<string, mixed>listCodesForCompany()
List all plant codes for a company.
public
listCodesForCompany(string $companyCode) : array<int, string>
Parameters
- $companyCode : string
Return values
array<int, string>suggestNextCode()
Suggest next plant code by prefix, optionally within a legal entity.
public
suggestNextCode([string|null $legalEntityCode = null ][, string $prefix = 'CPL-' ][, int $pad = 6 ]) : array{prefix: string, pad: int, code: string}
Parameters
- $legalEntityCode : string|null = null
- $prefix : string = 'CPL-'
- $pad : int = 6
Return values
array{prefix: string, pad: int, code: string}updateByCode()
Update plant by code (admin).
public
updateByCode(array<string, mixed> $data) : void
Expects in $data:
- company_plant_code (string, required)
- company_plant_name (string|null)
- company_plant_display (string|null)
- company_legal_entity_code(string|null)
- location_code (string|null)
- currency_code (string|null)
- sort_order (int|null)
- status (int|null)
- modifiedby (string, required)
Parameters
- $data : array<string, mixed>
updateEditableFields()
Update editable fields of a plant by code.
public
updateEditableFields(string $plantCode, string $name, string|null $display[, string|null $locationCode = 'NYD' ][, string|null $currencyCode = null ]) : bool
Parameters
- $plantCode : string
- $name : string
- $display : string|null
- $locationCode : string|null = 'NYD'
- $currencyCode : string|null = null