LeadHandler

This class contains the functions to perform the following:

- Retrieve Lead(s)

- Insert Lead(s) - Update Lead(s), Lead Flag(?)

api
package simPROAPI
subpackage Projects
author Nathan Muir
version 2011-07-18
todo complete functionality for each of the prototype functions

 Methods

LeadConvert This function converts a lead to a quote

Convert(int $CompanyID, int $LeadID, int $OrderNo = 0) : int
StaticNot Implemented

Parameters

$CompanyID

int

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

$LeadID

int

The lead to convert

$OrderNo = 0

int

optional order number

Returns

int

LeadInsert

Insert(int $CompanyID, array $LeadDetails) : int
Static
<?php
$LeadDetails =
array(
"CustomerID"=>0, // required
"ContactID"=>0,
"Description"=>"",
"Notes"=>"",
"IssuedDate"=>"Y-m-d",
"DueDate"=>"Y-m-d",
"DueTime"=>"h:m:s",
"SiteID"=>0, // Required
"TagIDs"=>array(),
"SalesPerson"=>0,
"ProjectManager"=>0,
"ForecastEstimatedPrice"=>0,
"ForecastProbabilityOfSale"=>0,
"ForecastExpectedDueDateMonth"=>"", // Must be valid month
"ForecastExpectedDueDateYear"=>"", // Must be valid in future
"StatusID"=>0, // may change the lead stage, depending on status-triggers
"CostCentreID"=>0
);
?>

Parameters

$CompanyID

int

the company id

$LeadDetails

array

an associative array of lead information.

Returns

int

LeadRetrieve

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

This function retrieves a lead with a specific number

uses \LeadHandler::RetrieveList()

Parameters

$CompanyID

int

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

$LeadID

int

The lead ID to retrieve

Returns

array

LeadRetrieveAllocated

RetrieveAllocated(int $CompanyID, bool $Detail = true, int $CustomerID = null, string $StartDate = null, string $EndDate = null, int $Limit = 10, int $Offset = 0, bool $SortAsc = true) : array
Static

This function retrieves the leads that the current staff has been allocated [Schedule]

uses \LeadHandler::RetrieveList()

Parameters

$CompanyID

int

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

$Detail = true

bool

The detail of the lead object. Null/Empty will ignore this parameter.

$CustomerID = null

int

the customer's id. Null/Empty will ignore this parameter.

$StartDate = null

string

Date start (inclusive) to search. Null/Empty will ignore this parameter. {@link http://php.net/manual/en/function.strtotime.php}

$EndDate = null

string

Date end (inclusive) to search. Null/Empty will ignore this parameter. {@link http://php.net/manual/en/function.strtotime.php}

$Limit = 10

int

how many results to return

$Offset = 0

int

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

$SortAsc = true

bool

which direction to sort the results

Returns

array

LeadRetrieveAttachments

RetrieveAttachments(int $CompanyID, int $LeadID) : array
Static

This function retrieves the list of attachemnts for the provided lead no

Parameters

$CompanyID

int

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

$LeadID

int

The lead ID to retrieve attachments for

Returns

array

LeadRetrieveList

RetrieveList(int $CompanyID, array $LeadIDs, array $Detail = null) : array
Static

This function retrieves details on the provided list of lead numbers

used_by \LeadHandler::SearchOpen()
used_by \LeadHandler::SearchClosed()
used_by \LeadHandler::SearchFields()
used_by \LeadHandler::RetrieveAllocated()
used_by \LeadHandler::Retrieve()

Parameters

$CompanyID

int

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

$LeadIDs

array

list of Lead IDs to search for.

$Detail = null

array

the specification of which details to return - ("Attachments"). Null/Empty will return all details, array(null) will return none.

Returns

array

LeadSarchClosed

SearchClosed(int $CompanyID, array $Detail = null, int $CustomerID = null, int $Limit = 10, int $Offset = 0, bool $SortAsc = true) : array
Static

This function searches for the list of leads are archived.

uses \LeadHandler::RetrieveList()

Parameters

$CompanyID

int

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

$Detail = null

array

The detail of the lead object. Null/Empty will ignore this parameter

$CustomerID = null

int

the customer id, Empty / Null returns all customers

$Limit = 10

int

how many results to return

$Offset = 0

int

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

$SortAsc = true

bool

which direction to sort the results

Returns

array

LeadSearchFields

SearchFields(int $CompanyID, array $Detail = null, array $SearchTerms = array(), string $StartDate = null, string $EndDate = null, int $Limit = 10, int $Offset = 0, bool $SortAsc = true) : array
Static

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

Implemented Search Terms are: Stage, SiteID, TagID, LeadID, Salesperson, CustomerID, StaffID, CostCentreID, DateFilterType

SearchFields[Stage] can take values of 'Open', 'Closed' SearchFields[DateFilterType] can take values of 'ScheduledDate','IssuedDate', 'FollowUpDate', 'ForecastDate' and defaults to 'ScheduledDate'

uses \LeadHandler::RetrieveList()

Parameters

$CompanyID

int

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

$Detail = null

array

The detail of the lead object. Null/Empty will ignore this parameter

$SearchTerms = array()

array

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

$StartDate = null

string

Date start (inclusive) to search for leads. Null/Empty will ignore this parameter. {@link http://php.net/manual/en/function.strtotime.php}

$EndDate = null

string

Date end (inclusive) to search for leads. Null/Empty will ignore this parameter. {@link http://php.net/manual/en/function.strtotime.php}

$Limit = 10

int

how many results to return

$Offset = 0

int

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

$SortAsc = true

bool

which direction to sort the results

Returns

array

LeadSearchOpen

SearchOpen(int $CompanyID, array $Detail = null, int $CustomerID = null, int $Limit = 10, int $Offset = 0, bool $SortAsc = true) : array
Static

This function searches for the list of open leads for a customerID

uses \LeadHandler::RetrieveList()

Parameters

$CompanyID

int

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

$Detail = null

array

The detail of the lead object. Null/Empty will ignore this parameter

$CustomerID = null

int

the customer id, Empty / Null returns all customers

$Limit = 10

int

how many results to return

$Offset = 0

int

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

$SortAsc = true

bool

which direction to sort the results

Returns

array

LeadUpdate

Update(int $CompanyID, int $LeadID, array $LeadDetails) : int
Static
<?php
$LeadDetails =
array(
"CustomerID"=>0,
"ContactID"=>0,
"Description"=>"",
"Notes"=>"",
"IssuedDate"=>"Y-m-d",
"DueDate"=>"Y-m-d",
"DueTime"=>"h:m:s",
"SiteID"=>0,
"TagIDs"=>array(),
"SalesPerson"=>0,
"ProjectManager"=>0,
"ForecastEstimatedPrice"=>0,
"ForecastProbabilityOfSale"=>0,
"ForecastExpectedDueDateMonth"=>"", // Must be valid month
"ForecastExpectedDueDateYear"=>"", // Must be valid in future
"StatusID"=>0, // may change the lead stage, depending on status-triggers
"CostCentreID"=>0
);
?>

Parameters

$CompanyID

int

the company id

$LeadID

int

the lead to update

$LeadDetails

array

an associative array of lead information.

Returns

int