CustomerHandler

This class contains the functions to perform the following:

Retrieve:

  • Retrieve Customer's
  • Customer Contacts's
  • Customer Contract's
  • Customer Site's
  • Customer Note's
Insert:
  • Customer's
  • Customer Site's
  • Customer Contact's

api
package simPROAPI
subpackage Customers
author Nathan Muir, Michael West
version 2011-08-24

 Methods

CustomerContactInsert

ContactInsert(int $CompanyID, int $CustomerID, array $CustomerContactDetails) : bool
Static
<?php
array_keys($CustomerContactDetails) == array(
                            "Title",
                            "FirstName",
                            "LastName",
                            "Email",
                            "PhoneNumber",
                            "Department",
                            "Position",
                            "Fax",
                            "Mobile",
                            "Notes");
?>

Parameters

$CompanyID

int

the company id

$CustomerID

int

The customer id to add the contact to

$CustomerContactDetails

array

an associative array of customer information.

Returns

bool

CustomerContactRetrieve

ContactRetrieve(int $CompanyID, int $CustomerID, int $ContactID = null) : array
Static
uses \CustomerHandler::ContactRetrieveList()

Parameters

$CompanyID

int

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

$CustomerID

int

the customer id, to retrieve Customer Contacts for

$ContactID = null

int

the Contact ID.

Returns

array

CustomerContactRetrieveList

ContactRetrieveList(int $CompanyID, array $CustomerIDs) : array
Static
used_by \CustomerHandler::ContactRetrieve()

Parameters

$CompanyID

int

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

$CustomerIDs

array

list of Customer ID's to retrieve Customer Contacts for

Returns

array

CustomerContractRetrieve

ContractRetrieve(int $CompanyID, int $CustomerID) : array
Static
uses \CustomerHandler::ContractRetrieveList()

Parameters

$CompanyID

int

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

$CustomerID

int

the customer id, to retrieve Customer Contracts for

Returns

array

CustomerContractRetrieveList

ContractRetrieveList(int $CompanyID, array $CustomerIDs) : array
Static
used_by \CustomerHandler::ContractRetrieve()

Parameters

$CompanyID

int

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

$CustomerIDs

array

list of Customer ID's to retrieve Customer Contracts for

Returns

array

CustomerInsert

Insert(int $CompanyID, array $CustomerDetails, bool $CreateSite = true) : int
Static
<?php
array_keys($CustomerDetails) ==     array (
           'CustomerType', // "Customer" or "Lead"
           'Title',
           'FirstName',
           'LastName',
           'CompanyName',
           'MailAddress',
           'MailSuburb',
           'MailState',
           'MailPostcode',
           'MailCountry',
           'HomeAddress',
           'HomeSuburb',
           'HomeState',
           'HomePostcode',
           'HomeCountry',
           'Phone1',
           'Phone2',
           'Fax',
           'Mobile',
           'Email',
           'SecondaryEmail',
           'PaymentTerm',
           'PaymentTermType',
           'Currency',
           'Website',
           'Notes',
           'TaxNumber',
           'OnStop',
           'CreditLimit',
           'CompanyGroupID',
           'MaterialMarkup',
           'Discount',
          'Identifiers',
          'CustomFields'
        )

Parameters

$CompanyID

int

the company id

$CustomerDetails

array

an associative array of customer information.

$CreateSite = true

bool

create a site for the customer or not (Default: true)

Returns

int

CustomerNotesRetrieve

NotesRetrieve(int $CompanyID, mixed $CustomerID, string $SubjectPrefix = null) : array
Static

Returns customers notes, that begin with the $SubjectPrefix

Parameters

$CompanyID

int

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

$CustomerID

mixed

the customer id to retrieve the notes for

$SubjectPrefix = null

string

The prefix to search the customer notes for

Returns

array

CustomerRetrieve

Retrieve(int $CompanyID, int $CustomerID) : array
Static

This function retrieves a customer with a specific ID

uses \CustomerHandler::RetrieveList()

Parameters

$CompanyID

int

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

