dolibarr 23.0.3
Boms Class Reference
Inheritance diagram for Boms:
Collaboration diagram for Boms:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a bom object.
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $sqlfilters='', $properties='')
 List boms.
 
 post ($request_data=null)
 Create bom object.
 
 put ($id, $request_data=null)
 Update bom.
 
 delete ($id)
 Delete bom.
 
 getLines ($id)
 Get lines of an BOM.
 
 postLine ($id, $request_data=null)
 Add a line to given BOM.
 
 putLine ($id, $lineid, $request_data=null)
 Update a line to given BOM.
 
 deleteLine ($id, $lineid)
 Delete a line to given BOM.
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor.
 

Protected Member Functions

 _cleanObjectDatas ($object)
 Clean sensible object datas @phpstan-template T.
 
- Protected Member Functions inherited from DolibarrApi
 _checkValForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name.
 
 _filterObjectProperties ($object, $properties)
 Filter properties that will be returned on object.
 
 _checkFilters ($sqlfilters, &$error='')
 Return if a $sqlfilters parameter is valid Function no more used.
 

Private Member Functions

 _validate ($data)
 Validate fields before create or update object.
 
 checkRefNumbering ()
 Validate the ref field and get the next Number if it's necessary.
 

Additional Inherited Members

- Static Protected Member Functions inherited from DolibarrApi
static _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
 Check access by user to a given resource.
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria from a Generic filter string.
 

Detailed Description

Definition at line 39 of file api_boms.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

Boms::_cleanObjectDatas ( $object)
protected

Clean sensible object datas @phpstan-template T.

Parameters
Object$objectObject to clean
Returns
Object Object with cleaned properties @phpstan-param T $object @phpstan-return T

Reimplemented from DolibarrApi.

Definition at line 529 of file api_boms.class.php.

References $object, and _cleanObjectDatas().

Referenced by _cleanObjectDatas(), get(), getLines(), index(), and putLine().

◆ _validate()

Boms::_validate ( $data)
private

Validate fields before create or update object.

Parameters
?array<string,string>$data Array of data to validate
Returns
array<string,string>
Exceptions
RestException

Definition at line 600 of file api_boms.class.php.

Referenced by post().

◆ checkRefNumbering()

Boms::checkRefNumbering ( )
private

Validate the ref field and get the next Number if it's necessary.

Returns
void

Definition at line 623 of file api_boms.class.php.

Referenced by post(), and put().

◆ delete()

Boms::delete ( $id)

Delete bom.

Parameters
int$idBOM ID
Returns
array @phan-return array{success:array{code:int,message:string}} @phpstan-return array{success:array{code:int,message:string}}
Exceptions
RestException403 Access denied
RestException404 BOM not found
RestException500 Error deleting bom

Definition at line 292 of file api_boms.class.php.

References $id, and DolibarrApi\_checkAccessToResource().

◆ deleteLine()

Boms::deleteLine ( $id,
$lineid )

Delete a line to given BOM.

Parameters
int$idId of BOM to update
int$lineidId of line to delete

@url DELETE {id}/lines/{lineid}

Returns
array @phan-return array{success:array{code:int,message:string}} @phpstan-return array{success:array{code:int,message:string}}
Exceptions
RestException403 Access denied
RestException404 BOM not found
RestException500 Error deleting bom line

Definition at line 479 of file api_boms.class.php.

References $id, and DolibarrApi\_checkAccessToResource().

◆ get()

Boms::get ( $id)

Get properties of a bom object.

Return an array with bom information

Parameters
int$idID of bom
Returns
Object Object with cleaned properties @phan-return BOM @phpstan-return BOM

@url GET {id}

Exceptions
RestException403 Access denied
RestException404 BOM not found

Definition at line 72 of file api_boms.class.php.

References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

◆ getLines()

Boms::getLines ( $id)

Get lines of an BOM.

Parameters
int$idId of BOM

@url GET {id}/lines

Returns
array @phan-return BOMLine[] @phpstan-return BOMLine[]
Exceptions
RestException403 Access denied
RestException404 BOM not found

Definition at line 332 of file api_boms.class.php.

References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

◆ index()

Boms::index ( $sortfield = "t.rowid",
$sortorder = 'ASC',
$limit = 100,
$page = 0,
$sqlfilters = '',
$properties = '' )

List boms.

Get a list of boms

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
string$propertiesRestrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
Returns
array Array of order objects @phan-return BOM[] @phpstan-return BOM[]
Exceptions
RestException400 Bad sqlfilters
RestException403 Access denied
RestException503 Error retrieving list of boms

Definition at line 110 of file api_boms.class.php.

References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and forgeSQLFromUniversalSearchCriteria().

◆ post()

Boms::post ( $request_data = null)

Create bom object.

Parameters
array$request_dataRequest data @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
int ID of bom
Exceptions
RestException403 Access denied
RestException500 Error retrieving list of boms

Definition at line 196 of file api_boms.class.php.

References DolibarrApi\_checkValForAPI(), _validate(), checkRefNumbering(), and sanitizeVal().

◆ postLine()

Boms::postLine ( $id,
$request_data = null )

Add a line to given BOM.

Parameters
int$idId of BOM to update
array$request_dataBOMLine data @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data

@url POST {id}/lines

Returns
int
Exceptions
RestException403 Access denied
RestException404 BOM not found
RestException500 Error adding bom line

Definition at line 370 of file api_boms.class.php.

References $id, and DolibarrApi\_checkAccessToResource().

◆ put()

Boms::put ( $id,
$request_data = null )

Update bom.

Parameters
int$idId of bom to update
array$request_dataData @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
Object Object after update @phan-return BOM @phpstan-return BOM
Exceptions
RestException403 Access denied
RestException404 BOM not found
RestException500 Error updating bom

Definition at line 237 of file api_boms.class.php.

References $id, DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValForAPI(), checkRefNumbering(), and sanitizeVal().

◆ putLine()

Boms::putLine ( $id,
$lineid,
$request_data = null )

Update a line to given BOM.

Parameters
int$idId of BOM to update
int$lineidId of line to update
array$request_dataBOMLine data @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data

@url PUT {id}/lines/{lineid}

Returns
object|bool
Exceptions
RestException403 Access denied
RestException404 BOM not found

Definition at line 424 of file api_boms.class.php.

References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().


The documentation for this class was generated from the following file: