AssetHandler

This class contains the functions to perform the following:

Retrieve:

  • Asset(s)
  • Asset Types
Insert:
  • Asset(s)
Update:
  • The Site of an asset [transfer]

api
package simPROAPI
subpackage Asset
author Nathan Muir
version 2011-07-18
todo all permission checks require editasset, may want to allow lower perms

 Methods

AssetInsert

Insert(int $CompanyID, array $AssetDetails) : int
Static
<?php
$AssetDetails = array(
    "AssetTypeID"=>0,
    "SiteID"=>0,
    "WalkOrder"=>0,
    "ContractID"=>0,
    "StartDate"=>"Y-m-d",
    "AssetFields"=>array(
            array("FieldID"=>0,"FieldValue"=>""),
            array("FieldID"=>0,"FieldValue"=>""),
         ),
    "ServiceLevels"=>array(
            array("ServiceLevelID"=>0,"ServiceDate"=>"Y-m-d"),
            array("ServiceLevelID"=>0,"ServiceDate"=>"Y-m-d"),
         ),
    "ParentAssetID"=>0
    );
?>

Parameters

$CompanyID

int

the Company ID. In single company builds, this is 0.

$AssetDetails

array

an associative array of Asset information.

Returns

int

AssetRetrieve

Retrieve(int $CompanyID, int $AssetID) : array
Static
uses \AssetHandler::RetrieveList()

Parameters

$CompanyID

int

the Company ID. In single company builds, this is 0.

$AssetID

int

an asset to retrieve

Returns

array

AssetRetrieveList

RetrieveList(int $CompanyID, array $AssetIDs) : array
Static
used_by \AssetHandler::SearchExact()
used_by \AssetHandler::Retrieve()

Parameters

$CompanyID

int

In single company builds, this is 0.

$AssetIDs

array

list of Asset ID's to retrieve details for

Returns

array

AssetSearchExact

SearchExact(int $CompanyID, string $Search = null, string $FieldName = null, int $AssetTypeID = null, int $SiteID = null) : array
Static

This function searches assets which match exactly the value of any or a given asset custom field value

uses \AssetHandler::RetrieveList()

Parameters

$CompanyID

int

the Company ID. In single company builds, this is 0.

$Search = null

string

the text to match the asset custom field value

$FieldName = null

string

the name the asset custom field to match. Use null to ignore this

$AssetTypeID = null

int

the type id of the asset to match. Use null to ignore this

$SiteID = null

int

the site id of the asset to match. Use null to ignore this

Returns

array

AssetServiceLevelRetrieve

ServiceLevelRetrieve(int $CompanyID, int $AssetTypeID = null) : array
Static
contribution Isaac Martin 20121-09-05
contribution Isaac Martin 20121-02-15

Parameters

$CompanyID

int

the Company ID. In single company builds, this is 0.

$AssetTypeID = null

int

the Asset Type ID (Optional)

Returns

array

AssetTestRecordInsert

TestRecordInsert(int $CompanyID, array $TestRecord) : array
Static
<?php
array_keys($TestRecord) =
        array(
            'EmployeeID',
            'Date',
            'ProjectID',
            'ProjectType', // 0 for Job, 1 for Quote
            'SectionCostCentreID',
        'Notes',
            'Assets' =>
                array(
                    array(
                        'AssetID',
                        'ServiceLevelID', // Optional
                        'TestResult', // -1 for No Test, 0 for Fail, 1 for Pass
                        'FailurePoints' =>
                            array( // Optional
                                array(
                                    'FailurePointID',
                                    'Recommendations' =>
                                        array(
                                            array(
                                                'RecommendationID'
                                            )
                                        )
                                )
                            )
                    )
                )
        )

Parameters

$CompanyID

int

the Company ID. In single company builds, this is 0.

$TestRecord

array

an associate array of test record details

Returns

array

AssetTypeRetrieve

TypeRetrieve(int $CompanyID) : array
Static
contribution Isaac Martin 2012-05-09
contribution Isaac Martin 2012-02-14

Parameters

$CompanyID

int

the Company ID. In single company builds, this is 0.

Returns

array

AssetUpdate

Update(int $CompanyID, int $AssetID, array $AssetDetails) : bool
Static
<?php
$AssetDetails = array(
    "SiteID"=>0,
    "WalkOrder"=>0,
    "ContractID"=>0,
    "StartDate"=>"Y-m-d",
    "AssetFields"=>array(
            array("FieldID"=>0,"FieldValue"=>""),
            array("FieldID"=>0,"FieldValue"=>""),
         ),
    "ServiceLevels"=>array(
            array("ServiceLevelID"=>0,"ServiceDate"=>"Y-m-d"),
            array("ServiceLevelID"=>0,"ServiceDate"=>"Y-m-d"),
         ),
    "ParentAssetID"=>0
    );
?>

Parameters

$CompanyID

int

the Company ID. In single company builds, this is 0.

$AssetID

int

The Asset ID to update with the supplied information.

$AssetDetails

array

an associative array of Asset information.

Returns

bool