Location: /cerberus-api/workstation/CerWorkstationTickets.class.php This function |
Name: CerWorkstationTickets - line 39DescriptionAn empty function |
Name: getTicketsByIds - line 42Parameters:$ids$with_content=true $preserve_order=false Returnreturn $tickets - The tickets that are generated from the execution of the functionDescriptionInitially 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:
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 116Parameters:$teams$agent_id $limit=5 Returnreturn FALSE - Returns the boolean value FALSE if any of the parameters are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitializes 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 277Parameters:$agent_id - The Id of the agent that is neededReturnreturn $tickets - The tickets that are generated from the execution of the functionDescriptionA 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:
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: getSuggestedTicketsParameters:$agent_id - The Id of the agent that is neededReturnreturn $tickets - The tickets that are generated from the execution of the functionDescriptionA 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:
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 485Parameters:$user_id - Id of the user needed$epoch=0 - Initializes the variable to zero Returnreturn $tickets - Returns the array of tickets that was generatedDescriptionInitially 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:
|
Name: _addTagsToTicketHeaders - line 518Parameters:&$tickets - A reference to the tickets the function needsReturnreturn FALSE - Returns the boolean value FALSE if the parameter are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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 549Parameters:&$tickets - A reference to the tickets the function needsReturnreturn FALSE - Returns the boolean value FALSE if the parameter are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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 598Parameters:&$tickets - A reference to the tickets the function needsReturnreturn FALSE - Returns the boolean value FALSE if the parameter are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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 623Parameters:&$tickets - A reference to the tickets the function needsReturnreturn FALSE - Returns the boolean value FALSE if the parameter are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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 - line650Parameters:$ticket_id - The id of the ticket that was selected$thread_id=null - Initializes the variable to a null value Returnreturn 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 functionDescriptionInitially 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:
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 728Parameters:$thread_id - Id of the thread that needs its text retrievedReturnreturn $preview - Returns the class it represents with the values set by the functionDescriptionInitially 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 785Parameters:$id - The id that is used to retrieve the ticketReturnreturn @$tickets[$id] - Returns the tickets that contain the id specified, and if an error is generated it will be ignored.DescriptionAssigns the $tickets variable the return results of the CerWorkstationTickets::getTicketsByIds method call. |
Name: addAgentDelayToTicket - line 790Parameters:$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 Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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 816Parameters:$agent_id - Id of the agent that is needed$ticket_id - The id of the ticket that is needed Returnreturn TRUE - Returns the boolean value of TRUEDescriptionInitially 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 828Parameters:$ticket_id - Id of the ticket that is neededDescriptionInitially 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 874Parameters:$requester - The value of who is requesting the ticket$ticket_id - Id of the ticket that needs to be modified DescriptionThe 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 887Parameters:$requester_id - Id of the requester linked to the ticket$ticket_id - Id of the ticket that needs to be modified DescriptionInitially 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 898Parameters:$agent_id - Id of the agent who set the flag$ticket_id - Id of the ticket that has the flag set Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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 929Parameters:$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 Returnreturn $flagged_by_others_only - Returns an array of tickets that are not associated with agents id represented by the variable $agent_idDescriptionAssigns 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:
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 977Parameters:$ticket_id - The id of the ticket that needs to be modified$agent_id - Id of the agent that is neededd Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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 1001Parameters:$ticket_ids - The ids of the tickets that will be modified$agent_id - The id of the agent that will be used Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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:
|
Name: changeTicketTags - line 1033Parameters:$ticket_id - The id of the tag that is needed$tags - The tags that need to be modified Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyDescriptionInitially 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 1061Parameters:$tag_id - The id of the tag that is needed$ticket_ids - The ids of the tags that needs to be modified Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyDescriptionInitially 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 1146Parameters:$ticket_id - The id of the ticket needed$agents - The agents that will be modified Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyDescriptionInitially 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 1184Parameters:$agent_id - The id of the agent that needs to be modified$ticket_ids - The array of ticket ids that will be used Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyDescriptionInitially 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 1211Parameters:$tags - The array of tages that will be modified$ticket_id - The id of the ticket that will be used Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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 1251Parameters:$agents - The array of agents to be modified$ticket_id - The id of the ticket that is needed Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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 1273Parameters:$tags - The array of tags that needs to be modified$ticket_id - The id of the ticket that is needed Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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 1289Parameters:$agents - The array of agents that need to be modified$ticket_id - The id of the ticket that is needed Returnreturn FALSE - Returns the boolean value FALSE if either of the parameters are emptyreturn TRUE - Return the boolean value TRUE if the function executes correctly. DescriptionInitially 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 1323Parameters:$ticket - The ticket neededDescriptionIncludes 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 1354Parameters:$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 Returnreturn $id - Id of the created ticket if it was succesfulreturn FALSE - Returns the boolean value of FALSE if the function failed DescriptionThe 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 1400Parameters:$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 Returnreturn FALSE - returns the boolean value FALSE if the variable $ticket is emptyDescriptionThe $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 1412Parameters:$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 DescriptionInitially 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 1425Parameters:$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 Returnreturn FALSE - Returns the boolean value false if the $ticket variable is emptyDescriptionThe $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 1443Parameters:$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 Returnreturn $smtp - Returns the email that was generatedDescriptionThe 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:
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 1496Parameters:$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 DescriptionThe 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:
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 1531Parameters:$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 Returnreturn FALSE - Returns the boolean value FALSE if the $failed variable contains the boolean value of TRUEreturn TRUE - Returns the boolean value TRUE if the $failed variable contains the boolean value of FALSE DescriptionThe 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 1557Parameters:$ticket_id - The if of the ticket that will be usedDescriptionThe 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 1563Parameters:$ticket_id - The id of the ticket that will be usedDescriptionThe 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 1576Parameters:$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 toDescriptionInitially 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:
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 1624Parameters:$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 Returnreturn true - Returns the boolean value true if the function executed completely return false - Returns the boolean value false if any of the parameters is blankDescriptionIn 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 1660Parameters:$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 DescriptionInitially 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 1678Parameters:$ticket_id - The id of the ticket that is being searched for$waiting=0 - Initializes this varibale to the number zero. DescriptionInitially 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. |
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: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. |
File Name | Line Number Called On | Location |
CerACL.class.php | Line 1580 | cerberus-api/acl/CerACL.class.php |
CerNotification.class.php | Line 23 | cerberus-api/notification/CerNotification.class.php |
CerPop3RawEmail.class.php | Line 1534 | cerberus-api/parser/CerPop3RawEmail.class.php |
CerProcessEmail.class.php | Line 1535 | cerberus-api/parser/CerProcessEmail.class.php |
audit_log.php | Line 22 | cerberus/log/audit_log.php |
cer_bayesianAntiSpam.class.php | Lines 1558, and 1564 | cerberus-api/bayesian/cer_BayesianAntiSpam.class.php |
cer_Database.class.php | Line 21 | cerberus-api/database/cer_Database.class.php |
cer_DateTimeFormat.class.php | Line 810 | cerberus-api/utility/datetime/cer_DateTimeFormat.class.php |
compatibility | Line 24 | cerberus-api/compatibility/compatibility.php |
email_parser.php | Lines 878, and 1327 | cerberus-api/parser/email_parser.php |
mimePart.php | Line 1444 | cerberus-api/mail.mimePart.php |
htmlMimeMail.php | Line 1497 | cerberus-api/mail/htmMimeMail.php |