/** * Add additional fields which are unable to be added by the standard input widget to the Incident * @param RNCPHP\Incident $incident RightNow Incident object */ private function addAdditionalFieldsToIncident(RNCPHP\Incident $incident) { // set the 'ebs_sr_owner_id' $incident->CustomFields->Accelerator->ebs_sr_owner_id = $this->CI->model('custom/ExtIntegrationConfigVerb')->getEbsDefaultSROwnerID(); $incident->save(RNCPHP\RNObject::SuppressAll); }
/** * Compose the Serial Number and Product validation result. * Operations contains: * 1. log the validation result * 2. save the result in the custom attribute 'cp_ebs_product_validation' if needed * 3. return the result containing isValid, meesage and item object * @param boolean $isValid Indicate if the validation is correct * @param string $message Validation result message * @param array $ebsItem Item of the provided Serial Number * @param RNCPHP\Incident $incident Related incident object * @param boolean $ifNeedToSaveInIncident Indicate if the checking result need to be saved in the incident * @param boolean $isError If the response is an error. for example, "Serial Number not found" is invalid, but not an error * @return array Validation result contains status, response, and item */ private function composeSerialNumberValidationResult($isValid, $message, array $ebsItem = null, RNCPHP\Incident $incident = null, $ifNeedToSaveInIncident = false, $isError = false) { if ($isError) { $this->log->error("Serial Number validation :: {$message}", __METHOD__, array($incident, $this->contact)); } else { if (!$isError && !$isValid) { $this->log->notice("Serial Number validation :: {$message}", __METHOD__, array($incident, $this->contact)); } else { $this->log->debug("Serial Number validation :: {$message}", __METHOD__, array($incident, $this->contact)); } } // save the validation result to incident if needed if ($incident !== null && $ifNeedToSaveInIncident === true) { $incident->CustomFields->Accelerator->cp_ebs_product_validation = $message; $incident->save(RNCPHP\RNObject::SuppressAll); } $result = (object) array('isValid' => $isValid, 'message' => $message, 'ebsItem' => $ebsItem, 'isError' => $isError); return $this->getResponseObject($result); }