Documentation

PlantDepartment
in package

Class PlantDepartment

This class provides functionality to manage plant departments, including retrieving, creating, and updating records in the plant department database.

Table of Contents

Properties

$mySql  : MySql

Methods

__construct()  : mixed
create()  : array<string, mixed>|false
Create a plant department under a plant (helper).
createByAdmin()  : void
Create a plant department (admin).
getAll()  : array<int, array<string, mixed>>
Get all plant departments overall for given statuses.
getAllforCompany()  : array<int, array<string, mixed>>
Get all plant departments for a company.
getAllforPlant()  : array<int, array<string, mixed>>
Get all departments for a plant.
getByCode()  : array<string, mixed>
Get a single plant department by its code.
suggestNextCode()  : array{prefix: string, pad: int, code: string}
Suggest the next department code by prefix.
updateByCode()  : void
Update plant department by code (admin).
updateName()  : bool
Update a plant department name by its code.

Properties

Methods

create()

Create a plant department under a plant (helper).

public create(string $plantCode, string $departmentCode, string $departmentName[, int $status = 1 ][, string $user = 'admin' ]) : array<string, mixed>|false
Parameters
$plantCode : string
$departmentCode : string
$departmentName : string
$status : int = 1
$user : string = 'admin'
Return values
array<string, mixed>|false

createByAdmin()

Create a plant department (admin).

public createByAdmin(array<string, mixed> $data) : void

Expects in $data:

  • plant_department_code (string, required)
  • plant_department_name (string, required)
  • company_plant_code (string, required, FK)
  • sort_order (int|null)
  • status (int, required)
  • createdby (string, required)
  • modifiedby (string, required)
Parameters
$data : array<string, mixed>

getAll()

Get all plant departments overall 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 plant departments for a company.

public getAllforCompany(string $companyCode) : array<int, array<string, mixed>>
Parameters
$companyCode : string
Return values
array<int, array<string, mixed>>

getAllforPlant()

Get all departments for a plant.

public getAllforPlant(string $plantCode) : array<int, array<string, mixed>>
Parameters
$plantCode : string
Return values
array<int, array<string, mixed>>

getByCode()

Get a single plant department by its code.

public getByCode(string $plantDepartmentCode) : array<string, mixed>
Parameters
$plantDepartmentCode : string
Return values
array<string, mixed>

suggestNextCode()

Suggest the next department code by prefix.

public suggestNextCode([string|null $plantCode = null ][, string $prefix = 'PDE-' ][, int $pad = 6 ]) : array{prefix: string, pad: int, code: string}
Parameters
$plantCode : string|null = null
$prefix : string = 'PDE-'
$pad : int = 6
Return values
array{prefix: string, pad: int, code: string}

updateByCode()

Update plant department by code (admin).

public updateByCode(array<string, mixed> $data) : void

Expects in $data:

  • plant_department_code (string, required)
  • plant_department_name (string|null)
  • company_plant_code (string|null)
  • sort_order (int|null)
  • status (int|null)
  • modifiedby (string, required)
Parameters
$data : array<string, mixed>

updateName()

Update a plant department name by its code.

public updateName(array<string, mixed> $data) : bool
Parameters
$data : array<string, mixed>
Return values
bool

        
On this page

Search results