CerWorkstationTickets

Description



Description | Variables (details) | Functions (details) | Methods (details) | Required Files
Location: /cerberus-api/workstation/CerWorkstationTickets.class.php

This function

Variables Summary



Description | Variables (details) | Functions (details) | Methods (details) | Required Files

Function Summary



Description | Variables (details) | Functions (details) | Methods (details) | Required Files
CerWorkstationTickets()
getTicketsByIds($ids,$with_content=true,$preserve_order=false)
quickAssignToAgent($teams,$agent_id,$limit=5)
getMyTickets($agent_id)
getSuggestedTickets($agent_id)
getMonitorEvents($user_id,$epoch=0)
_addTagsToTicketHeaders(&$tickets)
_addFlagsToTicketHeaders(&$tickets)
_addAgentsToTicketHeaders(&$tickets)
_addPreviewToTicketHeaders(&$tickets)
getTicketPreviewObject($ticket_id,$thread_id=null)
getThreadText($thread_id)
getTicketById($id)
addAgentDelayToTicket($agent_id, $ticket_id, $delay)
removeAgentDelayFromTicket($agent_id, $ticket_id)
_cacheTicketFlags($ticket_id)
addRequesterToTicket($requester,$ticket_id)
removeRequesterIdFromTicket($requester_id,$ticket_id)
addFlagToTicket($agent_id,$ticket_id)
addFlagToTickets($agent_id, $tickets, $override=false)
removeFlagOnTicket($ticket_id,$agent_id)
removeFlagOnTickets($ticket_ids, $agent_id)
changeTicketTags($ticket_id, $tags)
addTagTickets($tag_id, $ticket_ids)
changeTicketAgents($ticket_id, $agents)
addAgentTickets($agent_id, $ticket_ids)
addTagsToTicketId($tags, $ticket_id)
addAgentsToTicketId($agents, $ticket_id)
removeTagsFromTicketId($tags, $ticket_id)
removeAgentsFromTicketId($agents, $ticket_id)
sendCloseResponse($ticket)
create($to,$subject,$body,$from,$attachments=array(),$options=array())
reply($ticket_id,$body,$from,$attachments=array())
comment($ticket_id,$text,$agent_id)
forward($ticket_id,$to,$body,$attachments=array())
_buildSmtp($to,$subject,$body,$from,$attachments=array())
send_outgoing_mail($to,$subject,$body,$from,$attachments=array())
send_internal_mail($to,$subject,$body,$from,$attachments=array(),$options=array())
markSpam($ticket_id)
markHam($ticket_id)
setTicketStatus($ticket_id, $status)
setTicketMailbox($ticket_ids, $mailbox)
setTicketPriority($ticket_id, $priority)
setTicketWaitingOnCustomer($ticket_id, $waiting=0)

Method Summary



Description | Variables (details) | Functions (details) | Methods (details) | Required Files
cer_Database::getInstance()
CerWorkstationTickets::_addFlagsToTicketHeaders()
CerWorkstationTickets::_addTagsToTicketHeaders()
CerWorkstationTickets::_addAgentsToTicketHeaders()
CerWorkstationTickets::addFlagToTicket()
CerWorkstationTickets::getTicketsByIds()
CerWorkstationTickets::removeAgentDelayFromTicket()
CerWorkstationTickets::_cacheTicketFlags()
CerWorkstationTickets::getTicketById()
CerWorkstationTickets::send_internal_mail()
CerWorkstationTickets::send_outgoing_mail()
CerWorkstationTickets::_buildSmtp()
CER_AUDIT_LOG::print_action()
CER_AUDIT_LOG::log_action()
cer_DateTimeFormat::secsAsEnglishString()
CerACL::getInstance()
CerConfiguration::getInstance()
CerNotification::getInstance()

Variable Details



Description | Variables (details) | Functions (details) | Methods (details) | Required Files

Function Details



Description | Variables (details) | Functions (details) | Methods (details) | Required Files

Name: CerWorkstationTickets - line 39

Description

An empty function

Name: getTicketsByIds - line 42

Parameters:

$ids
$with_content=true
$preserve_order=false

Return

return $tickets - The tickets that are generated from the execution of the function

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. The $tickets variable is initialized as a blank array, and the $session variable is made a global variable and used to assign to the variable $user_id the value of user_id property of the login_handler subscript of the vars property of the $session variable, and if the value does not exist no error will be generated.

A sql statement is assigned to the variable $sql and upon its execution the variable $res is assigned the results that are listed in the table below:

 Tables Used
Actions Performed Using the Tablesticketqueuethread(aliased twice)address(aliased twice)queue_addressesdispatcher_delays
Fields Selected:ticket_id
min_thread_id
max_thread_id
opened_by_address_id
ticket_mask
ticket_subject
ticket_priority
is_closed
is_deleted
is_waiting_on_customer
max_thread_id
ticket_spam_trained
ticket_spam_probability
ticket_due
queue_id
queue_name
queue_perfix
thread_date(reference 2)address_address(reference 1)
address_address(reference 2)
queue_address
queue_domain
expire_timestamp formatted by FROM_UNIXTIME
INNER JOIN by:opened_by_address_id  address_id(reference 2)  
INNER JOIN by:ticket_queue_idqueue_id    
INNER JOIN by:queue_addresses_id   queue_addresses_id 
INNER JOIN by:max_thread_id thread_address_id(reference 2)   
INNER JOIN by:  thread_address(reference 2)address_id(reference 1)  
LEFT JOIN by:ticket_id    ticket_id
AND
agent_id equals $user_id variable otherwise if its empty the number zero
WHERE:ticket_id contains a value in the variable $ids after it has been converted into a comma deliminated list      
As long as the $res variable contains at least one selected row then for each row selected the $ticket variable will be instantiated as a new CerWorkstationTicket, and the following table list what values of the current iteration will be assigned to what objects in the class:
ObjectValue Assigned
idThe integer value of the ticket_id field of the ticket table
min_thread_idThe value of the min_thread_id field from the ticket table
max_thread_idThe max_thread_id field of the ticket table
maskThe value of the ticket_mask field of the ticket table unless its blank otherwise the value assigned to the id object
subjectThe value of the ticket_subject field from the ticket table
opened_by_address_idThe integer value of the opened_by_address_id field from the ticket table
opened_by_addressThe value of the address_address field of the address table
queue_idThe value of the queue_id field from the queue table
queue_nameThe value of the queue_name field of the queue table
queue_prefixThe value of the queue_prefix of the queue table
queue_addressA string containing the value of the queue_address field, the @ symbol, and the queue_domin field with both fields coming from the queue addresses table
priorityThe integer value of the ticket_priortity field from the ticket table
is_deletedThe is_deleted field from the ticket table
is_closedThe is_closed field from the ticket table
is_waiting_on_customerThe is_waiting_on_cusomter from the ticket table
date_latest_replyThe thread_date field of the second reference to the thread table
address_latest_replyThe address_address field from the address table
spam_trainedThe ticket_spam_trained field from the ticket table
spam_probabilityThe ticket_spam_proability field from the ticket table
date_dueThe return result of calling the cer_DateTime class and passing in the ticket_due field of the ticket table
date_delayThe return result of calling the cer_DateTime class and passing in the expire_timestamp field of the dispatcher_delay table

The id object of the $ticket variable which is a subscript of the $tickets array will be assgined the value of $ticket. Next the CerWorkstationTickets::_addFlagsToTicketHeaders, CerWorkstationTickets::_addTagsToTicketHeaders, and CerWorkstationTickets::_addAgentsToTicketHeaders methods are called.

If the value of the $perserve_order variable equates to the boolean value TRUE then the variable $tmp_tickets will be initialized as a blank array. For each value in the $ids array if the $ticket array with a subscript equivalent to the current loop value in the $ids array is set then the array $tmp_tickets with the subscript equivalent to the current loop value in the $ids array is assigned the value of the $tickets array subscript equivalent to the current loop value in the $ids array. After the loop exeucutes the variable $tickets is assigned the value of the $tmp_tickets array before it is unset.

Name: quickAssignToAgent - line 116

Parameters:

$teams
$agent_id
$limit=5

Return

return FALSE - Returns the boolean value FALSE if any of the parameters are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initializes the variable $left to the value of the $limit variable, and $queues with a blank array. If the the $teams variable is an array then a sql statement is assigned the variable $sql and executed such that the variable $res is assigned the queue_id field from the team_queues table where the team_id field contains one of the $teams variable after it has been converted to a comma deliminated list. For each result that is found the subscript of the $queues array equal to the value of the queue_id field of the team_queues table will be assigned the value of the queue_id field of the team_id table.

A second sql statement will be assigned to the variable $sql and executed such that the variable $res will contain the value of the ticket_id field of the ticket table, and the flag agent field of the ticket_flags_to_agents table. The fields will selected where the ticket_id field is used to join both the ticket and ticket_spotlights_to_agents table, and the ticket_id field is used to join both the ticket and dispatcher_delays table while making sure the agent_id field of the dispatcher_delays table equals the $agent_id variable. The fields will be selected where the ticket_queue_id field of the ticket table contains one of the values in the $queues variable after it has been converted into a comma deliminated list, the agent_id field of the ticket_spotlights_to_agents table contains the value of the $agent_id variable, the is_closed, is_deleted, and is_waiting_on_customer fields of the ticket table all equal zero, and the expire_timestamp field of the dispatcher_delays table contains either a NULL value or a value less then the value of UNIX_TIMESTAMP. The fields will be grouped by the ticket_id field of the ticket table, and having the agent_id field of the ticket_flags_to_agents table contains a NULL value. The number of rows selected will be between the zero and the number represented by the $limit variable, and the fields will be ordered by the ticket_priority field in a descending manner, and the ticket_due field ascendindly with both coming from the ticket table.

For each row that is is selected the $ticket_id field will be assigned the value of the ticket_id field of the ticket table that was selected, the CerWorkstationTickets::addFlagToTicket method will be called, and the value of the $left variable will be decremented by one.

If the $left variable equates to the boolean value of TRUE by being greater then or equal to one a third sql statement will be assigned to the variable $sql and executed such that the variable $res will contain the value of the ticket_id field of the ticket table, and the flag agent field of the ticket_flags_to_agents table. The fields will selected where the ticket_id field is used to join both the ticket and ticket_spotlights_to_agents table, and the ticket_id field is used to join both the ticket and dispatcher_delays table while making sure the agent_id field of the dispatcher_delays table equals the $agent_id variable. The fields will be selected where the ticket_queue_id field of the ticket table contains one of the values in the $queues variable after it has been converted into a comma deliminated list, the is_closed, is_deleted, and is_waiting_on_customer fields of the ticket table all equal zero, and the expire_timestamp field of the dispatcher_delays table contains either a NULL value or a value less then the value of UNIX_TIMESTAMP. The fields will be grouped by the ticket_id field of the ticket table, and having the agent_id field of the ticket_flags_to_agents table contains a NULL value. The number of rows selected will be between the zero and the number represented by the $limit variable, and the fields will be ordered by the ticket_priority field in a descending manner, and the ticket_due field ascendindly with both coming from the ticket table. Then for each row that is is selected the $ticket_id field will be assigned the value of the ticket_id field of the ticket table that was selected, the CerWorkstationTickets::addFlagToTicket method will be called.

Name: getMyTickets - line 277

Parameters:

$agent_id - The Id of the agent that is needed

Return

return $tickets - The tickets that are generated from the execution of the function

Description

A sql statement is assigned to the variable $sql and upon its execution the variable $res is assigned the results that are listed in the table below:

 Tables Used
Actions Performed Using the Tablesticketticket_flags_to_agentsthread(aliased twice)addressdispatcher_delays
Fields Selected:ticket_id
ticket_mask
ticket_subject
ticket_priority
is_closed
is_deleted
is_waiting_on_customer
max_thread_id
ticket_spam_trained
ticket_spam_probability
ticket_due
 thread_date(reference 2)address_addressexpire_timestamp
INNER JOIN by:ticket_idticket_id   
INNER JOIN by:ticket_id ticket_id(reference 1)  
INNER JOIN by:ticket_id ticket_id(reference 2)  
INNER JOIN by:  thread_address_id(reference 2)address_id 
LEFT JOIN by:ticket_id   ticket_id
AND
agent_id equals $agent_id variable
WHERE:max_thread_id equals  thread_id(reference 2)  
AND WHERE:is_closed equals zero
is_deleted equals zero
is_waiting_on_customer equals zero
agent_id equals $agent_id variable  expire_timestamp equals NULL or less then the value of UNIX_TIMESTAMP()
GROUP by:ticket_id    
ORDER by:ticket_priority in a descending fashion    
As long as the $res variable contains at least one selected row then for each row selected the $ticket variable will be instantiated as a new CerWorkstationTicket, and the following table list what values of the current iteration will be assigned to what objects in the class:
ObjectValue Assigned
idThe integer value of the ticket_id field of the ticket table
maskThe value of the ticket_mask field of the ticket table unless its blank otherwise the value assigned to the id object
subjectThe value of the ticket_subject field from the ticket table
priorityThe integer value of the ticket_priortity field from the ticket table
is_deletedThe is_deleted field from the ticket table
is_closedThe is_closed field from the ticket table
is_waiting_on_customerThe is_waiting_on_cusomter from the ticket table
date_latest_replyThe thread_date field of the second reference to the thread table
address_latest_replyThe address_address field from the address table
spam_trainedThe ticket_spam_trained field from the ticket table
spam_probabilityThe ticket_spam_proability field from the ticket table
date_dueThe return result of calling the cer_DateTime class and passing in the ticket_due field of the ticket table

The id object of the $ticket variable which is a subscript of the $tickets array will be assgined the value of $ticket. Next the CerWorkstationTickets::_addFlagsToTicketHeaders, CerWorkstationTickets::_addTagsToTicketHeaders, and CerWorkstationTickets::_addAgentsToTicketHeaders methods are called.

Name: getSuggestedTickets

Parameters:

$agent_id - The Id of the agent that is needed

Return

return $tickets - The tickets that are generated from the execution of the function

Description

A sql statement is assigned to the variable $sql and upon its execution the variable $res is assigned the results that are listed in the table below:

 Tables Used
Actions Performed Using the Tablesticketticket_spotlights_to_agentsthread(aliased twice)addressdispatcher_delays
Fields Selected:ticket_id
ticket_mask
ticket_subject
ticket_priority
is_closed
is_deleted
is_waiting_on_customer
max_thread_id
ticket_spam_trained
ticket_spam_probability
ticket_due
 thread_date(reference 2)address_addressexpire_timestamp
INNER JOIN by:ticket_idticket_id   
INNER JOIN by:ticket_id ticket_id(reference 1)  
INNER JOIN by:ticket_id ticket_id(reference 2)  
INNER JOIN by:  thread_address_id(reference 2)address_id 
LEFT JOIN by:ticket_id   ticket_id
AND
agent_id equals $agent_id variable
WHERE:max_thread_id equals  thread_id(reference 2)  
AND WHERE:is_closed equals zero
is_deleted equals zero
is_waiting_on_customer equals zero
agent_id equals $agent_id variable  expire_timestamp equals NULL or less then the value of UNIX_TIMESTAMP()
GROUP by:ticket_id    
ORDER by:ticket_priority in a descending fashion    
As long as the $res variable contains at least one selected row then for each row selected the $ticket variable will be instantiated as a new CerWorkstationTicket, and the following table list what values of the current iteration will be assigned to what objects in the class:
ObjectValue Assigned
idThe integer value of the ticket_id field of the ticket table
maskThe value of the ticket_mask field of the ticket table unless its blank otherwise the value assigned to the id object
subjectThe value of the ticket_subject field from the ticket table
priorityThe integer value of the ticket_priortity field from the ticket table
is_deletedThe is_deleted field from the ticket table
is_closedThe is_closed field from the ticket table
is_waiting_on_customerThe is_waiting_on_cusomter from the ticket table
date_latest_replyThe thread_date field of the second reference to the thread table
address_latest_replyThe address_address field from the address table
spam_trainedThe ticket_spam_trained field from the ticket table
spam_probabilityThe ticket_spam_proability field from the ticket table
date_dueThe return result of calling the cer_DateTime class and passing in the ticket_due field of the ticket table

