58
public static function destroyInstances()
60
foreach (self::$instances as $prj_id => $instance) {
61
$instance->destroy($prj_id);
63
self::$instances = array();
67
public static function authenticateCustomer($prj_id = false)
49
abstract public function authenticateCustomer();
74
* If a single customer ID is passed in a single Customer object is returned. If an array
75
* is passed in an array of customer objects are returned.
53
* Returns the customer object for the specified ID
77
* @param integer $customer_id A customer id or array of ids
78
* @return CRM_Customer A customer object or an array of customer objects
55
* @param string $customer_id A customer ID
56
* @return Customer A customer object
80
abstract public function &getCustomer($customer_id);
58
abstract public function getCustomer($customer_id);
174
* Checks whether the given issue ID was marked as a redeemed incident or
177
* @param integer $issue_id The issue ID
178
* @param integer $incident_type The type of incident
181
abstract public function isRedeemedIncident($issue_id, $incident_type);
185
* Returns an array of the curently redeemed incident types for the issue.
188
* @param integer $issue_id The issue ID
189
* @return array An array containing the redeemed incident types
191
abstract public function getRedeemedIncidentDetails($issue_id);
195
* Returns an array of support levels for a specific type
197
* @param string $type The type of level we want to return
200
abstract public function getLevelsByType($type);
204
136
* Returns an associative array of support level IDs => names
206
* @param mixed $type The type of levels to return (optional)
209
abstract public function getSupportLevelAssocList($type = false);
140
abstract public function getSupportLevelAssocList();
213
144
* Returns information on the specified support level
215
* @param integer $level_id The level to return info for.
216
* @return array An array of information about the level
146
* @param string $level_id The level to return info for.
147
* @throws SupportLevelNotFoundException
148
* @return Support_Level
218
abstract public function getSupportLevelDetails($level_id);
150
abstract public function getSupportLevel($level_id);
222
* Returns an array of support levels grouped together.
154
* Returns support levels grouped together
226
158
abstract public function getGroupedSupportLevels();
229
* Retrieves the customer titles associated with the given list of issues.
162
* Retrieves the customer titles and support levels associated with the given list of issues. Should set
163
* the following keys for each row, 'customer_title', 'support_level'
231
165
* @param array $result The list of issues
232
166
* @see Search::getListing()
234
abstract public function getCustomerTitlesByIssues(&$result);
168
abstract public function processListIssuesResult(&$result);
597
* Returns any notes for for the specified customer.
600
* @param integer $customer_id The customer ID
601
* @return array An array containg the note details.
603
public static function getNoteDetailsByCustomer($customer_id)
611
" . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "customer_note
613
cno_customer_id = '" . Misc::escapeString($customer_id) . "'";
614
$res = DB_Helper::getInstance()->getRow($stmt, DB_FETCHMODE_ASSOC);
615
if (PEAR::isError($res)) {
616
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
625
* Returns any note details for for the specified id.
628
* @return array An array containg the note details.
630
public static function getNoteDetailsByID($cno_id)
637
" . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "customer_note
639
cno_id = " . Misc::escapeInteger($cno_id);
640
$res = DB_Helper::getInstance()->getRow($stmt, DB_FETCHMODE_ASSOC);
641
if (PEAR::isError($res)) {
642
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
651
* Returns an array of notes for all customers.
653
* @return array An array of notes.
655
public static function getNoteList()
663
" . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "customer_note
665
cno_customer_id ASC";
666
$res = DB_Helper::getInstance()->getAll($stmt, DB_FETCHMODE_ASSOC);
667
if (PEAR::isError($res)) {
668
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
671
for ($i = 0; $i < count($res); $i++) {
673
$crm = CRM::getInstance($res[$i]['cno_prj_id']);
674
$res[$i]['customer_title'] = $crm->getCustomer($res[$i]['cno_customer_id'])->getName();
675
} catch (Exception $e) {}
685
* @param integer $cno_id The id of this note.
686
* @param integer $prj_id The project ID
687
* @param integer $customer_id The id of the customer.
688
* @param string $note The text of this note.
691
public static function updateNote($cno_id, $prj_id, $customer_id, $note)
694
" . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "customer_note
696
cno_note='" . Misc::escapeString($note) . "',
697
cno_prj_id=" . Misc::escapeInteger($prj_id) . ",
698
cno_customer_id='" . Misc::escapeString($customer_id) . "',
699
cno_updated_date='" . Date_Helper::getCurrentDateGMT() . "'
701
cno_id=" . Misc::escapeInteger($cno_id);
702
$res = DB_Helper::getInstance()->query($stmt);
703
if (PEAR::isError($res)) {
704
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
713
* Adds a quick note for the specified customer.
715
* @param integer $prj_id The project ID
716
* @param integer $customer_id The id of the customer.
717
* @param string $note The note to add.
720
public static function insertNote($prj_id, $customer_id, $note)
723
" . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "customer_note
731
" . Misc::escapeInteger($prj_id) . ",
732
" . Misc::escapeInteger($customer_id) . ",
733
'" . Date_Helper::getCurrentDateGMT() . "',
734
'" . Date_Helper::getCurrentDateGMT() . "',
735
'" . Misc::escapeString($note) . "'
737
$res = DB_Helper::getInstance()->query($stmt);
738
if (PEAR::isError($res)) {
739
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
748
* Removes the selected notes from the database.
750
* @param array $ids An array of cno_id's to be deleted.
753
public static function removeNotes($ids)
756
" . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "customer_note
758
cno_id IN (" . join(", ", Misc::escapeInteger($ids)) . ")";
759
$res = DB_Helper::getInstance()->query($stmt);
760
if (PEAR::isError($res)) {
761
Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
678
769
public function getConnection()
699
784
abstract public function getExpirationOffset();
787
abstract public function getTemplatePath();
789
abstract public function getHtdocsPath();
702
792
public function __toString()
704
794
return "CRM Instance\nProject ID: " . $this->prj_id . "\nClass Name: " . get_class($this);
799
* Helper function to return customer name.
800
* @param integer $prj_id
801
* @param string $customer_id
804
public static function getCustomerName($prj_id, $customer_id)
807
$crm = self::getInstance($prj_id);
808
$customer = $crm->getCustomer($customer_id);
809
return $customer->getName();
810
} catch (CRMException $e) {
817
class CRMException extends Exception
b'\\ No newline at end of file'