$CustomerID

int

the customer id

Returns

array

CustomerRetrieveList

RetrieveList(int $CompanyID, array $CustomerIDs) : array
Static

This function retrieves details on the provided list of customer ids

used_by \AccRecContactHandler::RetrieveExport()
used_by \AccRecContactHandler::RetrieveAll()
used_by \AccRecContactHandler::RetrieveList()
used_by \CustomerHandler::Search()
used_by \CustomerHandler::SearchFields()
used_by \CustomerHandler::Retrieve()
used_by \ProjectHandler::StatusRetrieve()
used_by \ProjectHandler::StatusRetrieveList()

Parameters

$CompanyID

int

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

$CustomerIDs

array

list of Customer ID's to retrieve.

Returns

array

CustomerSearchFields

SearchFields(int $CompanyID, array $SearchTerms, int $Limit = 500, int $Offset = 0, string $SearchType = "AND") : array
Static

This function retrieve's a list of customers who's set of fields match their associated values

uses \CustomerHandler::RetrieveList()

Parameters

$CompanyID

int

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

$SearchTerms

array

An associative array of Search Fields[key] and their search terms [value]

$Limit = 500

int

the total number of clients to return (0 - 500)

$Offset = 0

int

how many results to skip, before returning {@link $Limit}

$SearchType = "AND"

string

Multiple SearchTerms to perform a 'AND' or 'OR' search (default 'AND') SearchTerms can take keys of 'Address','Suburb', 'State', 'Postcode' and 'Email'

Returns

array

CustomerSiteInsert

SiteInsert(int $CompanyID, int $CustomerID, array $SiteDetails) : int
Static

Parameters

$CompanyID

int

the company id

$CustomerID

int

the customer id to link to the new site.

$SiteDetails

array

the details of the new site {@see SiteHandler::Insert()}

Returns

int

CustomerSiteRetrieve

SiteRetrieve(int $CompanyID, int $CustomerID) : array
Static
uses \CustomerHandler::SiteRetrieveList()

Parameters

$CompanyID

int

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

$CustomerID

int

the customer id, to retrieve Customer Sites for

Returns

array

CustomerSiteRetrieveList

SiteRetrieveList(int $CompanyID, array $CustomerIDs) : array
Static
uses \SiteHandler::RetrieveList()
used_by \CustomerHandler::SiteRetrieve()

Parameters

$CompanyID

int

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

$CustomerIDs

array

list of Customer ID's to retrieve Sites for

Returns

array

CustomerTotalCount

TotalCount(int $CompanyID) : array
Static

This function returns the total number of Customers that are not archived

used_by \AccRecContactHandler::TotalCount()

Parameters

$CompanyID

int

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

Returns

array

CustomerUpdate

Update(int $CompanyID, int $CustomerID, array $CustomerDetails) : bool
Static
<?php
array_keys($CustomerDetails) == array(
                            "Title",
                            "FirstName",
                            "LastName",
                            "CompanyName",
                            "MailAddress",
                            "MailSuburb",
                            "MailState",
                            "MailPostcode",
                            "MailCountry",
                            "HomeAddress",
                            "HomeSuburb",
                            "HomeState",
                            "HomePostcode",
                            "HomeCountry",
                            "Phone1",
                            "Phone2",
                            "Mobile",
                            "Fax",
                            "Email",
                            "PaymentTerm",
                            "PaymentTermType",
                            "Website",
                            "Notes",
                            "Active",
                            "TaxNumber",
                            "DepartmentID",
                            "ClientStatus",
                            "Identifiers",
                           "CustomFields");
?>

Parameters

$CompanyID

int

the company id

$CustomerID

int

The customer id to update with the supplied information

$CustomerDetails

array

an associative array of customer information.

Returns

bool

CustomerValidateCredentials

ValidateCredentials(string $username, string $password) : array
Static

This function will validate a customers login details and return null if not found or an array with customer id and company id it belongs to if required

Parameters

$username

string

the username for the customer login

$password

string

the password for the customer login

Returns

array