/**
  * Create new Incident in CP using the Service Request data
  * @return null
  */
 private function createIncidentBasedOnSRForSiebel()
 {
     \RightNow\Libraries\AbuseDetection::check($this->input->post('f_tok'));
     $data = json_decode($this->input->post('form'));
     if (!$data) {
         header("HTTP/1.1 400 Bad Request");
         // Pad the error message with spaces so IE will actually display it instead of a misleading, but pretty, error message.
         \RightNow\Utils\Framework::writeContentWithLengthAndExit(json_encode(\RightNow\Utils\Config::getMessage(END_REQS_BODY_REQUESTS_FORMATTED_MSG)) . str_repeat("\n", 512));
     }
     // get srID from hidden Incident CustomField siebel_sr_id
     $srID = null;
     foreach ($data as $field) {
         if ($field->name === 'Incident.CustomFields.Accelerator.siebel_sr_id') {
             $srID = $field->value;
             break;
         }
     }
     if ($srID === null) {
         $this->log->error('srID is NULL', __METHOD__, array(null, $this->contact));
         return;
     }
     // get SR from session by srID
     $sessionKey = 'sr_' . $srID;
     $srDetail = $this->session->getSessionData($sessionKey);
     if (!$srDetail) {
         $getSRResult = $this->model('custom/SiebelServiceRequest')->getSRDetailByID($srID);
         $srDetail = $getSRResult->result;
     }
     // set extra Incident fields used the value of SR
     $data[] = (object) array('name' => 'Incident.Subject', 'value' => $srDetail['ABSTRACT']);
     $data[] = (object) array('name' => 'Incident.CustomFields.Accelerator.siebel_sr_num', 'value' => $srDetail['SRNUMBER']);
     $data[] = (object) array('name' => 'Incident.CustomFields.Accelerator.siebel_serial_number', 'value' => $srDetail['SERIALNUMBER']);
     if ($srDetail['PRODUCTID']) {
         if ($rnProduct = $this->utility->getProductByPartNumber($srDetail['PRODUCTID'])) {
             $data[] = (object) array('name' => 'Incident.Product', 'value' => $rnProduct['ID']);
         } else {
             $data[] = (object) array('name' => 'Incident.CustomFields.Accelerator.cp_siebel_product_validation', 'value' => "Service Request Product '{$srDetail['PRODUCT']}' can't be found in RightNow");
         }
     }
     // create the Incident by calling the sendFrom function in CP core
     $incidentID = $this->input->post('i_id');
     $smartAssistant = $this->input->post('smrt_asst');
     echo $this->model('Field')->sendForm($data, intval($incidentID), $smartAssistant === 'true')->toJson();
 }
Ejemplo n.º 2
0
 private function verifyFormToken($tokenName = 'f_tok', $tokenSeed = 0)
 {
     if (!Framework::isValidSecurityToken($this->CI->input->post($tokenName), $tokenSeed)) {
         return $this->getResponseObject(array('redirectOverride' => '/app/error/error_id/5', 'sessionParam' => \RightNow\Utils\Url::sessionParameter()), 'is_array', Config::getMessage(FORM_SUBMISSION_TOKEN_MATCH_EXP_LBL));
     }
 }
Ejemplo n.º 3
0
            ?>
_<?php 
            echo $this->data['js']['name'];
            ?>
_LabelValidate" class="rn_Label"><?php 
            printf($this->data['attrs']['label_validation'], $this->data['attrs']['label_input']);
            ?>
                <?php 
            if ($this->data['attrs']['required']) {
                ?>
                    <rn:block id="preValidateRequired"/>
                    <span class="rn_Required"><?php 
                echo \RightNow\Utils\Config::getMessage(1908);
                ?>
</span><span class="rn_ScreenReaderOnly"> <?php 
                echo \RightNow\Utils\Config::getMessage(7015);
                ?>
</span>
                    <rn:block id="postValidateRequired"/>
                <?php 
            }
            ?>
                </label>
                <rn:block id="postValidateLabel"/>
            </div>
            <rn:block id="preValidateInput"/>
            <input type="<?php 
            echo $this->data['inputType'];
            ?>
" id="rn_<?php 
            echo $this->instanceID;
Ejemplo n.º 4
0
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <base href="<?php 
echo \RightNow\Utils\Url::getShortEufBaseUrl(false, '/');
?>
" />
    <title><?php 
echo \RightNow\Utils\Config::getMessage(ANSWER_QUICK_PREVIEW_LBL);
?>
</title>
    <link href="/euf/assets/themes/standard/site.css" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
<div id="rn_Container">
    <div id="rn_Header"></div>
    <div id="rn_Navigation"></div>
    <div id="rn_Body">
      <div id="rn_MainColumn">
        <div id="rn_PageTitle" class="rn_AnswerDetail">
            <h1 id="rn_Summary"><?php 
echo $summary;
?>
</h1>
            <div id="rn_AnswerInfo"></div>
            <?php 
