/** * @param $key * @param $value * @param $context \Workflow\VTEntity * @return array|void */ public function generateAttachments($key, $value, $context) { global $current_user; $adb = \PearDatabase::getInstance(); $url = $value[2]['val']; $url = \Workflow\VTTemplate::parse($url, $context); $filename = \Workflow\VTTemplate::parse($value[2]['name'], $context); if (empty($filename)) { $filename = basename($url); } $filecontent = \Workflow\VtUtils::getContentFromUrl($url); if (empty($filecontent)) { return array(); } $filename = preg_replace('/[^A-Za-z0-9-_.]/', '_', $filename); if ($this->_mode === self::MODE_NOT_ADD_NEW_ATTACHMENTS) { $tmpfile = tempnam(sys_get_temp_dir(), 'Url'); @unlink($tmpfile); file_put_contents($tmpfile, $filecontent); $this->addAttachmentRecord('PATH', $tmpfile, $filename); return; } $upload_file_path = decideFilePath(); $next_id = $adb->getUniqueID("vtiger_crmentity"); file_put_contents($upload_file_path . $next_id . "_" . $filename, $filecontent); $filesize = filesize($upload_file_path . $next_id . "_" . $filename); $filetype = "application/octet-stream"; $sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(?, ?, ?, ?, ?, ?, ?)"; $params1 = array($next_id, $current_user->id, $current_user->id, "Documents Attachment", 'Documents Attachment', date("Y-m-d H:i:s"), date("Y-m-d H:i:s")); $adb->pquery($sql1, $params1); $sql2 = "insert into vtiger_attachments(attachmentsid, name, description, type, path) values(?, ?, ?, ?, ?)"; $params2 = array($next_id, $filename, '', $filetype, $upload_file_path); $adb->pquery($sql2, $params2); $this->addAttachmentRecord('ID', $next_id); }
/** * @param $key * @param $value * @param $context \Workflow\VTEntity * @return array|void */ public function generateAttachments($key, $value, $context) { $adb = \PearDatabase::getInstance(); // If added current Document, get the ID from Context if ($key == "current_document") { $key = $context->getId(); } $parts = explode('#', $key); if ($parts[0] == 'all_childs') { $crmid = \Workflow\VTTemplate::parse($value[2]['val'], $context); if (empty($crmid)) { return array(); } if ($crmid == $context->getId()) { $this->getAllChildAttachmentIds($context); return; } else { $this->getAllChildAttachmentIds(\Workflow\VTEntity::getForId($crmid)); return; } } $sql = 'SELECT attachmentsid FROM vtiger_seattachmentsrel WHERE crmid = ?'; $result = $adb->pquery($sql, array(intval($key))); $attachmentID = $adb->query_result($result, 0, "attachmentsid"); $this->addAttachmentRecord('ID', $attachmentID); }
public function renderFrontend($data, $context) { if (!empty($data['config']['default'])) { $data['config']['default'] = \Workflow\VTTemplate::parse($data['config']['default'], $context); } $html = ''; $script = ''; switch ($data['type']) { case 'file': $field = '<input type="file" id="reqfield_' . $data['name'] . '" data-filestoreid="' . $data['config']['default'] . '" style="width:400px;" name="' . $data['name'] . '" value="' . $data['config']["default"] . '">'; break; case 'checkbox': $field = '<input type="checkbox" name="' . $data['name'] . '" ' . ($data["config"]["default"] == 'On' ? "checked='checked'" : "") . ' value="on">'; break; case 'textarea': $field = '<textarea id="reqfield_' . $data['name'] . '" style="width:400px;height:100px;" name="' . $data['name'] . '">' . $data['config']["default"] . '</textarea>'; break; case 'picklist': $options = explode("\n", $data['config']['default']); $field = '<select style="width:410px;" name="' . $data['name'] . '" class="select2">'; foreach ($options as $option) { $option = trim($option); if (strpos($option, '#~#') !== false) { $parts = explode('#~#', $option); $fieldValue = $parts[1]; $fieldLabel = $parts[0]; } else { $fieldValue = $option; $fieldLabel = $option; } $field .= '<option value="' . $fieldValue . '">' . $fieldLabel . '</option>'; } $field .= '</select>'; break; case 'date': $current_user = \Users_Record_Model::getCurrentUserModel(); $field = '<div class="input-append pull-right" style="width:410px;">'; if (!empty($data['config']["default"])) { $preset = \DateTimeField::convertToUserFormat($data['config']["default"]); } else { $preset = ''; } $field .= '<input type="text" class="dateField span2" data-date-format="' . $current_user->date_format . '"id="reqfield_' . $data['name'] . '"name="' . $data['name'] . '" value="' . $preset . '">'; $field .= '<span class="add-on"><i class="icon-calendar"></i></span>'; $field .= '</div>'; break; case 'text': default: $field = '<input type="text" id="reqfield_' . $data['name'] . '" style="width:400px;" name="' . $data['name'] . '" value="' . $data['config']["default"] . '">'; break; } $html = "<label><div style='min-height:26px;padding:2px 0;'><div style=''><strong>" . $data['label'] . "</strong></div><div style='text-align:right;'>" . $field . "</div></div></label>"; return array('html' => $html, 'javascript' => $script); }
/** * @param array $configuration - Array with all configuration options, the user configure * @param string $filepath - The temporarily filepath of the file, which should be transformed * @param string $filename - The filename of this file * @param \Workflow\VTEntity $context - The Context of the Workflow * @param array $targetRecordIds * @return void */ public function doAction($configuration, $filepath, $filename, $context, $targetRecordIds = array()) { $adb = \PearDatabase::getInstance(); $overwrite_filename = $configuration['filename']; if (!empty($overwrite_filename)) { $filenamedata = pathinfo($filename); $overwrite_filename = str_replace('$extension', $filenamedata['extension'], $overwrite_filename); $filename = \Workflow\VTTemplate::parse($overwrite_filename, $context); } $filestoreid = $configuration['filestoreid']; $filestoreid = \Workflow\VTTemplate::parse($filestoreid, $context); $context->addTempFile($filepath, $filestoreid, $filename); }
/** * @param $key * @param $value * @param $context \Workflow\VTEntity * @return array|void */ public function doAction($configuration, $filepath, $filename, $context, $targetRecordIds = array()) { $adb = \PearDatabase::getInstance(); require_once 'modules/Documents/Documents.php'; $focus = new \Documents(); $focus->parentid = $context->getId(); $docTitle = $configuration["title"]; $docDescr = nl2br($configuration["description"]); $docTitle = \Workflow\VTTemplate::parse($docTitle, $context); $docDescr = \Workflow\VTTemplate::parse($docDescr, $context); $focus->column_fields['notes_title'] = $docTitle; $focus->column_fields['assigned_user_id'] = $context->get('assigned_user_id'); $focus->column_fields['filename'] = $filename; $focus->column_fields['notecontent'] = $docDescr; $focus->column_fields['filetype'] = 'application/pdf'; $focus->column_fields['filesize'] = filesize($filepath); $focus->column_fields['filelocationtype'] = 'I'; $focus->column_fields['fileversion'] = ''; $focus->column_fields['filestatus'] = 'on'; $focus->column_fields['folderid'] = $configuration["folderid"]; $focus->save('Documents'); $upload_file_path = decideFilePath(); $date_var = date("Y-m-d H:i:s"); $next_id = $adb->getUniqueID("vtiger_crmentity"); copy($filepath, $upload_file_path . $next_id . "_" . $filename); $sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(?, ?, ?, ?, ?, ?, ?)"; $params1 = array($next_id, $context->get('assigned_user_id'), $context->get('assigned_user_id'), "Documents Attachment", 'Documents Attachment', date("Y-m-d H:i:s"), date("Y-m-d H:i:s")); $adb->pquery($sql1, $params1); $filetype = "application/octet-stream"; $sql2 = "insert into vtiger_attachments(attachmentsid, name, description, type, path) values(?, ?, ?, ?, ?)"; $params2 = array($next_id, $filename, $docDescr, $filetype, $upload_file_path); $adb->pquery($sql2, $params2, true); $sql3 = 'insert into vtiger_seattachmentsrel values(?,?)'; $adb->pquery($sql3, array($focus->id, $next_id)); if ($configuration["relation"] === "1") { foreach ($targetRecordIds as $id) { $sql = "INSERT INTO vtiger_senotesrel SET crmid = " . $id . ", notesid = " . $focus->id; $adb->query($sql); } } else { $sql = "DELETE FROM vtiger_senotesrel WHERE crmid = " . $context->getId() . " AND notesid = " . $focus->id; $adb->query($sql); } $newContext = \Workflow\VTEntity::getForId($focus->id, "Documents"); if ($configuration['workflowid'] !== "") { $objWorkflow = new \Workflow\Main($configuration['workflowid'], false, $context->getUser()); $objWorkflow->setContext($newContext); $objWorkflow->isSubWorkflow(true); $objWorkflow->start(); } }
/** * @param $context \Workflow\VTEntity */ public function handleTask(&$context) { $adb = PearDatabase::getInstance(); $targetId = $this->get('targetId', $context); if (empty($targetId)) { $targetId = $context->getId(); } $target = $this->get('target'); if ($target == -1) { $target = 'record'; } $targetIds = array(); if ($target == 'record') { if (strpos($targetId, 'x') !== false) { $parts = explode('x', $targetId); $targetId = $parts[1]; } $targetIds[] = $targetId; } else { $targetUser = $this->get('targetUser', $context); if (!empty($targetUser)) { $targetuserId = \Workflow\VTTemplate::parse('$' . $targetUser, $context); if (strpos($targetuserId, 'x') !== false) { $parts = explode('x', $targetuserId); $targetuserId = $parts[1]; } $targetIds[] = $targetuserId; } } /* if($this->get('target') == 'user') { if(strpos($idString, "x") !== false) { $idParts = explode("x", $idString); return $idParts[1]; } $current_user = $cu_model = Users_Record_Model::getCurrentUserModel(); $target = 'user'; $targetId = $current_user->id; }*/ foreach ($targetIds as $targetId) { $sql = 'INSERT INTO vtiger_wf_messages SET crmid = ?, type = ?, subject = ?, message = ?, show_once = ?, show_until = ?, position = ?, created = NOW(), target = ?, user_id = ?'; $adb->pquery($sql, array($targetId, $this->get('type', $context), $this->get('subject', $context), $this->get('message', $context), $this->get('show_once', $context), $this->get('show_until', $context), $this->get('position', $context), $target, $targetuserId)); } return "yes"; }
public function handleTask(&$context) { $envId = $this->get('envId'); if (empty($envId)) { throw new \Exception('You must configure the generate Recordlist Block and set a Environment ID.'); } $fields = $this->get('fields'); $env = $context->getEnvironment($envId); $moduleName = $env['moduleName']; $ids = $env['ids']; $tabid = getTabid($moduleName); $search_module = $this->get("search_module"); if (!empty($search_module)) { if ($search_module != -1) { $parts = explode("#~#", $search_module); } } if ($moduleName != $parts[0]) { throw new \Exception('The generate RecordList Block use the wrong Module. You must set ' . $moduleName . ' or create another block.'); } $adb = \PearDatabase::getInstance(); $html = '<table border=1 cellpadding=2 cellspacing=0>'; $html .= '<thead><tr>'; foreach ($fields as $field) { $html .= '<th style="width:' . $field['width'] . ';text-align:left;background-color:#ccc;">' . $field['label'] . '</th>'; } $html .= '</tr></thead>'; foreach ($ids as $id) { $html .= '<tr>'; $record = \Workflow\VTEntity::getForId($id, $moduleName); foreach ($fields as $field) { if ($field['field'] == 'link') { $value = '<a href="' . vglobal('site_URL') . '/index.php?module=' . $record->getModuleName() . '&view=Detail&record=' . $id . '">Link</a>'; } else { $value = \Workflow\VTTemplate::parse($field['field'], $record); } $html .= '<td>' . $value . '</td>'; } $html .= '</tr>'; } $html .= '</table>'; $env['html'] = $html; $context->setEnvironment($envId, $env); return "yes"; }
public function handleTask(&$context) { $adb = \PearDatabase::getInstance(); /* Insert here source code to execute the task */ $format = $this->get('fileformat'); $fields = $this->get('fields'); $tmpfile = tempnam(sys_get_temp_dir(), 'CSV'); @unlink($tmpfile); $source = $this->get('source'); if ($source == -1 || $source == 'envid') { $env = $context->getEnvironment($this->get('recordlistid')); } elseif ($source == 'customview') { $search_module = $this->get("search_module"); $parts = explode("#~#", $search_module); $searchModuleName = $parts[0]; $queryGenerator = new \QueryGenerator($searchModuleName, \Users::getActiveAdminUser()); $queryGenerator->initForCustomViewById($this->get('customviewsource')); $query = $queryGenerator->getQuery(); $parts = preg_split('/FROM/i', $query); $sqlQuery = 'SELECT vtiger_crmentity.crmid as id_col FROM ' . $parts[1]; $result = $adb->query($sqlQuery, true); $this->addStat("num Rows: " . $adb->num_rows($result)); while ($row = $adb->fetchByAssoc($result)) { $recordids[] = $row["id_col"]; } $env = array('moduleName' => $searchModuleName, 'ids' => $recordids); } $moduleName = $env['moduleName']; $ids = $env['ids']; $filename = $this->get('filename', $context); switch ($format) { case 'csv': $file = fopen($tmpfile, 'w'); $headline = $this->get('insertheadline'); if ($headline == '1') { $headline = array(); foreach ($fields as $field) { $headline[] = $field['label']; } fputcsv($file, $headline, ';'); } foreach ($ids as $id) { $record = \Workflow\VTEntity::getForId($id, $moduleName); $tmp = array(); foreach ($fields as $field) { $tmp[] = \Workflow\VTTemplate::parse($field['field'], $record); } fputcsv($file, $tmp, ';'); } fclose($file); break; case 'excel': require_once $this->getAdditionalPath('phpexcel') . 'PHPExcel.php'; // Create new PHPExcel object $objPHPExcel = new PHPExcel(); // Set document properties $objPHPExcel->getProperties()->setCreator("Workflow Designer")->setLastModifiedBy("Workflow Designer")->setTitle("Workflow Designer Export")->setSubject("Workflow Designer Export"); $headline = $this->get('insertheadline'); $alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $currentROW = 1; if ($headline == '1') { $headline = array(); foreach ($fields as $field) { $headline[] = $field['label']; } $objPHPExcel->setActiveSheetIndex(0)->fromArray(array($headline), NULL, 'A1'); $currentROW++; } foreach ($ids as $id) { $record = \Workflow\VTEntity::getForId($id, $moduleName); $tmp = array(); foreach ($fields as $field) { $tmp[] = \Workflow\VTTemplate::parse($field['value'], $record); } $objPHPExcel->getActiveSheet()->fromArray($tmp, '', 'A' . $currentROW); $currentROW++; } $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save($tmpfile); break; } \Workflow\FileAction::doActions($this->get('resultaction'), $tmpfile, $filename, $context, $context->getId(), $this->getWorkflow()); @unlink($tmpfile); return "yes"; }
public function calculateContinueTS($base_datetime, $context) { $timestamp = $base_datetime; if ($this->get("waitMin") == "1") { if ($timestamp < time()) { $timestamp = time(); } $waitMinValue = $this->get("waitMinValue"); if (strpos($waitMinValue, '$') !== false || strpos($waitMinValue, '?') !== false) { $objTemplate = new VTTemplate($context); $waitMinValue = $objTemplate->render($waitMinValue); } switch ($this->get("waitMinCat")) { case "minutes": $timestamp += 60 * $waitMinValue; break; case "hours": $timestamp += 60 * 60 * $waitMinValue; break; case "days": $timestamp += 24 * 60 * 60 * $waitMinValue; break; case "weeks": $timestamp += 7 * 24 * 60 * 60 * $waitMinValue; break; } } if ($this->get("waitUntilMonthDay") == "1") { $value = $this->get("waitUntilMonthDayValue"); $group = $this->get("waitUntilMonthDayGroup"); if (strpos($value, '$') !== false || strpos($value, '?') !== false) { $objTemplate = new VTTemplate($context); $value = $objTemplate->render($value); } switch ($group) { case "next_month": if (date("d", $timestamp) < $value) { $timestamp = strtotime(date("Y-m-" . $value)); } else { $timestamp = strtotime(date("Y-m-" . $value) . " +1 month"); } break; } } if ($this->get("waitUntilWeekDay") == "1") { $weekdays = $this->get("waitUntilWeekDayValue"); $today = date("N"); for ($a = $today == 7 ? 1 : $today + 1; $a <= 7; $a++) { if (in_array("" . $a, $weekdays)) { $timestamp = strtotime("next " . getTranslatedString(strtolower($this->sysDays[$a])), $timestamp); break; } if ($a == $today) { break; } if ($a == 7) { $a = 0; } } } if ($this->get("waitUntilTime") == "1") { // To set clocktime, i used php internal functions, to get a timestamp from datetime string $time = ($this->get("waitUntilTimeHour") < 10 ? "0" : "") . $this->get("waitUntilTimeHour") . ":" . ($this->get("waitUntilTimeMinutes") < 10 ? "0" : "") . $this->get("waitUntilTimeMinutes") . ":00"; // Check now if is after the needed time if (date("H:i:s", $timestamp) > $time) { $timestamp += 3600 * 24; } $timestamp = strtotime(date("Y-m-d ", $timestamp) . $time); } return $timestamp; }
public function process(Vtiger_Request $request) { ${"GLOBALS"}["chcevbjm"] = "params"; ${"GLOBALS"}["uddkkmgoo"] = "current_user"; $hcnexc = "sql"; $qdewlwhevj = "allow_parallel"; ${${"GLOBALS"}["hjcnqydfk"]} = PearDatabase::getInstance(); $ldobmlfv = "result"; ${${"GLOBALS"}["chcevbjm"]} = $request->getAll(); $ythfmxwru = "result"; ${"GLOBALS"}["ziyqhnwbkgh"] = "startfields"; $etbpjhd = "redirection"; ${${"GLOBALS"}["uddkkmgoo"]} = ${${"GLOBALS"}["swhytdpbqad"]} = Users_Record_Model::getCurrentUserModel(); $poabnfyvn = "row"; $islvxox = "workflow"; ${$qdewlwhevj} = $request->get("allow_parallel", "0"); ${$islvxox} = (int) $request->get("workflow"); $jjvyqosqc = "sql"; ${"GLOBALS"}["nonmmspn"] = "result"; ${${"GLOBALS"}["ziyqhnwbkgh"]} = $request->get("startfields"); ${$jjvyqosqc} = "SELECT * FROM vtiger_wf_settings WHERE id = ? AND active = 1"; ${$ythfmxwru} = $adb->pquery(${$hcnexc}, array(${${"GLOBALS"}["wsetygx"]})); while (${$poabnfyvn} = $adb->fetch_array(${${"GLOBALS"}["nonmmspn"]})) { ${"GLOBALS"}["wrpbkirg"] = "user"; $yropymdmfby = "row"; if (${${"GLOBALS"}["irzvvvuoub"]}["execution_user"] == "0") { $iivpozwkudif = "row"; ${$iivpozwkudif}["execution_user"] = $current_user->id; } ${"GLOBALS"}["xybqugqfbv"] = "user"; $xfxryhn = "allow_parallel"; ${${"GLOBALS"}["xybqugqfbv"]} = new Users(); $user->retrieveCurrentUserInfoFromFile(${${"GLOBALS"}["irzvvvuoub"]}["execution_user"]); $jvljtkcm = "objWorkflow"; VTEntity::setUser(${${"GLOBALS"}["wxiabddsqh"]}); ${$jvljtkcm} = new \Workflow\Main(${${"GLOBALS"}["irzvvvuoub"]}["id"], false, ${${"GLOBALS"}["wrpbkirg"]}); $rlxpjpocoqi = "context"; ${"GLOBALS"}["jkbdqfqrchl"] = "context"; $objWorkflow->setExecutionTrigger("WF2_MANUELL"); if (${$xfxryhn} == false && $objWorkflow->isRunning($_POST["crmid"])) { continue; } ${${"GLOBALS"}["jkbdqfqrchl"]} = VTEntity::getForId(intval($_POST["crmid"])); if (!empty(${$yropymdmfby}["startfields"]) && empty(${${"GLOBALS"}["xhdqpuushyxe"]})) { $jjwfklwbe = "startfields"; ${"GLOBALS"}["ncpssfj"] = "value"; ${"GLOBALS"}["bvznkhwudjv"] = "row"; ${"GLOBALS"}["bvoise"] = "startfields"; ${$jjwfklwbe} = unserialize(html_entity_decode(${${"GLOBALS"}["bvznkhwudjv"]}["startfields"])); foreach (${${"GLOBALS"}["bvoise"]} as ${${"GLOBALS"}["ebkwuuwbj"]} => ${${"GLOBALS"}["ncpssfj"]}) { $vbsuvtx = "value"; $umnyphuhq = "key"; $wvynkcpns = "value"; ${$wvynkcpns}["default"] = trim(VTTemplate::parse(${${"GLOBALS"}["xrfekkrnsds"]}["default"], ${${"GLOBALS"}["yelmdvtnoz"]})); ${${"GLOBALS"}["xhdqpuushyxe"]}[${$umnyphuhq}] = ${$vbsuvtx}; } die(json_encode(array("result" => "startfields", "workflow" => intval($_POST["workflow"]), "fields" => ${${"GLOBALS"}["xhdqpuushyxe"]}))); } if (isset($_POST["startfields"]) && count($_POST["startfields"]) > 0) { ${${"GLOBALS"}["nrjakqkxfrj"]} = $_POST["startfields"]; ${"GLOBALS"}["skiglfir"] = "values"; ${${"GLOBALS"}["xhdqpuushyxe"]} = array(); foreach (${${"GLOBALS"}["nrjakqkxfrj"]} as ${${"GLOBALS"}["skiglfir"]}) { $gmmmtwly = "values"; ${${"GLOBALS"}["xhdqpuushyxe"]}[${${"GLOBALS"}["xpbanljqm"]}["name"]] = trim(${$gmmmtwly}["value"]); } $context->setEnvironment("value", ${${"GLOBALS"}["xhdqpuushyxe"]}); } $objWorkflow->setContext(${$rlxpjpocoqi}); $objWorkflow->start(); $context->save(); } Workflow2::${${"GLOBALS"}["txnvdyiguy"]} = false; ${${"GLOBALS"}["owreihb"]} = array("result" => "ok"); ${${"GLOBALS"}["mjzlhjsgfwf"]} = $objWorkflow->getSuccessRedirection(); if (${$etbpjhd} !== false) { $sveupbcjtzb = "redirection"; ${"GLOBALS"}["uzjapaopix"] = "result"; ${${"GLOBALS"}["uzjapaopix"]}["redirection"] = ${$sveupbcjtzb}; ${${"GLOBALS"}["owreihb"]}["redirection_target"] = $objWorkflow->getSuccessRedirectionTarget(); } die(json_encode(${$ldobmlfv})); }
public function handleTask(&$context) { $setterMap = $this->get("setter"); $globalMap = $this->get("global"); $products = $this->get("product"); $shippingCost = 0; $newModule = $this->get("new_module"); if (empty($newModule)) { $this->addStat("NO Configuration set"); return "yes"; } /** * @var $newObj \Workflow\VTInventoryEntity */ $newObj = \Workflow\VTEntity::create($newModule); try { foreach ($setterMap as $setter) { if (!empty($setter["field"]) && $setter["field"] == "currency_id") { $setter["value"] = vtws_getWebserviceEntityId("Currency", $setter["value"]); } if ($setter["mode"] == "function") { $parser = new VTWfExpressionParser($setter["value"], $context, false); # Last Parameter = DEBUG try { $parser->run(); } catch (\Workflow\ExpressionException $exp) { Workflow2::error_handler(E_EXPRESSION_ERROR, $exp->getMessage(), "", ""); } $newValue = $parser->getReturn(); } else { $setter["value"] = \Workflow\VTTemplate::parse($setter["value"], $context); $newValue = $setter["value"]; } $this->addStat("`" . $setter["field"] . "` = '" . $newValue . "'"); if ($setter["field"] == "hdnS_H_Amount") { $shippingCost = $newValue; } # var_dump($setter["field"], $newValue); $newObj->set($setter["field"], $newValue); } } catch (Exception $e) { var_dump($e); // ONLY ERROR } try { $newObj->save(); } catch (WebServiceException $exp) { // Somethink is wrong with the values. missing mandatory fields? } $context->setEnvironment("new_record_id", $newObj->getWsId(), $this); if ($this->get("redirectAfter") == "1") { $this->getWorkflow()->setSuccessRedirection($newObj->getDetailUrl()); } $groupTaxes = array(); $shipTaxes = array(); foreach ($globalMap as $globalKey => $globalValue) { $globalValue = \Workflow\VTTemplate::parse($globalValue, $context); if (strpos($globalKey, "_group_percentage") !== false) { $groupTaxes[$globalKey] = $globalValue; } if (strpos($globalKey, "_sh_percent") !== false) { $shipTaxes[$globalKey] = $globalValue; } $this->addStat("`" . $globalKey . "` = '" . $globalValue . "'"); } $newObj->setGroupTaxes($groupTaxes); $newObj->setShipTaxes($shipTaxes); $newObj->setShippingCost($shippingCost); $newObj->save(); $newObj = $this->_productchooser->addProducts2Entity($this->get('product'), $context, $newObj); $newObj->save(); if ($this->get("exec_workflow") !== "" && $this->get("exec_workflow") != -1) { $newContext = \Workflow\VTEntity::getForId($newObj->getId(), $newObj->getModuleName()); $objWorkflow = new \Workflow\Main($this->get("exec_workflow"), false, $context->getUser()); $newContext->loadEnvironment($context->getEnvironment()); $objWorkflow->setContext($newContext); $objWorkflow->isSubWorkflow(true); $objWorkflow->start(); } Workflow2::$enableError = true; return 'yes'; }
public function getFieldValueArray(VTEntity $context, $setterMap) { ${"GLOBALS"}["qpcsskrqcb"] = "return"; ${"GLOBALS"}["ikjailgh"] = "setterMap"; $lmbjulm = "setter"; ${${"GLOBALS"}["qpcsskrqcb"]} = array(); foreach (${${"GLOBALS"}["ikjailgh"]} as ${$lmbjulm}) { ${"GLOBALS"}["ysgijyp"] = "newValue"; $nlfnkhvbsydm = "setter"; ${"GLOBALS"}["jesowuvsevc"] = "setter"; if (empty(${$nlfnkhvbsydm}["field"])) { continue; } $myyyzqb = "return"; if (${${"GLOBALS"}["wfwvejp"]}["mode"] == "function") { $xcgpolcxqi = "newValue"; $wghopoiw = "context"; ${"GLOBALS"}["exnpxogkqow"] = "setter"; ${${"GLOBALS"}["gnwthoyzmyc"]} = new \Workflow\ExpressionParser(${${"GLOBALS"}["exnpxogkqow"]}["value"], ${$wghopoiw}, false); try { $parser->run(); } catch (ExpressionException $exp) { \Workflow2::error_handler(E_EXPRESSION_ERROR, $exp->getMessage(), "", ""); } ${$xcgpolcxqi} = $parser->getReturn(); } else { ${"GLOBALS"}["epyviwg"] = "setter"; $oybfubfnlh = "setter"; ${"GLOBALS"}["fijedwsppbdr"] = "context"; $ikxlqgdidh = "setter"; ${"GLOBALS"}["dpxascgg"] = "newValue"; ${$oybfubfnlh}["value"] = \Workflow\VTTemplate::parse(${$ikxlqgdidh}["value"], ${${"GLOBALS"}["fijedwsppbdr"]}); ${${"GLOBALS"}["dpxascgg"]} = ${${"GLOBALS"}["epyviwg"]}["value"]; } ${$myyyzqb}[${${"GLOBALS"}["jesowuvsevc"]}["field"]] = ${${"GLOBALS"}["ysgijyp"]}; } return ${${"GLOBALS"}["tkmmiwpj"]}; }
public function handleReturn(Exception $exp = null) { ${"GLOBALS"}["xhomifgcend"] = "exp"; if (${${"GLOBALS"}["ersyqfm"]} === null) { if (isset($this->_objWorkflow)) { $this->checkUserQueue($this->_objWorkflow->getLastExecID()); ${${"GLOBALS"}["idjaqwrixvz"]} = array("result" => "ready"); ${${"GLOBALS"}["jbcvqlrloubk"]} = $this->_objWorkflow->getSuccessRedirection(); if (${${"GLOBALS"}["jbcvqlrloubk"]} !== false) { ${"GLOBALS"}["dqdsybzr"] = "result"; ${${"GLOBALS"}["dqdsybzr"]}["redirection"] = ${${"GLOBALS"}["jbcvqlrloubk"]}; ${${"GLOBALS"}["idjaqwrixvz"]}["redirection_target"] = $this->_objWorkflow->getSuccessRedirectionTarget(); } } else { ${${"GLOBALS"}["idjaqwrixvz"]} = array("result" => "ready"); } ${"GLOBALS"}["lburztt"] = "result"; Workflow2::${${"GLOBALS"}["fiflovy"]} = false; die(json_encode(${${"GLOBALS"}["lburztt"]})); } ${"GLOBALS"}["bgnkrlnluya"] = "exp"; if (${${"GLOBALS"}["xhomifgcend"]} instanceof \Workflow\RequestValuesException) { $svcmbeqp = "result"; ${"GLOBALS"}["dvezbpy"] = "fields"; ${${"GLOBALS"}["vyusgbxkhknd"]} = \Workflow\Queue::addEntry($exp->getTask(), $exp->getContext()->getUser(), $exp->getContext(), "static", false, 1, false); \Workflow\Userqueue::add("requestValue", ${${"GLOBALS"}["vyusgbxkhknd"]}, $exp->getMessage(), $this->_objWorkflow->getLastExecID(), array()); $cvpulpbmvu = "fields"; $nbyydxlevp = "enableError"; ${$svcmbeqp} = array("result" => "ready"); ${${"GLOBALS"}["dvezbpy"]} = $exp->getFields(); foreach (${${"GLOBALS"}["vjvvxtyxgio"]} as ${${"GLOBALS"}["orcciwacpoo"]} => ${${"GLOBALS"}["bjudgmb"]}) { ${"GLOBALS"}["ihmbyreyp"] = "key"; ${"GLOBALS"}["yxutovlkobh"] = "fields"; ${"GLOBALS"}["uhzromvror"] = "value"; ${${"GLOBALS"}["bjudgmb"]}["default"] = trim(\Workflow\VTTemplate::parse(${${"GLOBALS"}["uhzromvror"]}["default"], $this->_objWorkflow->getContext())); ${${"GLOBALS"}["yxutovlkobh"]}[${${"GLOBALS"}["ihmbyreyp"]}] = ${${"GLOBALS"}["bjudgmb"]}; } Workflow2::${$nbyydxlevp} = false; die(json_encode(array("result" => "reqvalues", "request_message" => $exp->getMessage(), "fields_key" => $exp->getKey(), "execId" => $this->_objWorkflow->getLastExecID() . "##" . $exp->getTask()->getBlockId(), "fields" => ${$cvpulpbmvu}))); } ${"GLOBALS"}["buukyxqqu"] = "enableError"; Workflow2::error_handler(${${"GLOBALS"}["bgnkrlnluya"]}); Workflow2::${${"GLOBALS"}["buukyxqqu"]} = false; }
function process(Vtiger_Request $request) { ${"GLOBALS"}["kqjqpgyxbpw"] = "row"; $vkvaqpflee = "aid"; global $current_user; ${"GLOBALS"}["uwhowfopwf"] = "adb"; ${${"GLOBALS"}["uwhowfopwf"]} = PearDatabase::getInstance(); $xtjbegglz = "moduleName"; ${"GLOBALS"}["rpprupo"] = "result"; ${"GLOBALS"}["chmmqmj"] = "a"; $byxpixpu = "sql"; ${${"GLOBALS"}["ntetvnbwqlv"]} = $this->getViewer(${${"GLOBALS"}["ibktcfcj"]}); ${"GLOBALS"}["fblhutfwj"] = "a"; $sbwrqfadr = "sql"; ${$xtjbegglz} = $request->getModule(); ${"GLOBALS"}["nlplkrnjrcv"] = "sql"; ${${"GLOBALS"}["urohdigihdy"]} = Vtiger_Module_Model::getInstance(${${"GLOBALS"}["zqodvuvwr"]}); ${${"GLOBALS"}["lwvdhqdj"]} = (int) $request->get("aid"); $sglxrinrxh = "userqueue"; ${${"GLOBALS"}["agpkbjtayb"]} = $request->get("h"); ${${"GLOBALS"}["fblhutfwj"]} = $request->get("a"); if (1 == 0 && !empty(${$vkvaqpflee}) && !empty(${${"GLOBALS"}["bezvbhq"]}) && ${${"GLOBALS"}["agpkbjtayb"]} == md5($current_user->id . "##" . ${${"GLOBALS"}["chmmqmj"]} . "##" . ${${"GLOBALS"}["lwvdhqdj"]})) { } ${${"GLOBALS"}["nlplkrnjrcv"]} = "SELECT\n vtiger_wf_confirmation.*,\n vtiger_wf_confirmation.id as conf_id,\n vtiger_wf_settings.*,\n vtiger_wfp_blocks.text as block_title,\n vtiger_wfp_blocks.settings as block_settings,\n vtiger_users.user_name,\n vtiger_users.first_name,\n vtiger_users.last_name,\n result_user.user_name as result_user_name,\n result_user.first_name as result_first_name,\n result_user.last_name as result_last_name\n FROM\n vtiger_wf_confirmation_user\n INNER JOIN vtiger_wf_confirmation ON(vtiger_wf_confirmation.id = vtiger_wf_confirmation_user.confirmation_id)\n INNER JOIN vtiger_crmentity ON(vtiger_crmentity.crmid = vtiger_wf_confirmation.crmid AND vtiger_crmentity.deleted = 0)\n INNER JOIN vtiger_wf_settings ON(vtiger_wf_settings.id = vtiger_wf_confirmation.workflow_id)\n INNER JOIN vtiger_wfp_blocks ON(vtiger_wfp_blocks.id = vtiger_wf_confirmation.blockID)\n INNER JOIN vtiger_wf_queue ON(vtiger_wf_queue.crmid = vtiger_wf_confirmation.crmid AND vtiger_wf_queue.execID = vtiger_wf_confirmation.execID AND vtiger_wf_queue.block_id =vtiger_wf_confirmation.blockID)\n INNER JOIN vtiger_users ON(vtiger_users.id = vtiger_wf_confirmation.from_user_id)\n LEFT JOIN vtiger_users as result_user ON(result_user.id = vtiger_wf_confirmation.result_user_id)\n WHERE\n user_id = " . $current_user->id . " AND vtiger_wf_confirmation.visible = 1\n GROUP BY\n vtiger_wf_confirmation.id ORDER BY block_title\n "; ${${"GLOBALS"}["frlpsfjjm"]} = $adb->query(${$sbwrqfadr}, true); ${${"GLOBALS"}["ooixnmkwq"]} = array(); $pthcdlfddnnh = "result"; ${"GLOBALS"}["oteaqj"] = "userqueue"; while (${${"GLOBALS"}["kqjqpgyxbpw"]} = $adb->fetchByAssoc(${$pthcdlfddnnh})) { $rmjbqeshhis = "referenceModule"; $ngcqplp = "referenceModule"; ${"GLOBALS"}["mlvnybsicfig"] = "workflows"; ${"GLOBALS"}["eljacioilgx"] = "recordLink"; ${"GLOBALS"}["dauxpml"] = "numberField"; if (!is_array(${${"GLOBALS"}["mlvnybsicfig"]}[${${"GLOBALS"}["wmhxuntxqkc"]}["block_title"]])) { ${"GLOBALS"}["twbpebpxi"] = "workflows"; ${${"GLOBALS"}["twbpebpxi"]}[${${"GLOBALS"}["wmhxuntxqkc"]}["block_title"]] = array(); } ${"GLOBALS"}["pmxvjbf"] = "noCols"; ${$ngcqplp} = ${${"GLOBALS"}["wmhxuntxqkc"]}["module"]; ${"GLOBALS"}["rfiwxezcqe"] = "referenceModule"; ${"GLOBALS"}["flnnii"] = "row"; $hepygdrwkc = "noCols"; $jdlignnj = "noCols"; ${"GLOBALS"}["awmkvud"] = "workflows"; ${"GLOBALS"}["jbchodyllw"] = "row"; $dnepmkz = "settings"; ${${"GLOBALS"}["sdhtkdyeuq"]} = CRMEntity::getInstance(${${"GLOBALS"}["rfiwxezcqe"]}); if (empty(${$jdlignnj}[${${"GLOBALS"}["kkwrpdb"]}])) { ${"GLOBALS"}["thejxnd"] = "resultTMP"; $fsozifcfsw = "row"; $wnpebq = "resultTMP"; ${"GLOBALS"}["mfdayznhunx"] = "sql"; $noipkqjvcbky = "sql"; ${${"GLOBALS"}["doxebbenfem"]} = "SELECT * FROM vtiger_field WHERE tabid = " . getTabId(${${"GLOBALS"}["wmhxuntxqkc"]}["module"]) . " AND uitype = 4"; ${${"GLOBALS"}["thejxnd"]} = $adb->query(${${"GLOBALS"}["mfdayznhunx"]}); $ronvvlcujsa = "sql"; if ($adb->num_rows(${${"GLOBALS"}["svdtdbgmoc"]}) > 0) { $kwpctersh = "referenceModule"; ${${"GLOBALS"}["duijdw"]}[${$kwpctersh}]["link_no"] = $adb->fetchByAssoc(${${"GLOBALS"}["svdtdbgmoc"]}); } else { ${"GLOBALS"}["shrvsk"] = "referenceModule"; ${${"GLOBALS"}["duijdw"]}[${${"GLOBALS"}["shrvsk"]}]["link_no"] = "no_available"; } ${$ronvvlcujsa} = "SELECT * FROM vtiger_field WHERE tabid = " . getTabId(${$fsozifcfsw}["module"]) . " AND fieldname = ?"; ${$wnpebq} = $adb->pquery(${$noipkqjvcbky}, array($focus->list_link_field)); if ($adb->num_rows(${${"GLOBALS"}["svdtdbgmoc"]}) > 0) { ${${"GLOBALS"}["duijdw"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_name"] = $adb->fetchByAssoc(${${"GLOBALS"}["svdtdbgmoc"]}); } else { ${"GLOBALS"}["qgebipdtob"] = "noCols"; ${${"GLOBALS"}["qgebipdtob"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_name"] = "no_available"; } } ${"GLOBALS"}["hfpqiswtqjc"] = "row"; ${"GLOBALS"}["dirpsx"] = "referenceModule"; if (${${"GLOBALS"}["pmxvjbf"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_no"] != "no_available") { $yyiomdi = "sql"; ${"GLOBALS"}["wkhdpyqxx"] = "row"; $zhhzpgweddf = "referenceModule"; $jjwpivteyq = "linkFieldRst"; ${$yyiomdi} = "SELECT " . ${${"GLOBALS"}["duijdw"]}[${$zhhzpgweddf}]["link_no"]["columnname"] . " as nofield FROM " . ${${"GLOBALS"}["duijdw"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_no"]["tablename"] . " WHERE " . $focus->table_index . " = " . ${${"GLOBALS"}["wkhdpyqxx"]}["crmid"]; ${${"GLOBALS"}["tnvfwhunq"]} = $adb->query(${${"GLOBALS"}["doxebbenfem"]}); ${${"GLOBALS"}["egivyrgmhu"]} = $adb->query_result(${$jjwpivteyq}, 0, "nofield"); } if (${$hepygdrwkc}[${$rmjbqeshhis}]["link_name"] != "no_available") { $wncswbngel = "sql"; $yrbxtiml = "noCols"; $zpcmsf = "linkField"; $tdatiye = "linkFieldRst"; ${"GLOBALS"}["dfndagpcvie"] = "row"; ${$wncswbngel} = "SELECT " . ${$yrbxtiml}[${${"GLOBALS"}["kkwrpdb"]}]["link_name"]["columnname"] . " as linkfield FROM " . ${${"GLOBALS"}["duijdw"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_name"]["tablename"] . " WHERE " . $focus->table_index . " = " . ${${"GLOBALS"}["dfndagpcvie"]}["crmid"]; ${$tdatiye} = $adb->query(${${"GLOBALS"}["doxebbenfem"]}); ${$zpcmsf} = $adb->query_result(${${"GLOBALS"}["tnvfwhunq"]}, 0, "linkfield"); } ${${"GLOBALS"}["depeexesucr"]} = "<a target='_blank' href='index.php?module={$referenceModule}&view=Detail&record=" . "" . ${${"GLOBALS"}["wmhxuntxqkc"]}["crmid"] . "' title='" . getTranslatedString(${${"GLOBALS"}["kkwrpdb"]}, ${${"GLOBALS"}["kkwrpdb"]}) . "'>" . ${${"GLOBALS"}["seqptb"]} . "</a>"; ${"GLOBALS"}["gognlbsrc"] = "useBuiltinEncoderDecoder"; ${"GLOBALS"}["wzyntcdvnerr"] = "settings"; if (${${"GLOBALS"}["duijdw"]}[${${"GLOBALS"}["dirpsx"]}]["link_no"] != "no_available") { $bkzrkriyn = "referenceModule"; $qlotdcqkwc = "row"; ${${"GLOBALS"}["egvtihyk"]} = "<a target='_blank' href='index.php?module={$referenceModule}&view=Detail&record=" . "" . ${$qlotdcqkwc}["crmid"] . "' title='" . getTranslatedString(${$bkzrkriyn}, ${${"GLOBALS"}["kkwrpdb"]}) . "'>" . ${${"GLOBALS"}["egivyrgmhu"]} . "</a>"; } else { $zcidwgt = "row"; $jkmxuqiywvg = "referenceModule"; ${"GLOBALS"}["kkfrmyrrdmiv"] = "numberField"; ${${"GLOBALS"}["kkfrmyrrdmiv"]} = "<a target='_blank' href='index.php?module={$referenceModule}&view=Detail&record=" . "" . ${$zcidwgt}["crmid"] . "' title='" . getTranslatedString(${${"GLOBALS"}["kkwrpdb"]}, ${$jkmxuqiywvg}) . "'>" . ${${"GLOBALS"}["wmhxuntxqkc"]}["crmid"] . "</a>"; } ${${"GLOBALS"}["wmhxuntxqkc"]}["recordLink"] = ${${"GLOBALS"}["eljacioilgx"]}; ${${"GLOBALS"}["wmhxuntxqkc"]}["numberField"] = ${${"GLOBALS"}["dauxpml"]}; Zend_Json::${${"GLOBALS"}["gognlbsrc"]} = true; ${${"GLOBALS"}["cpjwycbmua"]} = Zend_Json::decode(html_entity_decode(${${"GLOBALS"}["flnnii"]}["block_settings"])); if (!isset(${${"GLOBALS"}["wzyntcdvnerr"]}["btn_accept"])) { ${"GLOBALS"}["lgbhukwldj"] = "settings"; ${${"GLOBALS"}["lgbhukwldj"]}["btn_accept"] = "LBL_OK"; } ${"GLOBALS"}["ehakycqyqs"] = "row"; if (!isset(${$dnepmkz}["btn_rework"])) { ${${"GLOBALS"}["cpjwycbmua"]}["btn_rework"] = "LBL_REWORK"; } if (!isset(${${"GLOBALS"}["cpjwycbmua"]}["btn_decline"])) { ${${"GLOBALS"}["cpjwycbmua"]}["btn_decline"] = "LBL_DECLINE"; } ${"GLOBALS"}["ifiqdgm"] = "settings"; $rkxirbchf = "row"; ${"GLOBALS"}["mdemwrvwl"] = "settings"; if (strpos(${${"GLOBALS"}["cpjwycbmua"]}["btn_accept"], "\$") !== false) { $fuehhfmjk = "referenceModule"; $oslrwexpv = "settings"; $psciysdt = "row"; ${${"GLOBALS"}["brcoeylxf"]} = \Workflow\VTEntity::getForId(${$psciysdt}["crmid"], ${$fuehhfmjk}); ${"GLOBALS"}["gmqvbsyniho"] = "context"; ${${"GLOBALS"}["cpjwycbmua"]}["btn_accept"] = \Workflow\VTTemplate::parse(${$oslrwexpv}["btn_accept"], ${${"GLOBALS"}["gmqvbsyniho"]}); } if (strpos(${${"GLOBALS"}["ifiqdgm"]}["btn_rework"], "\$") !== false) { $dkfofxebfb = "referenceModule"; ${"GLOBALS"}["vwzuqest"] = "context"; ${"GLOBALS"}["ooglifupb"] = "row"; ${${"GLOBALS"}["vwzuqest"]} = \Workflow\VTEntity::getForId(${${"GLOBALS"}["ooglifupb"]}["crmid"], ${$dkfofxebfb}); ${${"GLOBALS"}["cpjwycbmua"]}["btn_rework"] = VTTemplate::parse(${${"GLOBALS"}["cpjwycbmua"]}["btn_accept"], ${${"GLOBALS"}["brcoeylxf"]}); } if (strpos(${${"GLOBALS"}["mdemwrvwl"]}["btn_decline"], "\$") !== false) { ${"GLOBALS"}["aiklvgylqm"] = "referenceModule"; ${${"GLOBALS"}["brcoeylxf"]} = \Workflow\VTEntity::getForId(${${"GLOBALS"}["wmhxuntxqkc"]}["crmid"], ${${"GLOBALS"}["aiklvgylqm"]}); $mncvnbp = "settings"; ${$mncvnbp}["btn_decline"] = VTTemplate::parse(${${"GLOBALS"}["cpjwycbmua"]}["btn_accept"], ${${"GLOBALS"}["brcoeylxf"]}); } ${${"GLOBALS"}["wmhxuntxqkc"]}["block"] = ${${"GLOBALS"}["cpjwycbmua"]}; if (!empty(${${"GLOBALS"}["wmhxuntxqkc"]}["result"])) { $gmfsclfflfsh = "row"; ${"GLOBALS"}["hdmnaeyec"] = "row"; $tamsefsshci = "row"; ${${"GLOBALS"}["wmhxuntxqkc"]}["btn_accept_class"] = ${${"GLOBALS"}["hdmnaeyec"]}["result"] == "ok" ? "pressed" : "unpressed"; $hgycjksrvo = "row"; ${$gmfsclfflfsh}["btn_rework_class"] = ${$tamsefsshci}["result"] == "rework" ? "pressed" : "unpressed"; ${${"GLOBALS"}["wmhxuntxqkc"]}["btn_decline_class"] = ${$hgycjksrvo}["result"] == "decline" ? "pressed" : "unpressed"; } ${${"GLOBALS"}["wmhxuntxqkc"]}["timestamp"] = DateTimeField::convertToUserFormat(${${"GLOBALS"}["wmhxuntxqkc"]}["timestamp"]); $glrzxtpc = "row"; if (!empty(${${"GLOBALS"}["hfpqiswtqjc"]}["result_user_id"])) { ${"GLOBALS"}["sefnjkpmkio"] = "row"; ${${"GLOBALS"}["sefnjkpmkio"]}["result_timestamp"] = DateTimeField::convertToUserFormat(${${"GLOBALS"}["wmhxuntxqkc"]}["result_timestamp"]); } ${${"GLOBALS"}["jbchodyllw"]}["hash1"] = md5($current_user->id . "##ok##" . ${${"GLOBALS"}["wmhxuntxqkc"]}["conf_id"]); ${${"GLOBALS"}["wmhxuntxqkc"]}["hash2"] = md5($current_user->id . "##rework##" . ${${"GLOBALS"}["ehakycqyqs"]}["conf_id"]); ${${"GLOBALS"}["wmhxuntxqkc"]}["hash3"] = md5($current_user->id . "##decline##" . ${$rkxirbchf}["conf_id"]); ${${"GLOBALS"}["awmkvud"]}[${$glrzxtpc}["block_title"]][] = ${${"GLOBALS"}["wmhxuntxqkc"]}; } $viewer->assign("blocks", ${${"GLOBALS"}["ooixnmkwq"]}); $viewer->assign("CURRENT_USER_MODEL", Users_Record_Model::getCurrentUserModel()); ${$byxpixpu} = "SELECT\n vtiger_wf_userqueue.*,\n vtiger_wf_queue.*,\n vtiger_wf_settings.*,\n vtiger_wf_userqueue.id as userqueue_id,\n vtiger_wfp_blocks.text as block_title,\n vtiger_wfp_blocks.settings as block_settings\n FROM\n vtiger_wf_userqueue\n INNER JOIN vtiger_wf_queue ON(vtiger_wf_queue.id = vtiger_wf_userqueue.queue_id)\n INNER JOIN vtiger_wf_settings ON(vtiger_wf_settings.id = vtiger_wf_queue.workflow_id)\n INNER JOIN vtiger_wfp_blocks ON(vtiger_wfp_blocks.id = vtiger_wf_queue.block_id)\n\n WHERE\n vtiger_wf_queue.execution_user = "******"\n GROUP BY\n vtiger_wf_userqueue.id ORDER BY block_title\n "; ${${"GLOBALS"}["rpprupo"]} = $adb->query(${${"GLOBALS"}["doxebbenfem"]}, true); ${$sglxrinrxh} = array(); while (${${"GLOBALS"}["wmhxuntxqkc"]} = $adb->fetchByAssoc(${${"GLOBALS"}["frlpsfjjm"]})) { ${"GLOBALS"}["idbekdsrgp"] = "noCols"; ${"GLOBALS"}["uroyaulwr"] = "focus"; $qbliskzwduf = "referenceModule"; $gfnzbnynus = "noCols"; ${${"GLOBALS"}["kkwrpdb"]} = ${${"GLOBALS"}["wmhxuntxqkc"]}["module_name"]; ${${"GLOBALS"}["uroyaulwr"]} = CRMEntity::getInstance(${$qbliskzwduf}); if (empty(${${"GLOBALS"}["idbekdsrgp"]}[${${"GLOBALS"}["kkwrpdb"]}])) { ${"GLOBALS"}["plwmxh"] = "referenceModule"; ${${"GLOBALS"}["doxebbenfem"]} = "SELECT * FROM vtiger_field WHERE tabid = '" . getTabId(${${"GLOBALS"}["plwmxh"]}) . "' AND uitype = 4"; $afroojiu = "resultTMP"; ${${"GLOBALS"}["svdtdbgmoc"]} = $adb->query(${${"GLOBALS"}["doxebbenfem"]}); $tynnbidxcj = "resultTMP"; ${"GLOBALS"}["dptxpspqigs"] = "resultTMP"; if ($adb->num_rows(${$afroojiu}) > 0) { $ypbcwrngywz = "resultTMP"; ${${"GLOBALS"}["duijdw"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_no"] = $adb->fetchByAssoc(${$ypbcwrngywz}); } else { ${"GLOBALS"}["tcfpqglf"] = "noCols"; ${${"GLOBALS"}["tcfpqglf"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_no"] = "no_available"; } ${${"GLOBALS"}["doxebbenfem"]} = "SELECT * FROM vtiger_field WHERE tabid = " . getTabId(${${"GLOBALS"}["kkwrpdb"]}) . " AND fieldname = ?"; ${${"GLOBALS"}["dptxpspqigs"]} = $adb->pquery(${${"GLOBALS"}["doxebbenfem"]}, array($focus->list_link_field)); if ($adb->num_rows(${$tynnbidxcj}) > 0) { ${"GLOBALS"}["awvrfxmfzdix"] = "noCols"; ${"GLOBALS"}["bgpxzvyiyd"] = "referenceModule"; $uqpvvaso = "resultTMP"; ${${"GLOBALS"}["awvrfxmfzdix"]}[${${"GLOBALS"}["bgpxzvyiyd"]}]["link_name"] = $adb->fetchByAssoc(${$uqpvvaso}); } else { ${${"GLOBALS"}["duijdw"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_name"] = "no_available"; } } ${${"GLOBALS"}["egivyrgmhu"]} = "none"; $glxvryb = "linkField"; ${"GLOBALS"}["jublhql"] = "row"; if (${$gfnzbnynus}[${${"GLOBALS"}["kkwrpdb"]}]["link_no"] != "no_available") { ${"GLOBALS"}["viwaqpxvq"] = "referenceModule"; ${"GLOBALS"}["rkhlsawswg"] = "noCols"; $thcpnkbcgj = "noCols"; ${${"GLOBALS"}["doxebbenfem"]} = "SELECT " . ${${"GLOBALS"}["rkhlsawswg"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_no"]["columnname"] . " as nofield FROM " . ${$thcpnkbcgj}[${${"GLOBALS"}["viwaqpxvq"]}]["link_no"]["tablename"] . " WHERE " . $focus->table_index . " = " . ${${"GLOBALS"}["wmhxuntxqkc"]}["crmid"]; $pwnlmrbhmwph = "recordNumber"; ${${"GLOBALS"}["tnvfwhunq"]} = $adb->query(${${"GLOBALS"}["doxebbenfem"]}); ${$pwnlmrbhmwph} = $adb->query_result(${${"GLOBALS"}["tnvfwhunq"]}, 0, "nofield"); } ${"GLOBALS"}["crbjjcde"] = "referenceModule"; ${"GLOBALS"}["byfonqtj"] = "numberField"; if (${${"GLOBALS"}["duijdw"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_name"] != "no_available") { ${"GLOBALS"}["gpncjwhndn"] = "referenceModule"; ${"GLOBALS"}["qnccxfhbd"] = "row"; ${"GLOBALS"}["kwotindfqhi"] = "sql"; ${"GLOBALS"}["pjhptkuhn"] = "linkFieldRst"; $naguokin = "sql"; $oealezei = "linkField"; ${${"GLOBALS"}["kwotindfqhi"]} = "SELECT " . ${${"GLOBALS"}["duijdw"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_name"]["columnname"] . " as linkfield FROM " . ${${"GLOBALS"}["duijdw"]}[${${"GLOBALS"}["gpncjwhndn"]}]["link_name"]["tablename"] . " WHERE " . $focus->table_index . " = " . ${${"GLOBALS"}["qnccxfhbd"]}["crmid"]; ${${"GLOBALS"}["pjhptkuhn"]} = $adb->query(${$naguokin}, true); ${$oealezei} = $adb->query_result(${${"GLOBALS"}["tnvfwhunq"]}, 0, "linkfield"); } ${"GLOBALS"}["iouankd"] = "row"; ${${"GLOBALS"}["depeexesucr"]} = "<a target='_blank' href='index.php?module={$referenceModule}&view=Detail&record=" . "" . ${${"GLOBALS"}["wmhxuntxqkc"]}["crmid"] . "' title='" . getTranslatedString(${${"GLOBALS"}["kkwrpdb"]}, ${${"GLOBALS"}["crbjjcde"]}) . "'>" . ${$glxvryb} . "</a>"; if (${${"GLOBALS"}["duijdw"]}[${${"GLOBALS"}["kkwrpdb"]}]["link_no"] != "no_available") { $hickpgvvkmmx = "recordNumber"; $wcwyjnzp = "referenceModule"; $rftgkiu = "referenceModule"; ${${"GLOBALS"}["egvtihyk"]} = "<a target='_blank' href='index.php?module={$referenceModule}&view=Detail&record=" . "" . ${${"GLOBALS"}["wmhxuntxqkc"]}["crmid"] . "' title='" . getTranslatedString(${$rftgkiu}, ${$wcwyjnzp}) . "'>" . ${$hickpgvvkmmx} . "</a>"; } else { $wsipvnyebsd = "numberField"; ${$wsipvnyebsd} = "<a target='_blank' href='index.php?module={$referenceModule}&view=Detail&record=" . "" . ${${"GLOBALS"}["wmhxuntxqkc"]}["crmid"] . "' title='" . getTranslatedString(${${"GLOBALS"}["kkwrpdb"]}, ${${"GLOBALS"}["kkwrpdb"]}) . "'>" . ${${"GLOBALS"}["wmhxuntxqkc"]}["crmid"] . "</a>"; } switch (${${"GLOBALS"}["wmhxuntxqkc"]}["type"]) { case "requestValue": ${${"GLOBALS"}["wmhxuntxqkc"]}["button"] = array("value" => getTranslatedString("LBL_DO_ACTION", "Workflow2")); break; } ${${"GLOBALS"}["wmhxuntxqkc"]}["recordLink"] = ${${"GLOBALS"}["depeexesucr"]}; $lxjxdisnw = "row"; ${$lxjxdisnw}["numberField"] = ${${"GLOBALS"}["byfonqtj"]}; ${${"GLOBALS"}["wmhxuntxqkc"]}["subject"] = getTranslatedString(${${"GLOBALS"}["iouankd"]}["subject"], "Workflow2"); ${${"GLOBALS"}["rwlcosrpwnw"]}[${${"GLOBALS"}["jublhql"]}["subject"]][] = ${${"GLOBALS"}["wmhxuntxqkc"]}; } $viewer->assign("userqueue", ${${"GLOBALS"}["oteaqj"]}); $viewer->view("PermissionListPage.tpl", ${${"GLOBALS"}["zqodvuvwr"]}); }
public function addProducts2Entity($products, \Workflow\VTEntity $context, \Workflow\VTEntity $newObj) { $ntuvkohe = "newObj"; $byrhbpbrk = "availTaxes"; ${"GLOBALS"}["whorey"] = "index"; $ffgqftdius = "products"; ${$byrhbpbrk} = getAllTaxes("available"); foreach (${$ffgqftdius} as ${${"GLOBALS"}["whorey"]} => ${${"GLOBALS"}["sjtfmhhrl"]}) { ${"GLOBALS"}["iidnejxe"] = "productid"; ${"GLOBALS"}["mkhslsympqx"] = "value"; ${"GLOBALS"}["dwhdtozvynqw"] = "additionalProductFields"; $kruolocojg = "aTax"; $hovdgrthnuug = "productid"; $qtcncloye = "value"; if (!empty(${${"GLOBALS"}["mkhslsympqx"]}["productid_individual"])) { $wyriktxohly = "value"; ${"GLOBALS"}["sgtcyhxie"] = "context"; ${${"GLOBALS"}["abiiqvys"]} = \Workflow\VTTemplate::parse(${$wyriktxohly}["productid_individual"], ${${"GLOBALS"}["sgtcyhxie"]}); } else { $upfwkclmyw = "value"; ${${"GLOBALS"}["abiiqvys"]} = ${$upfwkclmyw}["productid"]; } $ftfrgn = "additional"; $rjivvcng = "value"; $txyfsrjjlt = "key"; if (strpos(${${"GLOBALS"}["abiiqvys"]}, "x") !== false) { $iicydljc = "productid"; ${${"GLOBALS"}["beraxrr"]} = explode("x", ${${"GLOBALS"}["abiiqvys"]}); ${$iicydljc} = ${${"GLOBALS"}["beraxrr"]}[1]; } ${${"GLOBALS"}["exevmtidn"]} = \CRMEntity::getInstance("Products"); $crmProduct->id = ${${"GLOBALS"}["abiiqvys"]}; ${"GLOBALS"}["sjserddrpvq"] = "template"; ${"GLOBALS"}["yxkoqgfdppa"] = "tax"; $tzdqzqwys = "value"; $crmProduct->retrieve_entity_info(${${"GLOBALS"}["iidnejxe"]}, "Products"); ${"GLOBALS"}["wwkmvdqqkc"] = "value"; ${"GLOBALS"}["kefwiymrs"] = "notUsed"; $context->setEnvironment("product", $crmProduct->column_fields); ${${"GLOBALS"}["yxkoqgfdppa"]} = array(); foreach (${${"GLOBALS"}["vplitvux"]} as ${$kruolocojg}) { $aupvkbaasytu = "aTax"; if (${${"GLOBALS"}["sjtfmhhrl"]}["tax" . ${$aupvkbaasytu}["taxid"] . "_enable"] == 1) { ${"GLOBALS"}["ogkgbpocs"] = "value"; ${"GLOBALS"}["ijrycbkkr"] = "aTax"; $mkhbocmhrmpk = "tax"; ${"GLOBALS"}["dtghrs"] = "context"; ${$mkhbocmhrmpk}[${${"GLOBALS"}["umtsmnroiv"]}["taxid"]] = \Workflow\VTTemplate::parse(${${"GLOBALS"}["ogkgbpocs"]}["tax" . ${${"GLOBALS"}["ijrycbkkr"]}["taxid"]], ${${"GLOBALS"}["dtghrs"]}); } } foreach (${${"GLOBALS"}["wwkmvdqqkc"]} as ${$txyfsrjjlt} => ${${"GLOBALS"}["sjserddrpvq"]}) { ${"GLOBALS"}["xlrnmfcvpv"] = "context"; ${"GLOBALS"}["zhharvcx"] = "value"; ${"GLOBALS"}["qhcuwjgl"] = "template"; ${${"GLOBALS"}["zhharvcx"]}[${${"GLOBALS"}["emvpxgxubu"]}] = \Workflow\VTTemplate::parse(${${"GLOBALS"}["qhcuwjgl"]}, ${${"GLOBALS"}["xlrnmfcvpv"]}); } ${${"GLOBALS"}["blrjuuukpb"]} = \Workflow\VTInventoryEntity::getAdditionalProductFields(); ${${"GLOBALS"}["cjsxrrce"]} = array(); foreach (${${"GLOBALS"}["dwhdtozvynqw"]} as ${${"GLOBALS"}["mvrectngpf"]} => ${${"GLOBALS"}["kefwiymrs"]}) { $fvxbkhyucq = "fieldIndex"; ${"GLOBALS"}["wqqxwewdo"] = "value"; ${"GLOBALS"}["scwnykwdcxs"] = "additional"; $gjgvfrgxj = "fieldIndex"; ${${"GLOBALS"}["scwnykwdcxs"]}[${$gjgvfrgxj}] = ${${"GLOBALS"}["wqqxwewdo"]}[${$fvxbkhyucq}]; } $newObj->addProduct(${$hovdgrthnuug}, ${$tzdqzqwys}["description"], ${${"GLOBALS"}["sjtfmhhrl"]}["comment"], ${${"GLOBALS"}["sjtfmhhrl"]}["quantity"], ${${"GLOBALS"}["sjtfmhhrl"]}["unitprice"], ${$qtcncloye}["discount_mode"] == "percentage" ? ${${"GLOBALS"}["sjtfmhhrl"]}["discount_value"] : 0, ${${"GLOBALS"}["sjtfmhhrl"]}["discount_mode"] == "amount" ? ${$rjivvcng}["discount_value"] : 0, ${${"GLOBALS"}["itmavwvym"]}, ${$ftfrgn}); } return ${$ntuvkohe}; }