The id object of the $ticket variable which is a subscript of the $tickets array will be assgined the value of $ticket. Next the CerWorkstationTickets::_addFlagsToTicketHeaders, CerWorkstationTickets::_addTagsToTicketHeaders, and CerWorkstationTickets::_addAgentsToTicketHeaders methods are called.

Name: getMonitorEvents - line 485

Parameters:

$user_id - Id of the user needed
$epoch=0 - Initializes the variable to zero

Return

return $tickets - Returns the array of tickets that was generated

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. If the variable $epoch is empty then it will set the return result of the mktime() function. A sql statement is assigned to the variable $sql and executed such that the variable $res will be assigned the values of the auidt_id, ticket_id, epoch, timestamp, user_id, action, and action_value fields from the ticket_auidt_log table, the user_name field from the user table, and the ticket_subject, ticket_mask, and ticket_priority fields of the ticket table. The fields will be selected by joining the ticket_audit_log, and user tables by the user_id field, joining the ticket_audit_log, and ticket tables by the ticket_id field, and where the value of the timestamp field of the ticket_audit_log is great then the value of the $epoch variable. The results will be limited to a hundred rows, and ordered by the timestamp and audit_id fields of the ticket_audit_log table in a descending fashion

As long as the $res variable contains at least one selected row, then for each row selected the $ticket variable will be instantiated as a new CerWorkstationTicket, and the following table list what values of the current iteration will be assigned to what objects in the class:
ObjectValue Assigned
idThe integer value of the ticket_id field of the ticket_audit_log table
maskThe value of the ticket_mask field of the ticket table unless its blank otherwise the value assigned to the id object
subjectThe value of the ticket_subject field from the ticket table
priorityThe integer value of the ticket_priortity field from the ticket table
action_timestampThe value of the timestamp field from the ticket_audit_log table
actionThe return results of the CER_AUDIT_LOG::print_action
The next available subscript of the $tickets variable will have the $ticket variable assigned to it.

Name: _addTagsToTicketHeaders - line 518

Parameters:

&$tickets - A reference to the tickets the function needs

Return

return FALSE - Returns the boolean value FALSE if the parameter are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. Assigns a sql statement to the variable $sql that upon execution will return to the variable $tag_res the values of the ticket_id, and tag_id fields from the workstation_tags_to_tickets table, the tag_name field from the workstation_tags table, and the id and name fields from the workstation_tag_sets table. The fields will be selected by joining the tag_id field in both the workstation_tags and workstation_tags_to_tickets tables, by joining the tag_set_id field of the workstation_tags table with the id field of the workstation_tag_sets table, and where the ticket_id field of the workstation_tags_to_tickets contains on of the values in the $tickets variable after it has been converted into a comma deliminated list.

As long as the $tag_res variable contains at least one selected row, then for each row selected the tags object containing an array designated by the $tag_row variable with the subcsript tag_id which belonds to the $tickets array with the subscript containing the variable $tag_row with the subscript ticket_row will be assigned an array containing they keys name, parent, and parent_id, and the values of the tag_name field from the workstation_tags table, the id, and name fields from the workstation_tag_sets table respectively.

Name: _addFlagsToTicketHeaders - line 549

Parameters:

&$tickets - A reference to the tickets the function needs

Return

return FALSE - Returns the boolean value FALSE if the parameter are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. Assigns a sql statement to the variable $sql that upon execution will return to the variable $flags_res the values of the ticket_id and agent_id fields of the ticket_flags_to_agents table and the user_name field of the user table. The fields will be selected where the user_id field of the user table is joined with the agent_id field of the ticket_flags_to_agents table and the ticket_id field of the ticket table contains one of the values in the $tickets array after it has been converted into a comma deliminated list. The results will be ordered by the user_name field of the user table.

As long as the $flages_res variable contains at least one selected row, then for each row selected the subscript of the flags object containing the $flag_row array with the agent_id field which belongs to the $tickets array with the subscript containing the array $flay_row using the subscript ticket_id will be assigned that value of the user_name field from the uers table that was selected.

Name: _addAgentsToTicketHeaders - line 598

Parameters:

&$tickets - A reference to the tickets the function needs

Return

return FALSE - Returns the boolean value FALSE if the parameter are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. Assigns a sql statement to the variable $sql that upon execution will return to the variable $agent_res the values of the ticket_id and agent_id fields of the ticket table, and the user_name field of the user table. These fields will be selected upoin the agent_id field of the ticket table being joined with the user_id of the user table and the ticket_id field of the ticket table containing one of the values in the $tickets variable after it has been convereted into a comma deliminated list. The fields selected will be ordered by the user_name field of the user table.

As long as the $agent_res variable contains at least one selected row, then for each row selected the agent_id subscript of the $agent_row array which is a subscript of the agents object of the $tickets array with the subscript containing the array $agent_row with the subscript ticket_id will be assigned the value from the user_name field of the user table.

Name: _addPreviewToTicketHeaders - line 623

Parameters:

&$tickets - A reference to the tickets the function needs

Return

return FALSE - Returns the boolean value FALSE if the parameter are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. Assigns a sql statement to the variable $sql that upon execution will assign to the variable $content_res the ticket_id field of the ticket table, the thread_content_part and thread_id fields from the thread_content_part table. The fields will be selected upon the the thread and thread_content_part tables being joined by their thread_id field, the thread_id flag of the thread table being joined ot the max_thread_id field of the ticket table, and the ticket_id field of the ticket table containing one of the values in the $tickets variables after it has been converted into a comma deliminated list. The results will be ordered by the content_id field of the thread_content_part table.

As long as the $content_res variable contains at least one selected row then for each selected row the preview_text object of the subscript of the $tickets array containg the array $content_row with the subscript ticket_id will be appended with the value of the thread_content_field field from the thread_content_part table as long as the subscript of the $tickets array containg the array $cotent_row with the subscript ticket_id is set.

Name: getTicketPreviewObject - line650

Parameters:

$ticket_id - The id of the ticket that was selected
$thread_id=null - Initializes the variable to a null value

Return

return array("preview"=>$preview,"threads"=>$threads,"thread_id"=>$thread_id) - Returns an array with key and value pairs representative of the data generated by the execution of the function

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call, the $threads variable as an empty array, and the $date, $sender, and $text variables as a blank string. A sql statement is assigned to the variable $sql and executed such that the variable $ticket_res is assigned the value of the thread_id, and thread_date fields of the thread table, and the address_address field of the address table. The fields will be select where the thread and ticket tables are joined by the ticket_id field, the thread_address of the thread table is joined with the address_id field of the address table, and the ticket_id field of the ticket table equals the value of the $ticket_id variable. The fields selected will be ordered by the thread_id field of the thread table.

If the sql statement returned at least one record then the $last variable will be intialized to zero, and the $num variable will be intialized to one. For each row in the array of results represented by the variable $ticket_res the following steps will happen:

  1. The variable $i will be assigned to the value of the thread_id field from the thread table.
  2. The $threads array will have the subscript represented by the variable $i initialized to an array with the following keys and values:
    KeyValue
    thread_idThe variable $i
    dateThe value of the thread_date field from the thread table
    addressThe value of the address_address field from the address table
    nextThe number zero
    prevThe number zero
    posThe value of the variable $num plus one
  3. If the value of the $last variable equates to the boolean value TRUE then the prev subscript of the subscript represented by the variable $i of the variable $threads will be assigned to the value of $last, and the next subscript of the subscript represented by the variable $last of the $threads variable will be set to the value of the $i variable
  4. The variable $last will be assigned to the value of the $i variable

If the variable $thread_id is empty or the subscript represented by the variable $thread_id of the variable $threads is not set then for each value in the $threads array the $thread_id variable will be assigned the current value of the $threads variable.

The $date variable will be assigned the value of the date subscript of the subscript represented by the $thread_id variable of the $threads variable. The $sender variable will be assigned the value of the address subscript of the subscript represented by the variable $thread_id of the variable $threads. A second sql statement will be assigned to the variable $sql and executed such that the variable $content_res will be assigned the value of the thread_id, thread_content_part, and thread_id fields of the thread_content_part table where the thread_id field equals the value of the $thread_id variable, and the results will be ordered by the content_id field. If the sql statement returned results then for each indice in the $content_res array the $text variable will be appenended with the result returned from the thread_content_part field of the thread_content_part table.

The $preview variable will be instantiated with an instance of the stdClass, and the sender, date, and text objects will be assigned the values of the $sender, $date, and $text variables respectively.

Name: getThreadText - line 728

Parameters:

$thread_id - Id of the thread that needs its text retrieved

Return

return $preview - Returns the class it represents with the values set by the function

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call, and the $date, $sender, and $text variables to a blank string. Assigns a sql statement to the variable $sql and executes it such that the variable $ticket_res will be assigned the ticket_id field from the ticket table, the thread_id and thread_date fields from the thread table, and the address_address field from the address table. The fields will be selected by joining the ticket_id field of both the ticket and thread table, by joining the thread_address field of the thread_address table with the address_id field of the address field and where the thread_id field of the thread table equals the value of the $thread_id field. Only the first row that is found will be selected.

If a row was selected then the $date variable will be assigned the value of the thread_date field of the thread table, the $ticket_id variable will be assigned the integer value of the ticket_id field of the ticket table, and the $sender variable will be assigned the address_address field of the address table.

A second sql statement is assigned to the variable $sql and executed such that the $content_res variable will be assigned the values of the thread_id, thread_content_part, and thread_id fields of the thread_content_part table where the thread_id field equals the value of the $thread_id variable, and have the results ordered by the content_id field. If the sql statement returned results then for each indice in the $content_res array the $text variable will be appenended with the result returned from the thread_content_part field of the thread_content_part table.

The $preview variable will be instantiated with an instance of the stdClass, and the ticket_id, sender, date, and text objects will be assigned the values of the $ticket_id, $sender, $date, and $text variables respectively.

Name: getTicketById - line 785

Parameters:

$id - The id that is used to retrieve the ticket

Return

return @$tickets[$id] - Returns the tickets that contain the id specified, and if an error is generated it will be ignored.

Description

Assigns the $tickets variable the return results of the CerWorkstationTickets::getTicketsByIds method call.

Name: addAgentDelayToTicket - line 790

Parameters:

$agent_id - Id of the agent that is needed
$ticket_id - Id of the ticket that is needed
$delay - The delay that is added to the ticket

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. The CerWorkstationTickets::removeAgentDelayFromTicket method is then called. A sql statement is assigned to the variable $sql and executed to insert into the ticket_id, agent_id, delay_type, added_timestamp, expire_timestamp, and reason fields of the dispatcher_delays table the values of the $ticket_id and $agent_id variables, the number one, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() with the value of the $delay variable added to it, and a blank string.

The variable $session will be declared as a global variable and the variable $user_id is assigned the value of user_id property of the login_handler subscript of the vars property of the $session variable, and if the value does not exist no error will be generated. If the $user_id variable is not empty then the CER_AUDIT_LOG::log_action method will be called using the parameters listed by bullet number one.

Name: removeAgentDelayFromTicket - line 816

Parameters:

$agent_id - Id of the agent that is needed
$ticket_id - The id of the ticket that is needed

Return

return TRUE - Returns the boolean value of TRUE

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. A sql statement is assigned to the variable $sql and executed to delete from the dispatcher_delays table where the ticket_id and the agent_id fields equals the values of both the $agent_id and $ticket_id variables respectively.

Name: _cacheTicketFlags - line 828

Parameters:

$ticket_id - Id of the ticket that is needed

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. A sql statement is assigned to the variable $sql and executed to assign to the variable $res the count of the agent_id field, and the ticket_id field from the ticket_flags_to_agents table where the ticket_id field equals the value of the $ticket_id variable with the results being grouped by the ticket_id field. If the variable $res contains results then the $hits variable will assigned the count of the agent_id field that was generated, otherwise the variable $hits will assigned the number zero. A second sql statement is assigned to the variable $sql and executed to update the ticket table by setting the num_flags field equal to the value of the $hits variable where the ticket_id field equals the value of the $ticket_id variable.

Name: addRequesterToTicket - line 874

Parameters:

$requester - The value of who is requesting the ticket
$ticket_id - Id of the ticket that needs to be modified

Description

The email_parser.php is included and the variable $cer_ticket is assigned the return value of the CER_PARSER_TICKET constructor function. The variable $requester_id is assigned the return result of the get_address_id function call of the class represented by the variable $cer_ticket after it is passed the $requester variable. If the return result of the save_requester_link function call of the class represented by the variable $cer_ticket after it is passed the variables $ticket_id, and $requester_id equates to the boolean value TRUE then the global $session variable is decalred, and the CER_AUDIT_LOG::log_action method will be called using the parameters listed by bullet number two.

Name: removeRequesterIdFromTicket - line 887

Parameters:

$requester_id - Id of the requester linked to the ticket
$ticket_id - Id of the ticket that needs to be modified

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. Assigns a sql statement to the variable $sql to delete from the requestor table where the ticket_id and address_id fields equals the value of the $ticket_id, and $requester_id variables.

Name: addFlagToTicket - line 898

Parameters:

$agent_id - Id of the agent who set the flag
$ticket_id - Id of the ticket that has the flag set

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. A sql statement is assigned to the $sql variable and executed to replace into the ticket_flags_to_agents table the values of the $ticket_id, and $agent_id variables into the ticket_id, and agent_id fields respectively.

The variable $session will be declared as a global variable and the variable $user_id is assigned the value of user_id property of the login_handler subscript of the vars property of the $session variable, and if the value does not exist no error will be generated. If the $user_id variable is not empty then the CER_AUDIT_LOG::log_action method will be called using the parameters listed by bullet number three. The CerWorkstationTickets::_cacheTicketFlags method is then called.

Name: addFlagToTickets - line 929

Parameters:

$agent_id - Id of the agent that set the flag
$tickets - The array of tickets needed $override=false - The agent can not override and take a ticket from someone else

Return

return $flagged_by_others_only - Returns an array of tickets that are not associated with agents id represented by the variable $agent_id

Description

Assigns a sql statement to the variable $sql and then assigns the results of its execution to the variable $res. The sql statement will select from the ticket_id, and agent_id fields of the ticket_flags_to_agents table where the ticket_id contains one of the values in the $tickets array after it has been converted into a comma deliminated list.

The $flagged_by_others, $flagged_by_others_only, and the $flagged_by_me variables are all initialized as a blank array. As long as the $res variable is an array a loop is executed where the following steps occur upon each iteration:

  1. The variable $ticket_id is assigned the value of the current loops iteration ticket_id subscript of the $res variable.
  2. If the agent_id subscript of the $row variable is equal to the value of the agent_id variable then the next available subscript of the $flagged_by_me variables is assigned the value of the $ticket_id variable subscript of the $tickets variable. Otherwise the next available subscript of the $flagged_by others variable will assigned the values of the $ticket_id variable subscript of the $tickets variable.
Both the $flagged_by_me and $flagged_by_thers arrays will be converted to contain only unique values.

If the $override variable contains either the number one or the boolean value of TRUE then the $tickets_to_insert variable will be assigned an array containing all the values of the $ticket array that are not in the $flagged_by_me variable. This array will contain all the tickets that have not been flagged, and because the override variable is true all the tickets that were assigned to others. Otherwist the $tickets_to_insert array will be assigned all the values in the $tickets array that are not in the $flagged_by_me, and $flagged_by_others arrays. This will leave only tickets that have been not been flagged by anyone yet. Then the $flagged_by_others_only variable is assigned all the values in the $flagged_by_others array thatr is not in the $flagged_by_me array. This will generate an array of flagged tickets that do not belong to the agent.

As long as the $tickets_to_insert array is an array then for each item in the array the CerWorkstationTickets::addFlagToTicket method is called and passed the current iteration value of the $tickets_to_insert variable.

Name: removeFlagOnTicket - line 977

Parameters:

$ticket_id - The id of the ticket that needs to be modified
$agent_id - Id of the agent that is neededd

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. Assigns a sql statement to the variable $sql and executes it to delete from the ticket_flags_to_agetns table where the ticket_id and agent_id equals the value of the $ticket_id and $agent_id variables respectively. The variable $session will be declared as a global variable and the variable $user_id is assigned the value of user_id property of the login_handler subscript of the vars property of the $session variable, and if the value does not exist no error will be generated. As long as the $user_id variable is not blank the CER_AUDIT_LOG::log_action method will be called using the parameters listed by bullet number four.

Name: removeFlagOnTickets - line 1001

Parameters:

$ticket_ids - The ids of the tickets that will be modified
$agent_id - The id of the agent that will be used

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. A loop will be executed the same numer of times as there are items in the $ticket_ids array, and the variable $i will keep track of the number of the current loop iteration. For each iteration if the value of the $i subscript of the $ticket_ids array is not of the type integer then the number zero will be assigned.

A sql statement will be assigned to the variable $sql and execute to delete from the ticket_flags_agents table where the agent_id field equals the value of the $agent_id variable, and the ticket_id fields contains one of the values in the $ticket_ids variable after it has been converted into a comma deliminated list with each value preceded and succeeded with a single quote.

The variable $session will be declared as a global variable and the variable $user_id is assigned the value of user_id property of the login_handler subscript of the vars property of the $session variable, and if the value does not exist no error will be generated. For each indice in the $ticket_ids array the variable $i will keep track of the current number representing the loop iteration. If the value of the $i variable subscript of the $ticket_id array does not equate to the boolean value FALSE the following will occur:

  1. If the $user_id variable is not empty then the CER_AUDIT_LOG::log_action method will be called using the parameters listed by bullet number five.
  2. The CerWorkstationTickets::_cacheTicketFlags method will be called.

Name: changeTicketTags - line 1033

Parameters:

$ticket_id - The id of the tag that is needed
$tags - The tags that need to be modified

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. A sql statement is assigned to the variable $sql and execute to delete from the workstation_tags_to_tickets table where the ticket_id field equals the value of the $ticket_id variable. If either the $tags or $ticket_id variable is empty then the function stops executing. For each indice in the $tags array a sql statement will be assigned to the variable $sql and executed to insert into the ticket_id and tag_id fields of the workstation_tags_to_tickets table with the value of the $ticket_id variable, and the value of the current iterations $tag_id.

Name: addTagTickets - line 1061

Parameters:

$tag_id - The id of the tag that is needed
$ticket_ids - The ids of the tags that needs to be modified

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. A loop will be executed the same numer of times as there are items in the $ticket_ids array, and the variable $i will keep track of the number of the current loop iteration. For each iteration if the value of the $i subscript of the $ticket_ids array is not of the type integer then the number zero will be assigned. The following string will be assigned to the variable $sql: REPLACE INTO `workstation_tags_to_tickets` (`ticket_id`,`tag_id`) VALUES. The variable $seperator will be initialized to a blank space. For each value in the $ticket_ids array the variable $sql will be appended with the value of the $seperator, $ticket_id, a comma, and the $tag_id variables as long as both the $ticket_id, and $tag_id variables are not equal to zero. In the event that the value of the $seperator variable is a space it will be reassigned to contain the value of a comma.

Name: changeTicketAgents - line 1146

Parameters:

$ticket_id - The id of the ticket needed
$agents - The agents that will be modified

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call, and the $notify variable with the return result of the CerNotification::getInstance() method call. Then the variable $preticket is assigned the return value of the CerWorkstationTickets::getTicketById method call, and in the event nothing is returned the function will stop executing.

A sql statement is assigned to the variable $sql and executed to delete from the ticket_spotlights_to_agents table where the ticket_id field equals the value of the $ticket_id variable. The exectuion of the function will stop here in the event either of the parameters is empty.

For each indice in the $agents array a sql statement will be assigned to the variable $sql and executed to insert into the ticket_id and agent_id fields of the ticket_spotlights_to_agents table with the value of the $ticket_id variable, and the value of the current iterations $agent_id. In the event that the subscript equivalent to the value of the $agent_id variable of the agents variable of the variable class represented by the $preticket variable is not set then the triggerEvent function of the class represented by the variable $notify will be called and given the string EVENT_ASSIGNMENT, and an array with the keys ticket_id, and agent_id respectively containing the values of the $ticket_id, and $agent_id variable.

Name: addAgentTickets - line 1184

Parameters:

$agent_id - The id of the agent that needs to be modified
$ticket_ids - The array of ticket ids that will be used

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call, and the $notify variable with the return result of the CerNotification::getInstance() method call. A loop will be executed the same numer of times as there are items in the $ticket_ids array, and the variable $i will keep track of the number of the current loop iteration. For each iteration if the value of the $i subscript of the $ticket_ids array is not of the type integer then the number zero will be assigned.

The following string will be assigned to the variable $sql: REPLACE INTO `ticket_spotlights_to_agents` (`ticket_id`,`agent_id`) VALUES. The variable $seperator will be initialized to a blank space. For each value in the $ticket_ids array the variable $sql will be appended with the value of the $seperator, $ticket_id, a comma, and the $agent_id variables as long as both the $ticket_id, and $agent_id variables are not equal to zero. In the event that the value of the $seperator variable is a space it will be reassigned to contain the value of a comma. Then the triggerEvent function of the class represented by the variable $notify will be called and given the string EVENT_ASSIGNMENT, and an array with the keys ticket_id, and agent_id respectively containing the values of the $ticket_id, and $agent_id variable.

Name: addTagsToTicketId - line 1211

Parameters:

$tags - The array of tages that will be modified
$ticket_id - The id of the ticket that will be used

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. For each indice in the $tags array a sql statement will be assigned to the variable $sql and executed to replace the ticket_id and tag_id fields of the workstation_tags_to_tickets table with the value of the $ticket_id variable, and the value of the current iterations $tag_id.

Name: addAgentsToTicketId - line 1251

Parameters:

$agents - The array of agents to be modified
$ticket_id - The id of the ticket that is needed

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call, and the $notify variable with the return result of the CerNotification::getInstance() method call. For each indice in the $agents array a sql statement will be assigned to the variable $sql and executed to replace the ticket_id and agent_id fields of the ticket_spotlights_to_agents table with the value of the $ticket_id variable, and the value of the current iterations $agent_id. Then the triggerEvent function of the class represented by the variable $notify will be called and given the string EVENT_ASSIGNMENT, and an array with the keys ticket_id, and agent_id respectively containing the values of the $ticket_id, and $agent_id variable.

Name: removeTagsFromTicketId - line 1273

Parameters:

$tags - The array of tags that needs to be modified
$ticket_id - The id of the ticket that is needed

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. A sql statement is assigned to the variable $sql and executed to delete from the workstation_tags_to_tickets tbable where the ticket_id field equals the value of the $ticket_id variable, and the tag_id field contains one of the values in the $tags array after it has been convereted into a comma deliminated list.

Name: removeAgentsFromTicketId - line 1289

Parameters:

$agents - The array of agents that need to be modified
$ticket_id - The id of the ticket that is needed

Return

return FALSE - Returns the boolean value FALSE if either of the parameters are empty
return TRUE - Return the boolean value TRUE if the function executes correctly.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. A sql statement is assigned to the variable $sql and executed to delete from the ticket_spotlights_to_agents table where the ticket_id field equals the value of the $ticket_id variable and the agent_id field contains one of the values in the $agents array after it has been converted to a comma deliminated list.

Name: sendCloseResponse - line 1323

Parameters:

$ticket - The ticket needed

Description

Includes the file email_parser.php and sets the $cer_ticket variable equal to the return result of the CER_PARSER_TICKET constructor function. The load_ticket_data function of the class represented by the variable $cer_ticket is called and passed the $ticket variable. The $cer_parser variable is set equal to the return result of the CER_PARSER constructor function. The send_closerespone function of the class represented by the variable $cer_parser is called and passed the $cer_ticket variable.

Name: create - line 1354

Parameters:

$to - Represent to whom the mail will be sent
$subject - Represents the subject of the mail
$body - Represents the contents of the mail
$from - Represents who sent the mail
$attachments=array() - Converts the incoming attachments to an array
$options=array() - Converts the incoming options to an array

Return

return $id - Id of the created ticket if it was succesful
return FALSE - Returns the boolean value of FALSE if the function failed

Description

The CerWorkstationTickets::send_internal_mail method is called, and the variable $bool is assigned the return results. As long as the value of $bool does not equate to the boolean value FALSE the function continues. The variable$ db is initialized with the return result of the cer_Database::getInstance() method call, the variable $id is initialized to zeor, and the variable $mask is intialized as a blank string.

A sql statement is assigned to the variable $sql and executed such that the variable $res is assigned the values of the ticket_id and ticket_mask fields that are selected from the ticket table. The fields are selected upon the thread_id field of the thread table being joined to the min_thread_id field of the ticket table, the opened_by_address_id field of the ticket table joined to the address_id of the address table, the ticket_subject field of the ticket table equaling the $subject variable and the address_address field of the address table equals the value of the $from variable. The results will be ordered by the ticket_id field in a descending fashion, and the results will be limited to only one row.

