/**
  * 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();
 }
 /**
  * Get the endpoint, username and password of the current site from custom 
  * Config Verb CUSTOM_CFG_EBS_Web_Service_Endpoint.
  * @return null
  */
 function checkExtIntegrationConfigVerb()
 {
     $url = $_SERVER['REQUEST_URI'];
     if (Text::beginsWith($url, '/app/error/')) {
         return;
     }
     // check if CUSTOM_CFG_EBS_Web_Service_Endpoint is defined in the current site
     if (IS_DEVELOPMENT === true && !defined('CUSTOM_CFG_Accel_Ext_Integrations')) {
         $this->log->error('CUSTOM_CFG_' . 'Accel_Ext_Integrations is not set', __METHOD__, array(null, $this->contact));
         Url::redirectToErrorPage(13);
     }
     // get the value of config verb CUSTOM_CFG_Accel_Ext_Integrations
     $config = RNCPHP\Configuration::fetch(CUSTOM_CFG_Accel_Ext_Integrations);
     $configVerb = json_decode($config->Value, true);
     if (is_null($configVerb)) {
         $this->log->error('Unable to get the value of CUSTOM_CFG_' . 'Accel_Ext_Integrations', __METHOD__, array(null, $this->contact), $config);
         Url::redirectToErrorPage(13);
     }
     // check if current site is defined in the config rnt_host
     $server = \RightNow\Utils\Config::getConfig(OE_WEB_SERVER);
     $hosts = $configVerb['hosts'];
     if (is_null($hosts)) {
         $this->log->error('Unable to find hosts inside CUSTOM_CFG_' . 'Accel_Ext_Integrations', __METHOD__, array(null, $this->contact), var_export($configVerb, true));
         Url::redirectToErrorPage(8);
     }
     foreach ($hosts as $host) {
         if ($server === $host['rnt_host']) {
             $this->extConfigVerb = $host;
             $this->extServerType = $host['integration']['server_type'];
             $this->rntHost = $host['rnt_host'];
             $this->ebsDefaultSROwnerID = $host['integration']['ebs_default_sr_owner_id'];
             return;
         }
     }
     // if no config verb match the current host
     $this->log->error("CUSTOM_CFG_Accel_Ext_Integrations :: host name isn't included in hosts", __METHOD__, array(null, $this->contact));
     Url::redirectToErrorPage(8);
 }
Exemplo n.º 3
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));
     }
 }
Exemplo n.º 4
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;
Exemplo n.º 5
0
    </div>
</div>
<script type="text/javascript">
    var tags = document.getElementsByTagName('a');
    for (var i=0; i<tags.length; i++)
    {
        var hashLocation = tags[i].href.split("#");
        //Fix anchor links (i.e. href="#Bottom") because of the base tag. Also don't change their target
        if(hashLocation[1] !== undefined && hashLocation[0] === "<?php 
echo \RightNow\Utils\Url::getShortEufBaseUrl(false, '/');
?>
"){
            tags[i].href = "about:blank#" + hashLocation[1];
        }
        else{
            tags[i].target = "_blank";
        }
    }

    tags = document.getElementsByTagName('form');
    for (var i=0; i<tags.length; i++)
    {
        tags[i].onsubmit = function(){alert("<?php 
echo \RightNow\Utils\Config::getMessageJS(DISABLED_FOR_PREVIEW_MSG);
?>
"); return false;};
    }
</script>
</body>
</html>
 /**
  * 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();
 }
Exemplo n.º 7
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>
Exemplo 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>
Exemplo 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>
Exemplo 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);
 }