echo $description;
?>
        </div>
        <div id="rn_PageContent" class="rn_AnswerDetail">
 /**
  * Handle the request to create a new Incident in CP using SR data
  * @return null
  */
 private function sendFormToCreateIncidentToLinkWithSRForEbs()
 {
     \RightNow\Libraries\AbuseDetection::check($this->input->post('f_tok'));
     $data = json_decode($this->input->post('form'));
     if (!$data) {
         header('HTTP/1.1 400 Bad Request');
         // Pad the error message with spaces so IE will actually display it instead of a misleading, but pretty, error message.
         \RightNow\Utils\Framework::writeContentWithLengthAndExit(json_encode(\RightNow\Utils\Config::getMessage(END_REQS_BODY_REQUESTS_FORMATTED_MSG)) . str_repeat('\\n', 512));
     }
     // get srID from the hidden Incident Custom Field 'ebs_sr_id'
     $srID = null;
     foreach ($data as $field) {
         if ($field->name === 'Incident.CustomFields.Accelerator.ebs_sr_id') {
             $srID = $field->value;
             break;
         }
     }
     if ($srID === null) {
         $this->log->error('ebs_sr_id is null', __METHOD__, array(null, $this->contact));
         return;
     }
     // get SR from session by srID
     $sessionKey = 'sr_' . $srID;
     $srDetail = $this->session->getSessionData($sessionKey);
     if (!$srDetail) {
         $getSRResult = $this->model('custom/EbsServiceRequest')->getSRDetailByID($srID);
         if ($getSRResult->error) {
             $this->log->error("Unable to get SR#{$srID}", __METHOD__, array(null, $this->contact));
             return null;
         }
         $srDetail = $getSRResult->result;
     }
     // set extra Incident fields used the value from SR
     $data[] = (object) array('name' => 'Incident.Subject', 'value' => $srDetail['SUMMARY']);
     $data[] = (object) array('name' => 'Incident.CustomFields.Accelerator.ebs_sr_num', 'value' => $srDetail['INCIDENT_NUMBER']);
     $data[] = (object) array('name' => 'Incident.CustomFields.Accelerator.ebs_serial_number', 'value' => $srDetail['SERIAL_NUMBER']);
     $data[] = (object) array('name' => 'Incident.CustomFields.Accelerator.ebs_sr_owner_id', 'value' => $srDetail['SR_OWNER_ID']);
     if ($srDetail['PRODUCT']) {
         if ($rnProduct = $this->utility->getProductByPartNumber($srDetail['PRODUCT'])) {
             $data[] = (object) array('name' => 'Incident.Product', 'value' => $rnProduct['ID']);
         } else {
             $data[] = (object) array('name' => 'Incident.CustomFields.Accelerator.cp_ebs_product_validation', 'value' => "Service Request Product '{$srDetail['PRODUCT']}' can't be found in RightNow");
         }
     }
     // add SR request type
     $srTypeMapping = $this->model('custom/ExtIntegrationConfigVerb')->getExtRequestTypeMapping();
     if ($srTypeMapping === null) {
         $this->log->error('Unable to get request type mapping from Config Verb', __METHOD__, array(null, $this->contact));
         return;
     }
     $srRequestType = $srDetail['INCIDENT_TYPE_ID'];
     foreach ($srTypeMapping as $type) {
         if (intval($type['sr_type_id']) === intval($srRequestType)) {
             $data[] = (object) array('name' => 'Incident.CustomFields.Accelerator.ebs_sr_request_type', 'value' => $type['inc_type_id']);
             break;
         }
     }
     // create the Incident in RNW
     $incidentID = $this->input->post('i_id');
     $smartAssistant = $this->input->post('smrt_asst');
     echo $this->model('Field')->sendForm($data, intval($incidentID), $smartAssistant === 'true')->toJson();
 }
Ejemplo n.º 6
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html>
<head>
<title><?php 
echo \RightNow\Utils\Config::getMessage(POLLING_SURVEY_PREVIEW_LBL);
?>
</title>
<link rel="stylesheet" type="text/css" href="<?php 
echo \RightNow\Utils\Url::getYUICodePath('panel/assets/skins/sam/panel.css');
?>
" />
</head>
<body class="yui-skin-sam yui3-skin-sam">
<br />
<!-- survey_id is a fake number, the controller will grab the real survey_id from $_REQUEST -->
<rn:widget path="surveys/Polling" admin_console="true" survey_id="1234567"/>
</body>
</html>
Ejemplo n.º 7
0
echo $answer->Question;
?>
        </div>
        <div id="rn_PageContent" class="rn_AnswerDetail">
            <div id="rn_AnswerText">
                <p><?php 
echo $answer->Solution;
?>
</p>
            </div>
            <div id="rn_FileAttach" class="rn_FileListDisplay">
                <?php 