If the variable $res does contain a selected row then the $id variable will be assigned the value of the ticket_id field that was selected as an integer, and the variable $mask will be assigned the value of the ticket_mask field that was selected, unless it is empty in which case the value of the $id variable will be used. If the CC_REQUESTER field of the $options array exists then the variable $notice will be assigned the string: A new helpdesk ticket has been opened for you with the ID:. the value of the variable $mask, a carriage return followed by a linefeed, four dashes and two pairs of a carriages return followed by a linefeed. Then the $subject variable is assigned a string containing [msg #, the value of the $mask variable, ]:, and the value of the $subject variable. Then the CerWorkstationTickets::send_outgoing_mail method is called.

Name: reply - line 1400

Parameters:

$ticket_id - The id of the ticket
$body - The contents of the mail
$from - Represents who sent the mail
$attachments=array() - Converts the incoming attachments to an array

Return

return FALSE - returns the boolean value FALSE if the variable $ticket is empty

Description

The $ticket variable is assigned the results of the CerWorkstationTickets::getTicketById method call. The $subject variable is assigned a string containing [msg #, the value of the mask variable contained by the class variable $ticket, ]:, and the value of the subject variable contained by the class variable $ticket. The CerWorkstationTickets::send_internal_mail method is called.

Name: comment - line 1412

Parameters:

$ticket_id - The id of the ticket
$text - The text to add to the comment
$agent_id - Id of the agent who made the comment

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call. A sql statement is then generated to insert into the ticket_id, created_by_agent_id, date_created, and note fields of the next_step table the values of the $ticket_id, and $agent_id variables, UNIX_TIMESTAMP(NOW()), and the value of the $text variable respectively.

Name: forward - line 1425

Parameters:

$ticket_id - The id of the ticket
$to - The value of whom the mail goes to
$body - The value representing the contents of the email
$attachments=array() - Assigns the incoming message attachmetns to an array

Return

return FALSE - Returns the boolean value false if the $ticket variable is empty

Description

The $ticket variable is assigned the results of the CerWorkstationTickets::getTicketById method call. The $subject variable is assigned a string containing [msg #, the value of the mask variable contained by the class variable $ticket, ]:, and the value of the subject variable contained by the class variable $ticket. The CerWorkstationTickets::send_outgoing_mail method is called.

The variable $session will be declared as a global variable and the variable $user_id is assigned the value of user_id property of the login_handler subscript of the vars property of the $session variable, and if the value does not exist no error will be generated. As long as the $user_id variable is not blank the CER_AUDIT_LOG::log_action method will be called using the parameters listed by bullet number six.

Name: _buildSmtp - line 1443

Parameters:

$to - The value of whom the mail goes to
$subject - The value representating the subject of the mail
$body - The value representing the body of the email
$from - The value representing who the mail is from
$attachments=array() - Assigns the attachments of the mail to an array

Return

return $smtp - Returns the email that was generated

Description

The mimePart.php file will be included, and the variable $message will be assigned a refer to the Mail_mimePart function after it has been called with the passed in values of a blank string, and an array with the string content_type acting as the key and the string multipart/mixed acting as the value. The addSubpart function of the class represented by the variable $message will be called and passed in the value of the $body variable and an array where the string content_type is the key and the string text/plain is its value.

For each subscript in the $attachments array the following steps will occur:

  1. The contet_type subscript of the $params variable will be set to the value of the content_type subscript of the current iteration value of $attachment as long as that value exists, otherwise the string application/octet_stream will be assigned
  2. The encoding subscript of the variable $params will be set to the string base64
  3. The disposition subscript of the $params variable will be set to the string attachment
  4. The dfilename subscript of the $params variable will be set to the file_name subscript of the current iteration value of the $attachments variable
  5. The addSubpart function of the class represented by the variable $message will be called and passed the variables $date and $params

The $headers variable will be assigned the following string: the string To:, the value of the variable $to, a carriage return and a newline, the string From: the value of the variable $from and a carriage return and a newline, the string Subject:, the value of the $subject variable, and a carriage return and a newline, the string Reply-to:, the value of the $from variable, and a carriage return and a newline, the string Date:, and the value of the date function after passing it the string r. The variable $hdr will be assigned the value of the variable $headers after it has been converted to an array with the carriage return and newline seperating the string into indices. The $smtp variable will be initialized as a blank array.

The random number generator will be seeded and the $message_id variable will be assigned a string containing <, a random number, a period, another random number, the @ symbol, the value contained by $_SERVER['HTTP_HOST'] if it is not empty, otherwise the value contained by $_SERVER['SERVER_NAME'] will be used, and >. The next available subscript of the $hdr array will be assigned the string Message-ID, and the value of the $message_id variable. Then the next available subscript of the $hdr array will be assigned the string MIME-Version: 1.0.

The variable $mime_output will be assigned the return result of the encode function of the class represented by the variable $message. The variable $body will be assigned the value contained in the body subscript of the $mime_output variable. For each value in the headers subscript of the $mime_output variable the next available subscript of the $hdr variable will be assigned the string representing the value of the current subscript, a colon, and the value contained by that subscript. Then for each value in the $hdr array the next available subscript of the variable $smtp will be assigned the current iteration value of the $hdr array appeneded with a carriage return and a newline.

The next available subscript of the $smtp array will be assigned a carriage return and a newline. If the variable $body equates to the boolean value of TRUE then the $bdy variable will be assigned the value of $body after it is converted into an array where both the carriage return and newline characters will sepearate each indice, and every period at the start of a line is replaced with a double period. Then for each value in the $bdy array the next available subscript of the variable $smtp will be assigned the current iteration value of the $bdy array appeneded with a carriage return and a newline.

Name: send_outgoing_mail - line 1496

Parameters:

$to - The variable representing to whom the mail will be sent
$subject - The variable representing the subject of the mail
$body - The variable representing the contents in the body of the mail
$from - The variable representing who the email is from
$attachments=array() - Assigns the attachments to an array

Description

The htmlMimeMail.php file is included, and the $to variable is converted to an array if it is not an array already. The variable $cfg is assigned the return results of the CerConfiguration::getInstance() method call, and the variable $mail is assigned the return results results of the htmlMimeMail. The following table list the functions of the class represented by $mail that are called and what parameter(s) are sent:

Function CalledParameter(s) Sent
setTextThe variable $body
setFromThe variable $from
setCcThe variable $cc as long as it is not empty
setSubjectThe variable $subject
setReturnPathThe variable $from
setHeaderThe string Reply-To and the variable $from
setHeaderThe string X-Mailer, and a string containg Cerberus Helpdesk v., the value of the GUI_VERSION variable, and (http://www.cerberusweb.com)

The random number generator will be seeded and the $message_id variable will be assigned a string containing <, a random number, a period, another random number, the @ symbol, the value contained by $_SERVER['HTTP_HOST'] if it is not empty, otherwise the value contained by $_SERVER['SERVER_NAME'] will be used, and >. Then the setHeader function of the class referenced by $mail will be called and passed the string Message-ID, and the variable $message_id.

If the $attachments array contains values then for each value then the $attachment array will be assigned the return result of the getFile function of the class represented by the variable $mail after it has been passed the tmp_file subscript of the current loop iteration value of the $attachments variable and no errors will be generated. Then as long as the $attachment variable is not empty the addAttachment function of the class referenced by the variable $mail will be sent the variable $attachment, and the file_name subscript of the current loop iterations value of the $attachment variable.

The variable $result will be assigned the return value of the send function of the class represented by the variable $mail after it has been sent the value of the variable $to, and the return value of the settings function call of the class represented by the variable $cfg after it has been sent the string mail_delivery. Any errors generated will be supressed.

Name: send_internal_mail - line 1531

Parameters:

$to - The variable representing to whom the mail will be sent
$subject - The variable representing the subject of the mail
$body - The variable representing the contents of the mail
$from - The variable representing who sent the mail
$attachments=array() - Assigns the attachments to an array
$options=array() - Assigns the options to an array

Return

return FALSE - Returns the boolean value FALSE if the $failed variable contains the boolean value of TRUE
return TRUE - Returns the boolean value TRUE if the $failed variable contains the boolean value of FALSE

Description

The variable $smtp will be assigned the results of the CerWorkstationTickets::_buildSmtp method call. Both the CerPop3RawEmail.class.php and theCerProcessEmail.class.php files are included, and the variable $process is assigned the results of the CerProcessEmail function call.

The variable $email is assigned the value of the $smtp variable after it has been converted into a list. If the $email variable is not empty then the variable $pop3email is assigned the results of the CerPop3RawEmail function call passing in the variable $email as the paramater. Then the $result variable will be assigned the return value of the process function of the class referenced by the variable $process after passing it the variable paramteres $pop3email and $options. As long as the variable $result equates to a boolean value of FALSE then the $failed variable will be assigned the return results of the last_error_msg function call of the class referenced by the variable $process, otherwise the $failed variable will be assigned to the boolean value of FALSE.

Name: markSpam - line 1557

Parameters:

$ticket_id - The if of the ticket that will be used

Description

The cer_bayesianAntiSpam.class.php class is included and the $bayes variable will be initialized by calling the cer_bayesianAntiSpam() constructor function. The mark_tickets_as_spam function of the class referenced by the variable $bayes will be called and passed the array of $ticket_id as a parameter.

Name: markHam - line 1563

Parameters:

$ticket_id - The id of the ticket that will be used

Description

The cer_bayesianAntiSpam.class.php class is included and the $bayes variable will be initialized by calling the cer_bayesianAntiSpam() constructor function. The mark_tickets_as_ham function of the class referenced by the variable $bayes will be called and passed the array of $ticket_id as a parameter.

Name: setTicketStatus - line 1576

Parameters:

$ticket_id - The id of the ticket that will be used $status - The status that the tickets represented by the ticket id will be set to

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call, and the variable $sql to a blank string. The CerACL.class.php class is included, and the variable $acl is assigned the return result of the CerACL::getInstance() method call. The table below describes what will be assigned the variable $sql based on the value of $status:

Value of $statusString Assigned to $sqlDescription
opensprintf("UPDATE `ticket` SET `is_deleted` = 0, `is_closed` = 0 WHERE `ticket_id` = %d", $ticket_id)Sets both the is_deleted, and is_closed fields of the ticket table equal to the number zero where the ticket_id field equals the value of the $ticket_id variable.
resolved & closedsprintf("UPDATE `ticket` SET `is_deleted` = 0, `is_closed` = 1 WHERE `ticket_id` = %d", $ticket_id)Sets the is_deleted field equal to the number zero, and the is_closed field of the ticket table equal to the number one where the ticket_id field equals the value of the $ticket_id variable.
deletedsprintf("UPDATE `ticket` SET `is_deleted` = 1, `is_closed` = 1 WHERE `ticket_id` = %d", $ticket_id)If the return value of calling the has_priv method with the parameter string of PRIV_TICKET_DELETE of the class represented by the vasriable $acl is equal to the boolean value FALSE then the is_deleted, and is_closed fields of the ticket table equal to the number number where the ticket_id field equals the value of the $ticket_id variable.

The variable $session will be declared as a global variable and the variable $user_id is assigned the value of user_id property of the login_handler subscript of the vars property of the $session variable, and if the value does not exist no error will be generated. As long as the $user_id variable is not blank the CER_AUDIT_LOG::log_action method will be called using the parameters listed by bullet number seven.

Name: setTicketMailbox - line 1624

Parameters:

$ticket_ids - The array of ticket ids that are passed in
$mailbox - The value that will be used to link to the ticket id's

Return

return true - Returns the boolean value true if the function executed completely return false - Returns the boolean value false if any of the parameters is blank

Description

In the event that the ticket_ids variable is not an array then it will be converted into an array. As long as neither the $ticket_id nor $mailbox variables are empty, and tthe $ticket_ids variable is an array the function continues, otherwise the boolean value false is returned.

A loop will be executed the same numer of times as there are items in the $ticket_ids array, and the variable $i will keep track of the number of the current loop iteration. For each iteration if the value of the $i subscript of the $ticket_ids array is not of the type integer then the number zero will be assigned.

A sql statement will be assigned to the variable and executed to set the ticket_queue_id field of the ticket table with the value of the $mailbox variable where the ticket_id field contains a value in the $ticket_ids variable after it has been converted into a comma deliminated list with each value preceded and succeded with a single quote.

The variable $session will be declared as a global variable and the variable $user_id is assigned the value of user_id property of the login_handler subscript of the vars property of the $session variable, and if the value does not exist no error will be generated. As long as the $user_id variable is not blank then a second sql statement will be assigned to the variable $sql and the variable $queue_record will be assigned the results of selecting the queue_name field from the queue table where the queue_id field equals the value of the $mailbox variable. A loop will be executed the same numer of times as there are items in the $ticket_ids array, and the variable $i will keep track of the number of the current loop iteration. For each iteration the CER_AUDIT_LOG::log_action method will be called using the parameters listed by bullet number eight.

Name: setTicketPriority - line 1660

Parameters:

$ticket_id - The parameter representing the id of the ticket that needs to be updated
$priority - The parameter representing the value that will be inserted into the database

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call, and the variable $sql to a blank string. A sql statement is assigned to the variable $sql and executed to update the ticket_priority field of the ticket table with the value of the $priority variable where the ticket_id field equals the value of the $ticket_id variable.

The variable $session will be declared as a global variable and the variable $user_id is assigned the value of user_id property of the login_handler subscript of the vars property of the $session variable, and if the value does not exist no error will be generated. As long as the $user_id variable is not blank the CER_AUDIT_LOG::log_action method will be called using the parameters listed by bullet number nine.

Name: setTicketWaitingOnCustomer - line 1678

Parameters:

$ticket_id - The id of the ticket that is being searched for
$waiting=0 - Initializes this varibale to the number zero.

Description

Initially initializes the $db variable with the return result of the cer_Database::getInstance() method call, and the variable $sql to a blank string. A sql statement is assigned to the variable $sql and executed to set the is_waiting_on_customer field equal to the value of the $waiting variable in the ticket table where the ticket_id field equals the value of the $ticket_id variable.

Method Details



Description | Variables (details) | Functions (details) | Methods (details) | Required Files
cer_Database::getInstance()
Called on lines 44, 118, 279, 435, 487, 520, 551, 600, 625, 652, 730, 791, 817, 828, 875, 888, 899, 979, 1035, 1064, 1148, 1186, 1213, 1253, 1275, 1291, 1359, 1414, 1578, 1626, 1662, and 1680. Calls the getInstance() function in the cer_Database class to return an instance of the database handler.
CerWorkstationTickets::_addFlagsToTicketHeaders()
Called on lines 94, 318, and 476. Passes the parameter $tickets to the function _addFlagsToTicketHeaders to add the corresponding flags to the parameter $tickets.
CerWorkstationTickets::_addTagsToTicketHeaders()
Called on lines 95, 319, and 477. Passes the parameter $tickets to the function _addTagsToTicketHeaders to add the corresponding tags to the parameter $tickets.
CerWorkstationTickets::_addAgentsToTicketHeaders()
Called on lines 97, 321, and 479. Passes the parameter $tickets to the function _addAgentsToTicketHeaders to add the corresponding agents to the parameter $tickets.
CerWorkstationTickets::addFlagToTicket()
Called on lines 165, 196, and 967. Passes the parameters $agent_id, and $ticket_id to the function addFlagToTicket to add the corresponding flag to the ticket specified by the parameter.
CerWorkstationTickets::getTicketsByIds()
Called on line 786 the getTicketByIds function returns an array of tickets that matches the id passed in by the parameter array($id).
CerWorkstationTickets::removeAgentDelayFromTicket()
Called on line 796 the removeAgentDelayFromTicket function is called and passed the parameters $agent_id, and $ticket_id to remove the delay in each ticket that matches contains the values in the parameters.
CerWorkstationTickets::_cacheTicketFlags()
Called on lines 916 and 996 with the parameter $ticket_id, and on line 1026 with the parameter $tickets_ids[$i]. The _cacheTicketFlags function is called to save a count of how many agents are associated with that ticket.
CerWorkstationTickets::getTicketById()
Called on lines 1151, 1401, and 1426 to pass the getTicketByIdgetTicketById function with the $ticket_id paramaeter to return the ticket that contains that id.
CerWorkstationTickets::send_internal_mail()
Called on line 1355 with the parameters $to, $subject, $body, $from, $attachments, and $options and also called on line 1409 with the parameters $ticket->queue_address, $subject, $body, $from, and $attachments. The method will call the send_internal_mail function to send an e-mail built off of the paramaters to another user of Cerberus.
CerWorkstationTickets::send_outgoing_mail()
Called on line 1390 with the paramaters $from, $subject, $notice.$body, $to, and $attachment, and on line 1434 with the parameters $to, $subject, $body, $ticket->queue_address, and $attachments. The method will call the send_outgoing_mail function to build an email using the specified paramters and send it to a person not using Cerberus.
CerWorkstationTickets::_buildSmtp()
Called on line 1532 by passing the $to, $subject, $body, $from, and $attachment paramaters to the _buildSmtp function to build an email in an SMTP format using the parameters provided.
CER_AUDIT_LOG::print_action()
Called on line 510 with the paramaters $row['action],stripslashes($row['action_value']),stripslashes($row['user']),$row['timestamp'] to have the print_action function of the CER_AUDIT_LOG class to return the value generated by the passed in parameters.
CER_AUDIT_LOG::log_action()
Called on:
  1. Line 810 with the parameters $ticket_id, $user_id, AUDIT_ACTION_DELAY, and the reuturn value of the cer_DateTimeFormate::secsAsEnglishString method call.
  2. Line 883 with the parameters $ticket_id, $session->vars["login_handler"]->user_id, AUDIT_ACTION_ADD_REQUESTER, $requester.
  3. Line 913 with the parameters $ticket_id, $user_id, AUDIT_ACTION_TAKE, "".
  4. Line 993 with the parameters $ticket_id, $user_id, AUDIT_ACTION_RELEASE, "".
  5. Line 1024 with the paramaeters $ticket_ids[$i], $user_id, AUDIT_ACTION_RELEASE, "".
  6. Line 1439 with the parameters $ticket_id, $user_id, AUDIT_ACTION_THREAD_FORWARD, $to.
  7. Line 1611 with the parameters $ticket_id, $user_id, AUDIT_ACTION_CHANGED_STATUS, $status.
  8. Line 1654 with the parameters $ticket_ids[$i], $user_id, AUDIT_ACTION_CHANGED_QUEUE, $queue_row['queue_name'].
  9. Line 1674 with the parameters $ticket_id, $user_id, AUDIT_ACTION_CHANGED_PRIORITY, $priority.
The log_action function of the CER_AUDIT_LOG class is called in each instance with the parameters listed to keep track of the changes made to the ticket.
cer_DateTimeFormat::secsAsEnglishString()
Called on line 810 with the paramater $delay to have the secsAsEnglishString function of the cer_DateTimeFormat class return the value of the parameter properly converted.
CerACL::getInstance()
Called on line 1581 to return an instance of the CerACL class via the getInstance function call.
CerConfiguration::getInstance()
Called on line 1501 to return an instance of the CerConfiguration class via the getInstance function call.
CerNotification::getInstance()
Called on lines 1148, 1187, and 1254 to return an instance of the CerNotification class via the getInstance function call.

Required Files



Description | Variables (details) | Functions (details) | Methods (details) | Required Files
File NameLine Number Called OnLocation
CerACL.class.phpLine 1580cerberus-api/acl/CerACL.class.php
CerNotification.class.phpLine 23cerberus-api/notification/CerNotification.class.php
CerPop3RawEmail.class.phpLine 1534cerberus-api/parser/CerPop3RawEmail.class.php
CerProcessEmail.class.phpLine 1535cerberus-api/parser/CerProcessEmail.class.php
audit_log.phpLine 22cerberus/log/audit_log.php
cer_bayesianAntiSpam.class.phpLines 1558, and 1564cerberus-api/bayesian/cer_BayesianAntiSpam.class.php
cer_Database.class.phpLine 21cerberus-api/database/cer_Database.class.php
cer_DateTimeFormat.class.phpLine 810cerberus-api/utility/datetime/cer_DateTimeFormat.class.php
compatibilityLine 24cerberus-api/compatibility/compatibility.php
email_parser.phpLines 878, and 1327cerberus-api/parser/email_parser.php
mimePart.phpLine 1444cerberus-api/mail.mimePart.php
htmlMimeMail.phpLine 1497cerberus-api/mail/htmMimeMail.php