/** * GetData function of the widget * @return null */ function getData() { // get srID if (!($srID = intval(URL::getParameter('sr_id')))) { $incidentID = URL::getParameter('i_id'); if (!($incidentID = intval(URL::getParameter('i_id')))) { echo $this->reportError('Invalid i_id'); return; } $incident = RNCPHP\Incident::fetch(intval($incidentID)); if (!is_null($incident)) { $srID = $incident->CustomFields->Accelerator->ebs_sr_id; } } // render data to javascript $this->data['js']['sr_id'] = $srID; $this->data['js']['ext_server_type'] = $this->extServerType; $this->data['js']['development_mode'] = IS_DEVELOPMENT; }
/** * PostIncidentCreateHook for Siebel handles two differenct cases based on if the sr_id is empty * 1. if sr_id is empty, the hook is for incident created through the 'Ask a New Question' page * 2. otherwise, the hoos is incident created based on a legacy SR * @param array &$hookData HookData */ function postIncidentCreateHook(array &$hookData) { $incidentID = $hookData['data']->ID; if (!($incident = RNCPHP\Incident::fetch(intval($incidentID)))) { $this->log->error("Unable to get Incident#{$incidentID}", __METHOD__, array(null, $this->contact)); } else { $this->log->debug("Incident #{$incidentID} has been created in CP", __METHOD__, array($incident, $this->contact)); } // check if the incident has been associated with a SR if ($srID = $incident->CustomFields->Accelerator->siebel_sr_id) { $this->createIncidentToLinkWithSR($srID, $incident); } else { $this->createSRFromCPToLinkWithIncident($incident); } }
/** * PostIncidentCreateHook for EBS handles two differenct cases based on if the sr_id is empty * 1. if sr_id is empty, the hook function is for Incident created through the 'Ask a New Question' page * 2. otherwise, the hook function is for Incident created based on a legacy SR * @param array &$hookData HookData which contains the incident */ function postIncidentCreateHook(array &$hookData) { // fetch incident by ID $incidentID = $hookData['data']->ID; if (!($incident = RNCPHP\Incident::fetch(intval($incidentID)))) { $this->log->error("Unable to get Incident#{$incidentID}", __METHOD__, array(null, $this->contact)); } else { $this->log->debug("Incident#{$incidentID} has been created in CP", __METHOD__, array($incident, $this->contact)); } // add additinal field to the newly created incident $this->addAdditionalFieldsToIncident($incident); // talk with EBS server if (!($srID = $incident->CustomFields->Accelerator->ebs_sr_id)) { $this->createSRToLinkWithIncident($incident); } else { $this->createNoteAndUpdateSR($srID, $incident); } }