if (count($answer->FileAttachments) > 0) {
    ?>
                    <span class="rn_DataLabel"> <?php 
    echo \RightNow\Utils\Config::getMessage(FILE_ATTACHMENTS_LBL);
    ?>
 </span>
                    <div class="rn_DataValue rn_FileList">
                        <ul>
                            <?php 
    foreach ($answer->FileAttachments as $attachment) {
        ?>
                            <li>
                                <a href="<?php 
        echo $attachment->URL . '/' . $attachment->CreatedTime . \RightNow\Utils\Url::sessionParameter();
        ?>
" target="_blank">
                                    <?php 
        echo \RightNow\Utils\Framework::getIcon($attachment->FileName);
        ?>
Ejemplo n.º 8
0
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4><?php 
echo ($CI = get_instance()) && $CI->rnow && is_int(A_PHP_ERROR_WAS_ENCOUNTERED_LBL) ? \RightNow\Utils\Config::getMessage(A_PHP_ERROR_WAS_ENCOUNTERED_LBL) : 'A PHP Error was encountered';
?>
</h4>

<p>Severity: <?php 
echo $severity;
?>
</p>
<p>Message:  <?php 
echo $message;
?>
</p>
<p>Filename: <?php 
echo $filepath;
?>
</p>
<p>Line Number: <?php 
echo $line;
?>
</p>

</div>
Ejemplo n.º 9
0
<html>
<head>
<title><?php 
echo function_exists('getMessage') ? \RightNow\Utils\Config::getMessage(ERROR_LBL) : 'Error';
?>
</title>
<style type="text/css">

body {
background-color:    #fff;
margin:                40px;
font-family:        Lucida Grande, Verdana, Sans-serif;
font-size:            .75em;
color:                #000;
}

#content  {
border:                #999 1px solid;
background-color:    #fff;
padding:            20px 20px 12px 20px;
}

h1 {
font-weight:        normal;
font-size:            .875em;
color:                #990000;
margin:             0 0 4px 0;
}
</style>
</head>
<body>
Ejemplo n.º 10
0
 public function create($productID, array $formData, $serialNumber)
 {
     if (!Framework::isValidID($productID)) {
         return $this->getResponseObject(null, null, Config::getMessage(INVALID_ID_SALES_PRODUCT_COLON_LBL));
     }
     //$resultSet = Connect\ROQL::queryObject(sprintf("SELECT SalesProduct FROM SalesProduct WHERE ID = %d And Disabled != 1 And Attributes.IsServiceProduct = 1 And Attributes.HasSerialNumber != 1 And AdminVisibleInterfaces.ID = curInterface()", $productID))->next();
     $resultSet = Connect\ROQL::queryObject(sprintf("SELECT SalesProduct FROM SalesProduct WHERE ID = %d And Disabled != 1 And Attributes.IsServiceProduct = 1 And AdminVisibleInterfaces.ID = curInterface()", $productID))->next();
     if (!($salesProduct = $resultSet->next())) {
         return $this->getResponseObject(null, null, Config::getMessage(INVALID_ID_SALES_PRODUCT_COLON_LBL));
     }
     $asset = $this->getBlank()->result;
     if ($contact = $this->getContact()) {
         $asset->Contact = $contact->ID;
     } else {
         return $this->getResponseObject(null, null, Config::getMessage(CONTACT_IS_NOT_LOGGED_IN_MSG));
     }
     if ($asset->Contact->Organization) {
         $asset->Organization = $asset->Contact->Organization->ID;
     }
     $errors = $warnings = array();
     foreach ($formData as $name => $field) {
         if (!\RightNow\Utils\Text::beginsWith($name, 'Asset')) {
             continue;
         }
         $fieldName = explode('.', $name);
         try {
             //Get the metadata about the field we're trying to set. In order to do that we have to
             //populate some of the sub-objects on the record. We don't want to touch the existing
             //record at all, so instead we'll just pass in a dummy instance.
             list(, $fieldMetaData) = ConnectUtil::getObjectField($fieldName, $this->getBlank()->result);
         } catch (\Exception $e) {
             $warnings[] = $e->getMessage();
             continue;
         }
         if (\RightNow\Utils\Validation::validate($field, $name, $fieldMetaData, $errors)) {
             $field->value = ConnectUtil::castValue($field->value, $fieldMetaData);
             if ($setFieldError = $this->setFieldValue($asset, $name, $field->value)) {
                 $errors[] = $setFieldError;
             }
         }
     }
     if ($productID !== null && ($setFieldError = $this->setFieldValue($asset, "Asset.Product", $productID))) {
         $errors[] = $setFieldError;
     }
     if ($serialNumber !== null && ($setFieldError = $this->setFieldValue($asset, "Asset.SerialNumber", $serialNumber))) {
         $errors[] = $setFieldError;
     }
     if ($errors) {
         return $this->getResponseObject(null, null, $errors);
     }
     try {
         $asset = parent::createObject($asset, SRC2_EU_ASSET);
     } catch (\Exception $e) {
         $asset = $e->getMessage();
     }
     if (!is_object($asset)) {
         return $this->getResponseObject(null, null, $asset);
     }
     return $this->getResponseObject($asset, 'is_object', null, $warnings);
 }