/** * @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); }
/** * @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) { $setterMap = $this->get("setter"); $newModule = $this->get("new_module"); if (empty($newModule)) { $this->addStat("NO Configuration set"); return "yes"; } $newObj = VTEntity::create($newModule); $this->fieldSetter->apply($newObj, $setterMap, $context, $this); if ($newObj->isInventory() && $context->isInventory()) { $newObj->importInventory($context->exportInventory()); $newObj->set('hdnTaxType', $context->get('hdnTaxType')); } //$newObj->redirectToCreationForm(); try { $newObj->save(); } catch (WebServiceException $exp) { // Somethink is wrong with the values. missing mandatory fields? } if ($this->_productchooser !== null && $this->get('product') != -1) { $newObj = $this->_productchooser->addProducts2Entity($this->get('product'), $context, $newObj); try { $newObj->save(); } catch (WebServiceException $exp) { // Somethink is wrong with the values. missing mandatory fields? } } if ($context->getModuleName() == "Assets" && $newModule == "HelpDesk") { global $adb; $sql = "INSERT INTO vtiger_crmentityrel SET crmid = ?, module = ?, relcrmid = ?, relmodule = ?"; $adb->pquery($sql, array($context->getId(), $context->getModuleName(), $newObj->getId(), $newObj->getModuleName())); } $context->setEnvironment("new_record_id", $newObj->getId(), $this); if ($this->get("redirectAfter") == "1") { $this->getWorkflow()->setSuccessRedirection("index.php?module=" . $newModule . "&view=Detail&record=" . $newObj->getId(), 'same'); } if ($this->get("exec_workflow") !== "" && $this->get("exec_workflow") != -1) { $newContext = VTEntity::getForId($newObj->getId(), $newObj->getModuleName()); $newContext->loadEnvironment($context->getEnvironment()); $objWorkflow = new \Workflow\Main($this->get("exec_workflow"), false, $context->getUser()); $objWorkflow->setContext($newContext); $objWorkflow->start(); } 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"; }
/** * @param $context \Workflow\VTEntity */ public function handleTask(&$context) { $values = $this->get("cols"); $srcrecord = $this->get('srcrecord'); if (empty($srcrecord) || $srcrecord == -1) { $srcrecord = 'crmid'; } if ($srcrecord !== 'crmid') { $targetContext = \Workflow\VTEntity::getForId($context->get($srcrecord)); } else { $targetContext = $context; } foreach ($values["key"] as $index => $value) { $keyValue = $values["value"][$index]; $context->setEnvironment($keyValue, $targetContext->getEntityData($value)); } return "yes"; }
public function handleTask(&$context) { /* Insert here source code to execute the task */ $products = $context->exportInventory(); $products = $products['listitems']; $checked = new \Workflow\ConditionCheck(); $logger = new \Workflow\ConditionLogger(); $conditions = $this->get('condition'); $expression = $this->get('expression'); $environment = $context->getEnvironment(); foreach ($products as $product) { $productContext = \Workflow\VTEntity::getForId($product['productid'], 'Products'); $productContext->loadEnvironment($environment); $checked->setLogger($logger); $return = $checked->check($conditions, $productContext); $logs = $logger->getLogs(); $logs[] = "Complete Result: " . intval($return); $this->setStat($logs); $logger->clearLogs(); if ($return == true) { $parser = new \Workflow\ExpressionParser($expression, $productContext, false); # Last Parameter = DEBUG $parser->setVariable('quantity', $product['quantity']); $parser->setVariable('unitprice', $product['unitprice']); $parser->setVariable('discount_amount', $product['discount_amount']); $parser->setVariable('discount_percent', $product['discount_percent']); try { $parser->run(); } catch (\Workflow\ExpressionException $exp) { Workflow2::error_handler(E_EXPRESSION_ERROR, $exp->getMessage(), "", ""); } $environment = $productContext->getEnvironment(); if ($parser->getReturn() === 'stop') { break; } } } $context->loadEnvironment($environment); return "yes"; }
/** * @param $context \Workflow\VTEntity */ public function handleTask(&$context) { $values = $this->get("cols"); $srcrecord = $this->get('srcrecord'); if (empty($srcrecord) || $srcrecord == -1) { $srcrecord = 'crmid'; } if ($srcrecord !== 'crmid') { $targetContext = \Workflow\VTEntity::getForId($context->get($srcrecord)); } else { $targetContext = $context; } foreach ($values["key"] as $index => $value) { $keyValue = $values["value"][$index]; if (strpos($keyValue, '$') !== false || strpos($keyValue, '?') !== false) { $objTemplate = new VTTemplate($context); $keyValue = $objTemplate->render($keyValue); } $targetContext->addEntityData($value, $keyValue); } return "yes"; }
/** * @param $context \Workflow\VTEntity */ public function handleTask(&$context) { $recordID = trim($this->get("recordid", $context)); if (!empty($recordID) && $recordID != -1) { $contextRecord = \Workflow\VTEntity::getForId($recordID); } else { $contextRecord = $context; } $newObj = \Workflow\VTEntity::create($contextRecord->getModuleName()); $oldData = $contextRecord->getData(); foreach ($oldData as $key => $value) { $newObj->set($key, $value); } if ($contextRecord->isInventory()) { $products = $contextRecord->exportInventory(); $newObj->importInventory($products); $newObj->save(); } /* After this line, copy from Creator */ $setterMap = $this->get("setter"); if (is_array($setterMap)) { $this->fieldSetter->apply($newObj, $setterMap, $contextRecord, $this); } $newObj->save(); $context->setEnvironment("new_record_id", $newObj->getWsId(), $this); if ($this->get("redirectAfter") == "1") { $this->getWorkflow()->setSuccessRedirection("index.php?module=" . $newObj->getModuleName() . "&view=Detail&record=" . $newObj->getId()); } 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()); $objWorkflow->setContext($newContext); $objWorkflow->isSubWorkflow(true); $objWorkflow->start(); } return "yes"; }
/** * @param $context \Workflow\VTEntity|\Workflow\VTInventoryEntity */ public function handleTask(&$context) { $referenceId = $context->getId(); Workflow2::$enableError = true; $parentRecordModel = Inventory_Record_Model::getInstanceById($referenceId); $currencyInfo = $parentRecordModel->getCurrencyInfo(); $taxes = $parentRecordModel->getProductTaxes(); $shippingTaxes = $parentRecordModel->getShippingTaxes(); $relatedProducts = $parentRecordModel->getProducts(); $recordModel = Vtiger_Record_Model::getCleanInstance('Invoice'); $recordModel->setRecordFieldValues($parentRecordModel); $recordModel->save(); $newId = $recordModel->getId(); $contextRecord = $context; /** * @var $newObj \Workflow\VTEntity|\Workflow\VTInventoryEntity */ $newObj = \Workflow\VTEntity::getForId($newId); $newObj->set('hdnTaxType', $parentRecordModel->get('hdnTaxType')); $newObj->importProductsFromRecord($relatedProducts, true); $setterMap = $this->get("setter"); $this->fieldSetter->apply($newObj, $setterMap, $contextRecord, $this); $newObj->save(); if ($this->get("redirectAfter") == "1") { $this->getWorkflow()->setSuccessRedirection("index.php?module=" . $newObj->getModuleName() . "&view=Detail&record=" . $newObj->getId()); } if ($this->get("exec_workflow") !== "" && $this->get("exec_workflow") != -1) { $newContext = VTEntity::getForId($newObj->getId(), $newObj->getModuleName()); $newContext->loadEnvironment($context->getEnvironment()); $objWorkflow = new \Workflow\Main($this->get("exec_workflow"), false, $context->getUser()); $objWorkflow->isSubWorkflow(true); $objWorkflow->setContext($newContext); $objWorkflow->start(); } Workflow2::$enableError = true; }
/** * @param $context \Workflow\VTEntity * @return string */ public function handleTask(&$context) { global $adb; if ($this->get("search_module") == -1) { return "no"; } $found_rows = $this->get("found_rows"); if (empty($found_rows) || $found_rows == -1) { $found_rows = 1; } $recordsource = $this->get('recordsource'); if (empty($recordsource) || $recordsource == -1) { $recordsource = 'condition'; } $parts = explode("#~#", $this->get("search_module")); $functionName = $parts[0]; $related_module = VtUtils::getModuleName($parts[1]); $recordids = array(); if ($recordsource == 'condition') { require_once 'modules/Workflow2/VTConditionMySql.php'; $logger = new \Workflow\ConditionLogger(); $objMySQL = new \Workflow\ConditionMysql($related_module, $context); $objMySQL->setLogger($logger); $main_module = CRMEntity::getInstance($related_module); #$sqlTables = $main_module->generateReportsQuery($related_module); $sqlCondition = $objMySQL->parse($this->get("condition")); $sqlTables = $objMySQL->generateTables(); if (strlen($sqlCondition) > 3) { $sqlCondition .= " AND vtiger_crmentity.deleted = 0"; } else { $sqlCondition .= " vtiger_crmentity.deleted = 0"; } $logs = $logger->getLogs(); $this->setStat($logs); $idColumn = $main_module->table_name . "." . $main_module->table_index; $sqlQuery = "SELECT {$idColumn} as `idCol` " . $sqlTables . " WHERE " . (strlen($sqlCondition) > 3 ? $sqlCondition : ""); $sortField = $this->get("sort_field"); $sqlQuery .= ' GROUP BY crmid '; if (!empty($sortField) && $sortField != -1) { $sortDirection = $this->get("sortDirection"); $sortField = VtUtils::getColumnName($sortField); $sqlQuery .= " ORDER BY " . $sortField . " " . $sortDirection; } $numRows = $this->get("found_rows"); if (!empty($numRows) && $numRows != -1) { $sqlQuery .= " LIMIT " . $found_rows; } $this->addStat("MySQL Query: " . $sqlQuery); $result = $adb->query($sqlQuery, true); $this->addStat("num Rows: " . $adb->num_rows($result)); while ($row = $adb->fetchByAssoc($result)) { $recordids[] = $row["idcol"]; } } if ($recordsource == 'customview') { $queryGenerator = new \QueryGenerator($related_module, \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"]; } } $filterbyproduct = $this->get('filterbyproduct'); if ($filterbyproduct === 'yes') { $products = $this->get('products'); if (!empty($products)) { $sql = 'SELECT id FROM vtiger_inventoryproductrel WHERE id IN (' . generateQuestionMarks($recordids) . ') AND productid = ? GROUP BY id'; $recordids[] = $products; $result = $adb->pquery($sql, $recordids); $recordids = array(); while ($row = $adb->fetchByAssoc($result)) { $recordids[] = $row['id']; } } } $workflow_id = $this->get("workflow_id"); if (!empty($workflow_id)) { foreach ($recordids as $recordId) { $tmpContext = \Workflow\VTEntity::getForId($recordId, $related_module); $tmpContext->clearEnvironment(); $tmpContext->loadEnvironment($context->getEnvironment()); $obj = new \Workflow\Main($workflow_id, false, $context->getUser()); $obj->setExecutionTrigger($this->getWorkflow()->getExecutionTrigger()); $obj->setContext($tmpContext); $obj->isSubWorkflow(true); $obj->start(); if ($obj->getSuccessRedirection() != false) { $this->getWorkflow()->setSuccessRedirection($obj->getSuccessRedirection()); $this->getWorkflow()->setSuccessRedirectionTarget($obj->getSuccessRedirectionTarget()); } $env = $this->get("env"); if ($env !== -1 && !empty($env["result_environments"])) { $oldEnv = $context->getEnvironment($env["result_environments"]); $oldEnv[] = $tmpContext->getEnvironment(); $context->setEnvironment("result_environments", $oldEnv, $this); } } } return "yes"; }
/** * @param $context \Workflow\VTEntity */ public function handleTask(&$context) { $setterMap = $this->get("setter"); $newModule = $this->get("new_module"); if (empty($newModule)) { $this->addStat("NO Configuration set"); return "yes"; } $uniqueCheck = $this->get('uniquecheck'); $createNew = true; if ($uniqueCheck !== -1 && is_array($uniqueCheck) && !empty($uniqueCheck)) { $setterMap = $this->get('setter'); $fieldValue = $this->fieldSetter->getFieldValueArray($context, $setterMap); $condition = array(); foreach ($uniqueCheck as $checkField) { $condition[$checkField] = $fieldValue[$checkField]; } $records = \Workflow\VtUtils::findRecordIDs($newModule, $condition); if (count($records) > 0) { // duplicate records found $this->addStat('duplicate Record found [' . implode(',', $records) . '] -> do not create new'); $updateexisting = $this->get('updateexisting'); if ($updateexisting !== -1 && is_array($updateexisting) && !empty($updateexisting)) { foreach ($records as $crmid) { $entity = \Workflow\VTEntity::getForId($crmid); foreach ($updateexisting as $field) { $entity->set($field, $fieldValue[$field]); } $entity->save(); break; } } $context->setEnvironment("new_record_id", $records[0], $this); $context->setEnvironment("was_created_new", 'false', $this); $createNew = false; $newObj = \Workflow\VTEntity::getForId($records[0]); } } if ($createNew === true) { $newObj = VTEntity::create($newModule); $this->fieldSetter->apply($newObj, $setterMap, $context, $this); try { $newObj->save(); } catch (WebServiceException $exp) { // Somethink is wrong with the values. missing mandatory fields? } $context->setEnvironment("new_record_id", $newObj->getId(), $this); $context->setEnvironment("was_created_new", 'true', $this); } if ($context->getModuleName() == "Assets" && $newModule == "HelpDesk") { global $adb; $sql = "INSERT INTO vtiger_crmentityrel SET crmid = ?, module = ?, relcrmid = ?, relmodule = ?"; $adb->pquery($sql, array($context->getId(), $context->getModuleName(), $newObj->getId(), $newObj->getModuleName())); } if ($this->get("redirectAfter") == "1") { $this->getWorkflow()->setSuccessRedirection("index.php?module=" . $newModule . "&view=Detail&record=" . $newObj->getId()); } if ($this->get("exec_workflow") !== "" && $this->get("exec_workflow") != -1) { $newContext = VTEntity::getForId($newObj->getId(), $newObj->getModuleName()); $newContext->loadEnvironment($context->getEnvironment()); $objWorkflow = new \Workflow\Main($this->get("exec_workflow"), false, $context->getUser()); $objWorkflow->isSubWorkflow(true); $objWorkflow->setContext($newContext); $objWorkflow->start(); } Workflow2::$enableError = true; return "yes"; }
public function handleEvent($handlerType, $entityData) { ob_start(); $buqkvslhibra = "wfManager"; if (isset($_REQUEST["tableblocks"])) { $fcbnalas = "tableBlocks"; ${$fcbnalas} = $_REQUEST["tableblocks"]; unset($_REQUEST["tableblocks"]); } ${$buqkvslhibra} = new \Workflow\Manager(); ${"GLOBALS"}["miokdjdmdfu"] = "handlerType"; EntityDelta::refreshDelta($entityData->getModuleName(), $entityData->focus->id); if (empty($_SERVER["HTTP_X_REQUESTED_WITH"]) || strtolower($_SERVER["HTTP_X_REQUESTED_WITH"]) != "xmlhttprequest") { Workflow2::${${"GLOBALS"}["ulovgcim"]} = false; } Workflow2::log($entityData->focus->id, 0, 0, "Start EventHandler"); $snkisgyf = "tableBlocks"; if ($entityData->getModuleName() == "Emails") { ${"GLOBALS"}["wykgomknt"] = "recordid"; $blnoxjqmlwd = "from_email"; ${${"GLOBALS"}["jivgrzryssor"]} = explode("|", $entityData->get("parent_id")); if (!empty($_REQUEST["pmodule"]) && !empty($_REQUEST["sorce_ids"])) { $swvglcac = "parent_ids"; ${$swvglcac}[] = $_REQUEST["sorce_ids"]; } $lioxtho = "from_email"; ${$blnoxjqmlwd} = $entityData->get("from_email"); ${${"GLOBALS"}["bichpdpooc"]} = $entityData->get("saved_toid"); if (empty(${${"GLOBALS"}["jouqmwctl"]})) { if (!empty($_REQUEST["from_email"])) { ${"GLOBALS"}["rbujprnbgdx"] = "email_val"; ${"GLOBALS"}["fitxeffb"] = "type"; list(${${"GLOBALS"}["fitxeffb"]}, ${${"GLOBALS"}["mhnoosvdd"]}) = explode("::", addslashes($_REQUEST["from_email"]), 2); if (${${"GLOBALS"}["rbujprnbgdx"]} != "") { global $adb; if (${${"GLOBALS"}["bhmfosqagd"]} == "a") { ${"GLOBALS"}["fqvigntr"] = "sql_a"; ${"GLOBALS"}["jncqqplmd"] = "from_email"; $igxjijlcydv = "sql_a"; ${${"GLOBALS"}["fqvigntr"]} = "select * from vtiger_systems where from_email_field != ? AND server_type = ?"; ${${"GLOBALS"}["xprvdcgf"]} = $adb->pquery(${$igxjijlcydv}, array("", "email")); ${${"GLOBALS"}["jncqqplmd"]} = $adb->query_result(${${"GLOBALS"}["xprvdcgf"]}, 0, "from_email_field"); } else { ${"GLOBALS"}["evgeluzfpjrb"] = "sql_u"; ${"GLOBALS"}["jbhzfdfy"] = "sql_u"; ${${"GLOBALS"}["evgeluzfpjrb"]} = "SELECT first_name, last_name, " . ${${"GLOBALS"}["bhmfosqagd"]} . " AS email FROM vtiger_users WHERE id = '" . ${${"GLOBALS"}["mhnoosvdd"]} . "'"; ${${"GLOBALS"}["eldowmraukw"]} = $adb->pquery(${${"GLOBALS"}["jbhzfdfy"]}, array()); ${${"GLOBALS"}["jouqmwctl"]} = $adb->query_result(${${"GLOBALS"}["eldowmraukw"]}, 0, "email"); } } } else { $gpvvsxkue = "from_email"; global $current_user; ${$gpvvsxkue} = $current_user->column_fields["email1"]; } } ${${"GLOBALS"}["ijfuwupmdh"]} = array("subject" => $entityData->get("subject"), "content" => $entityData->get("description"), "from" => ${$lioxtho}, "to" => ${${"GLOBALS"}["bichpdpooc"]}); foreach (${${"GLOBALS"}["jivgrzryssor"]} as ${${"GLOBALS"}["wykgomknt"]}) { $ypgvphf = "recordid"; if (empty(${${"GLOBALS"}["oubotd"]})) { continue; } ${${"GLOBALS"}["lcnizm"]} = VTEntity::getForId(${$ypgvphf}); if (${${"GLOBALS"}["lcnizm"]} !== false) { ${"GLOBALS"}["lxtohylj"] = "workflows"; ${${"GLOBALS"}["lxtohylj"]} = $wfManager->GetWorkflows($context->getModuleName(), Workflow\Main::SENDMAIL_START); if (count(${${"GLOBALS"}["qyirwsbmmu"]}) > 0) { ${"GLOBALS"}["ccnmigsavy"] = "maildata"; $smkkdars = "wf"; $context->setEnvironment("email", ${${"GLOBALS"}["ccnmigsavy"]}); foreach (${${"GLOBALS"}["qyirwsbmmu"]} as ${$smkkdars}) { $wf->setExecutionTrigger("WF2_CREATION"); if (!$context->isAvailable()) { break; } $wf->setContext(${${"GLOBALS"}["lcnizm"]}); if ($wf->checkCondition(${${"GLOBALS"}["zltonpc"]})) { $wf->start(); } } } } } } if ($entityData->getModuleName() == "ModComments") { ${${"GLOBALS"}["iasgnhr"]} = array("commentcontent" => $entityData->get("commentcontent"), "assigned_user_id" => $entityData->get("assigned_user_id")); $tvesqluqa = "parent_ids"; ${$tvesqluqa} = array($entityData->get("related_to")); foreach (${${"GLOBALS"}["jivgrzryssor"]} as ${${"GLOBALS"}["oubotd"]}) { ${${"GLOBALS"}["lcnizm"]} = VTEntity::getForId(${${"GLOBALS"}["oubotd"]}); $context->loadEnvironment(array_merge($context->getEnvironment(), ${${"GLOBALS"}["iasgnhr"]})); if (${${"GLOBALS"}["lcnizm"]} !== false) { $fpzckemsvm = "wf"; ${${"GLOBALS"}["qyirwsbmmu"]} = $wfManager->GetWorkflows($context->getModuleName(), Workflow\Main::COMMENT_START); foreach (${${"GLOBALS"}["qyirwsbmmu"]} as ${$fpzckemsvm}) { $wwheuivbjc = "context"; $wf->setExecutionTrigger("WF2_CREATION"); if (!$context->isAvailable()) { break; } $gtfpogfmp = "entityData"; $wf->setContext(${$wwheuivbjc}); if ($wf->checkCondition(${$gtfpogfmp})) { $wf->start(); } } } } } if (${${"GLOBALS"}["miokdjdmdfu"]} == "vtiger.entity.aftersave") { $obmqbokjajz = "context"; ${$obmqbokjajz} = VTEntity::getForId($entityData->focus->id, $entityData->getModuleName()); ${"GLOBALS"}["ubninbunb"] = "wf"; ${"GLOBALS"}["jefljf"] = "context"; Queue::updateDynamicDate(${${"GLOBALS"}["jefljf"]}); ${${"GLOBALS"}["qyirwsbmmu"]} = $wfManager->GetWorkflows($entityData->getModuleName(), array(Workflow\Main::ON_FIRST_SAVE, Workflow\Main::ON_EVERY_SAVE)); ${${"GLOBALS"}["qwvmufvez"]} = $entityData->isNew(); foreach (${${"GLOBALS"}["qyirwsbmmu"]} as ${${"GLOBALS"}["ubninbunb"]}) { $uhytlcpqip = "context"; if (!$wf->checkExecuteCondition(${$uhytlcpqip})) { continue; } $wf->setExecutionTrigger(${${"GLOBALS"}["qwvmufvez"]} ? "WF2_CREATION" : "WF2_EVERY_SAVE"); Workflow2::log($entityData->focus->id, $wf->getId(), 0, "Found WF"); $fbdjnio = "isNew"; if (PHP_SAPI === "cli") { echo "Start of Workflow " . $wf->getId() . "\n"; } ${${"GLOBALS"}["lcnizm"]} = VTEntity::getForId($entityData->focus->id, $entityData->getModuleName()); $context->setIsNew(${$fbdjnio}); if (!$context->isAvailable()) { break; } $wf->setContext(${${"GLOBALS"}["lcnizm"]}); if ($wf->checkCondition(${${"GLOBALS"}["zltonpc"]})) { $wf->start(); if ($wf->getSuccessRedirection() !== false) { header("Location:" . $wf->getSuccessRedirection()); exit; } } } } if (${${"GLOBALS"}["tgrrmbvg"]} == "vtiger.entity.beforedelete") { ${${"GLOBALS"}["qyirwsbmmu"]} = $wfManager->GetWorkflows($entityData->getModuleName(), array(Workflow\Main::BEFOREDELETE_START)); foreach (${${"GLOBALS"}["qyirwsbmmu"]} as ${${"GLOBALS"}["moypxyiw"]}) { if (!$wf->checkExecuteCondition(${${"GLOBALS"}["lcnizm"]})) { continue; } $wf->setExecutionTrigger(Workflow\Main::BEFOREDELETE_START); Workflow2::log($entityData->focus->id, $wf->getId(), 0, "Found WF"); if (PHP_SAPI === "cli") { echo "Start of Workflow " . $wf->getId() . "\n"; } ${${"GLOBALS"}["lcnizm"]} = VTEntity::getForId($entityData->focus->id, $entityData->getModuleName()); $context->setIsNew(false); if (!$context->isAvailable()) { break; } $wf->setContext(${${"GLOBALS"}["lcnizm"]}); if ($wf->checkCondition(${${"GLOBALS"}["zltonpc"]})) { $wf->start(); if ($wf->getSuccessRedirection() !== false) { Workflow2::error_handler(E_NONBREAK_ERROR, "Redirections do not work on \"before delete\" triggered Workflows."); } } } } if (isset(${$snkisgyf})) { $_REQUEST["tableblocks"] = ${${"GLOBALS"}["ujnutvf"]}; } Workflow2::${${"GLOBALS"}["ihoxvzlniq"]} = false; }
public function handleTask(&$context) { $adb = \PearDatabase::getInstance(); /* Insert here source code to execute the task */ $currentTime = microtime(true); $benchmark = array(); $found_rows = $this->get("found_rows"); if (empty($found_rows) || $found_rows == -1) { $found_rows = 1; } $id = $this->get('recordid', $context); if (empty($id) || $id == -1 || !is_numeric($id)) { $targetContext = $context; } else { $targetContext = \Workflow\VTEntity::getForId($id); } $logger = new \Workflow\ConditionLogger(); $objMySQL = new \Workflow\ConditionMysql('Emails', $targetContext); $objMySQL->setLogger($logger); $sqlCondition = $objMySQL->parse($this->get("condition")); $newTime = microtime(true); $benchmark[] = round($newTime - $currentTime, 3); $currentTime = $newTime; $sqlTables = $objMySQL->generateTables(); //$sqlTables .= "\nLEFT JOIN vtiger_email_track ON(vtiger_email_track.crmid = vtiger_crmentity.crmid)"; if (strlen($sqlCondition) > 3) { $sqlCondition .= " AND vtiger_crmentity.deleted = 0 AND (vtiger_email_track.crmid IS NULL OR vtiger_email_track.crmid = " . $targetContext->getId() . ')'; } else { $sqlCondition .= " vtiger_crmentity.deleted = 0 AND (vtiger_email_track.crmid IS NULL OR vtiger_email_track.crmid = " . $targetContext->getId() . ')'; } $logs = $logger->getLogs(); $this->setStat($logs); $main_module = \CRMEntity::getInstance('Emails'); $sqlCondition .= " GROUP BY vtiger_crmentity.crmid "; $idColumn = $main_module->table_name . "." . $main_module->table_index; $sqlQuery = "SELECT {$idColumn} as `idCol`, vtiger_email_track.access_count as access_count " . $sqlTables . " WHERE " . (strlen($sqlCondition) > 3 ? $sqlCondition : ""); $sortField = $this->get("sort_field"); if (!empty($sortField) && $sortField != -1) { $sortField = VtUtils::getColumnName($sortField); $sortDirection = $this->get("sortDirection"); $sqlQuery .= " ORDER BY " . $sortField . " " . $sortDirection; } $numRows = $this->get("found_rows"); if (!empty($numRows) && $numRows != -1) { $sqlQuery .= " LIMIT " . $found_rows; } #var_dump(nl2br($sqlQuery));exit(); $this->addStat("MySQL Query: " . $sqlQuery); //echo $sqlQuery; $result = $adb->query($sqlQuery, true); $newTime = microtime(true); $benchmark[] = round($newTime - $currentTime, 3); $currentTime = $newTime; $this->addStat("num Rows: " . $adb->num_rows($result)); # If no records are found, fo other way if ($adb->num_rows($result) == 0) { return "not_found"; } while ($row = $adb->fetchByAssoc($result)) { if ($row['access_count'] > 0) { return 'yes'; } } return "no"; }
private function _checkField($check) { ${"GLOBALS"}["jddomxqeud"] = "fieldvalue"; $itxrdfjhq = "matches"; $toedvs = "check"; ${"GLOBALS"}["bjihnoa"] = "fieldvalue"; ${"GLOBALS"}["urlegth"] = "fieldvalue"; ${"GLOBALS"}["lcrgpeyzbq"] = "hasChanged"; ${"GLOBALS"}["erzkbgspclx"] = "checkvalue"; preg_match("/(\\w+)|\\(((\\w+) ?\\: \\(([_\\w]+)\\)\\)? (\\w+)\\)?)/", ${${"GLOBALS"}["ppgydjvv"]}["field"], ${$itxrdfjhq}); $gwpxykdvoch = "fieldvalue"; if (count(${${"GLOBALS"}["cneagqkui"]}) == 2) { $vinfcmby = "targetContext"; ${$vinfcmby} = $this->_context; } else { if (${${"GLOBALS"}["cneagqkui"]}[3] != "current_user") { ${"GLOBALS"}["kzitgtdwg"] = "targetContext"; ${${"GLOBALS"}["kzitgtdwg"]} = $this->_context->getReference(${${"GLOBALS"}["cneagqkui"]}[4], ${${"GLOBALS"}["cneagqkui"]}[3]); } else { ${"GLOBALS"}["gxuqhowmz"] = "targetContext"; $ummepou = "matches"; global $current_user; ${${"GLOBALS"}["gxuqhowmz"]} = \Workflow\VTEntity::getForId($current_user->id, ${$ummepou}[4]); } ${"GLOBALS"}["jxxhgoaynk"] = "check"; if (${${"GLOBALS"}["ipfzawk"]} === false) { ${"GLOBALS"}["iritosbyxswi"] = "matches"; throw new \Exception("couldn't load Reference from Record " . $this->_context->getId() . " [" . $this->_context->getModuleName() . "] (" . ${${"GLOBALS"}["iritosbyxswi"]}[3] . "->" . ${${"GLOBALS"}["cneagqkui"]}[4] . ")"); } ${${"GLOBALS"}["jxxhgoaynk"]}["field"] = ${${"GLOBALS"}["cneagqkui"]}[5]; } ${"GLOBALS"}["cjjptrxeibip"] = "check"; ${"GLOBALS"}["quwlstl"] = "fieldvalue"; $xeeymju = "checkvalue"; ${"GLOBALS"}["vbeftl"] = "fieldvalue"; if (${${"GLOBALS"}["ppgydjvv"]}["field"] == "smownerid") { ${${"GLOBALS"}["ppgydjvv"]}["field"] = "assigned_user_id"; } $yduvefukc = "checkvalue"; $obntgky = "checkvalue"; ${${"GLOBALS"}["yutgnzzt"]} = $targetContext->get(${${"GLOBALS"}["ppgydjvv"]}["field"]); ${"GLOBALS"}["qlgzdb"] = "fieldvalue"; $gfodhbqtf = "checkvalue"; $acrvuhsv = "fieldvalue"; if (${${"GLOBALS"}["ppgydjvv"]}["mode"] == "value" || empty(${${"GLOBALS"}["ppgydjvv"]}["mode"])) { ${${"GLOBALS"}["erpksbpytb"]} = ${${"GLOBALS"}["ppgydjvv"]}["rawvalue"]; ${"GLOBALS"}["cjzgraey"] = "checkvalue"; if (strpos(${${"GLOBALS"}["erpksbpytb"]}, "\$") !== false || strpos(${${"GLOBALS"}["cjzgraey"]}, "?") !== false) { $ibretppzu = "checkvalue"; ${"GLOBALS"}["tqehnnjsov"] = "objTemplate"; ${${"GLOBALS"}["tqehnnjsov"]} = new VTTemplate($this->_context); ${$ibretppzu} = $objTemplate->render(${${"GLOBALS"}["erpksbpytb"]}); } } elseif (${${"GLOBALS"}["ppgydjvv"]}["mode"] == "function") { $hjummqmcqhx = "check"; ${"GLOBALS"}["mnriwiq"] = "parser"; ${${"GLOBALS"}["mnriwiq"]} = new ExpressionParser(${$hjummqmcqhx}["rawvalue"], $this->_context, false); try { $parser->run(); } catch (ExpressionException $exp) { \Workflow2::error_handler(E_EXPRESSION_ERROR, $exp->getMessage(), "", ""); } ${${"GLOBALS"}["erpksbpytb"]} = $parser->getReturn(); } ${"GLOBALS"}["frcdhbenmj"] = "fieldvalue"; $this->log("Check field: " . ${${"GLOBALS"}["ppgydjvv"]}["field"] . " (" . ${${"GLOBALS"}["urlegth"]} . ")" . (${${"GLOBALS"}["ppgydjvv"]}["not"] == "1" ? " not" : "") . " " . ${${"GLOBALS"}["ppgydjvv"]}["operation"] . " - " . ${${"GLOBALS"}["erpksbpytb"]}); $furkdcgmptl = "fieldvalue"; ${"GLOBALS"}["uxmtblslyhk"] = "checkvalue"; switch (${${"GLOBALS"}["cjjptrxeibip"]}["operation"]) { case "equal": if (${${"GLOBALS"}["jddomxqeud"]} == ${${"GLOBALS"}["erpksbpytb"]}) { return true; } break; case "contains": if (strpos(${${"GLOBALS"}["qlgzdb"]}, ${${"GLOBALS"}["erpksbpytb"]}) !== false) { return true; } break; case "starts_with": if (strlen(${${"GLOBALS"}["yutgnzzt"]}) < strlen(${$xeeymju})) { return false; } return substr(${$furkdcgmptl}, 0, strlen(${${"GLOBALS"}["erpksbpytb"]})) == ${${"GLOBALS"}["erpksbpytb"]}; break; case "ends_with": if (strlen(${${"GLOBALS"}["yutgnzzt"]}) < strlen(${${"GLOBALS"}["uxmtblslyhk"]})) { return false; } return substr(${${"GLOBALS"}["yutgnzzt"]}, strlen(${${"GLOBALS"}["bjihnoa"]}) - strlen(${$gfodhbqtf})) == ${$yduvefukc}; break; case "has_changed": ${${"GLOBALS"}["lcrgpeyzbq"]} = \Workflow\EntityDelta::hasChanged($this->_context->getModuleName(), $this->_context->getId(), ${$toedvs}["field"]); ${${"GLOBALS"}["erpksbpytb"]} = trim(${$obntgky}); if (empty(${${"GLOBALS"}["erzkbgspclx"]})) { ${"GLOBALS"}["lxjmge"] = "hasChanged"; return ${${"GLOBALS"}["lxjmge"]}; } else { return ${${"GLOBALS"}["xdfhplmadyw"]} && ${${"GLOBALS"}["erpksbpytb"]} == ${${"GLOBALS"}["yutgnzzt"]}; } break; case "bigger": if (${${"GLOBALS"}["yutgnzzt"]} > ${${"GLOBALS"}["erpksbpytb"]}) { return true; } break; case "lower": if (${${"GLOBALS"}["quwlstl"]} < ${${"GLOBALS"}["erpksbpytb"]}) { return true; } break; case "is_empty": ${${"GLOBALS"}["yutgnzzt"]} = trim(${$acrvuhsv}, "0."); if (empty(${${"GLOBALS"}["vbeftl"]})) { return true; } break; case "date_empty": ${${"GLOBALS"}["yutgnzzt"]} = trim(${${"GLOBALS"}["yutgnzzt"]}, "."); if (empty(${$gwpxykdvoch}) || ${${"GLOBALS"}["yutgnzzt"]} == "0000-00-00") { return true; } break; case "is_checked": if (${${"GLOBALS"}["yutgnzzt"]} == "1") { return true; } break; case "is_numeric": return is_numeric(${${"GLOBALS"}["frcdhbenmj"]}); break; } return false; }
public function process(Vtiger_Request $request) { $xhqrbyal = "cu_model"; $awzoousbijac = "result"; Workflow2::${${"GLOBALS"}["fiflovy"]} = true; if (!empty($_SERVER["HTTP_X_REQUESTED_WITH"]) && strtolower($_SERVER["HTTP_X_REQUESTED_WITH"]) == "xmlhttprequest") { Workflow2::${${"GLOBALS"}["sxluqscobil"]} = true; } $aldkggvnocb = "params"; ${"GLOBALS"}["qiswqpb"] = "continueExecId"; ${${"GLOBALS"}["mlokrunke"]} = PearDatabase::getInstance(); ${"GLOBALS"}["batkhioplbv"] = "allow_parallel"; $dduumoti = "result"; ${"GLOBALS"}["aughjdxffu"] = "continueExecId"; ${$aldkggvnocb} = $request->getAll(); ${${"GLOBALS"}["fyvmsq"]} = ${$xhqrbyal} = Users_Record_Model::getCurrentUserModel(); ${"GLOBALS"}["vsxpiyis"] = "requestValues"; ${${"GLOBALS"}["batkhioplbv"]} = $request->get("allowParallel", "false") === "1"; ${${"GLOBALS"}["eeennsbvlt"]} = (int) $request->get("workflowID"); ${${"GLOBALS"}["vsxpiyis"]} = $request->get("requestValues"); ${${"GLOBALS"}["nztqmvnrgzi"]} = $request->get("requestValuesKey"); ${${"GLOBALS"}["pajxdehcky"]} = $request->get("continueExecId"); $hfvpdtq = "sql"; ${${"GLOBALS"}["qwgmpolil"]} = $request->get("continueBlockId"); if (strpos(${${"GLOBALS"}["aughjdxffu"]}, "##") !== false) { ${"GLOBALS"}["mkuklgbjodtb"] = "continueExecId"; ${"GLOBALS"}["vpmdfnx"] = "parts"; $cnibibbpik = "continueExecId"; ${${"GLOBALS"}["ukdeacyi"]} = explode("##", ${${"GLOBALS"}["mkuklgbjodtb"]}); ${$cnibibbpik} = ${${"GLOBALS"}["vpmdfnx"]}[0]; ${${"GLOBALS"}["qwgmpolil"]} = ${${"GLOBALS"}["ukdeacyi"]}[1]; } if (!empty(${${"GLOBALS"}["qiswqpb"]})) { $ohjszugmnxs = "requestValuesKey"; if (${$ohjszugmnxs} == "authPermission") { ${"GLOBALS"}["ycnxjrdysji"] = "requestValues"; ${"GLOBALS"}["zwrvvswpwb"] = "continueExecId"; $pujwrhxk = "requestValues"; ${${"GLOBALS"}["qerhyklwh"]} = $this->handleSetPermissions(${${"GLOBALS"}["zwrvvswpwb"]}, ${${"GLOBALS"}["qwgmpolil"]}, ${${"GLOBALS"}["ycnxjrdysji"]}); if (${${"GLOBALS"}["qerhyklwh"]} === false) { $this->handleReturn(); } ${${"GLOBALS"}["nztqmvnrgzi"]} = ""; ${$pujwrhxk} = ""; } ${${"GLOBALS"}["sszaqio"]} = \Workflow\Queue::getQueueEntryByExecId(${${"GLOBALS"}["pajxdehcky"]}, ${${"GLOBALS"}["qwgmpolil"]}); if (${${"GLOBALS"}["sszaqio"]} !== false) { $sdfjrtmbv = "workflow"; \Workflow\Queue::stopEntry(${$sdfjrtmbv}); ${"GLOBALS"}["vwpxff"] = "requestValuesKey"; $this->_objWorkflow = ${${"GLOBALS"}["sszaqio"]}["task"]->getWorkflow(); if (!empty(${${"GLOBALS"}["vwpxff"]})) { $cmiqvsy = "env"; ${"GLOBALS"}["qoskdafhutd"] = "workflow"; ${"GLOBALS"}["dqxzmxov"] = "env"; ${"GLOBALS"}["yfgrwwgyxjh"] = "env"; ${${"GLOBALS"}["dqxzmxov"]} = ${${"GLOBALS"}["sszaqio"]}["context"]->getEnvironment("_reqValues"); ${"GLOBALS"}["entqbm"] = "requestValues"; $cdrbilhs = "workflow"; ${$cmiqvsy}[${${"GLOBALS"}["nztqmvnrgzi"]}] = true; ${$cdrbilhs}["context"]->setEnvironment("_reqValues", ${${"GLOBALS"}["rwsybopbofy"]}); ${"GLOBALS"}["humlvehh"] = "requestValues"; ${${"GLOBALS"}["yfgrwwgyxjh"]} = ${${"GLOBALS"}["sszaqio"]}["context"]->getEnvironment("value"); if (!is_array(${${"GLOBALS"}["rwsybopbofy"]})) { ${"GLOBALS"}["kkxlfvg"] = "env"; ${${"GLOBALS"}["kkxlfvg"]} = array(); } $kvkqyovgu = "env"; ${${"GLOBALS"}["wdevzzyv"]} = ${${"GLOBALS"}["ksqrqhcnhk"]}["_fieldtype"]; ${"GLOBALS"}["dyfarxu"] = "requestValues"; unset(${${"GLOBALS"}["humlvehh"]}["_fieldtype"]); foreach (${${"GLOBALS"}["entqbm"]} as ${${"GLOBALS"}["fxeookd"]} => ${${"GLOBALS"}["bjudgmb"]}) { ${"GLOBALS"}["cwdeawsawnz"] = "fieldTypes"; ${"GLOBALS"}["bnsjdgky"] = "requestValues"; $kkuxpn = "index"; if (!empty(${${"GLOBALS"}["cwdeawsawnz"]}[${${"GLOBALS"}["fxeookd"]}])) { $ulquytqvf = "type"; ${"GLOBALS"}["pjngmgj"] = "fieldTypes"; $iwcpla = "index"; ${"GLOBALS"}["tnxyhf"] = "workflow"; ${$ulquytqvf} = \Workflow\Fieldtype::getType(${${"GLOBALS"}["wdevzzyv"]}[${$iwcpla}]); $bygtvss = "index"; ${${"GLOBALS"}["bjudgmb"]} = $type->getValue(trim(${${"GLOBALS"}["bjudgmb"]}), ${$bygtvss}, ${${"GLOBALS"}["pjngmgj"]}[${${"GLOBALS"}["fxeookd"]}], ${${"GLOBALS"}["tnxyhf"]}["context"]); } ${${"GLOBALS"}["bnsjdgky"]}[${$kkuxpn}] = trim(${${"GLOBALS"}["bjudgmb"]}); } ${$kvkqyovgu} = array_merge(${${"GLOBALS"}["rwsybopbofy"]}, ${${"GLOBALS"}["dyfarxu"]}); ${${"GLOBALS"}["qoskdafhutd"]}["context"]->setEnvironment("value", ${${"GLOBALS"}["rwsybopbofy"]}); } try { $fpunbpanmn = "workflow"; \Workflow\Queue::runEntry(${$fpunbpanmn}); } catch (\Exception $exp) { $pqrukkuo = "exp"; $this->handleReturn(${$pqrukkuo}); } $this->handleReturn(); exit; } } ${${"GLOBALS"}["jdijirbbp"]} = "SELECT * FROM vtiger_wf_settings WHERE id = ? AND active = 1"; ${$dduumoti} = \Workflow\VtUtils::pquery(${$hfvpdtq}, array(${${"GLOBALS"}["eeennsbvlt"]})); while (${${"GLOBALS"}["rmniutpwd"]} = $adb->fetch_array(${$awzoousbijac})) { ${"GLOBALS"}["ifzwgcvh"] = "user"; $exbcmtusi = "user"; if (${${"GLOBALS"}["rmniutpwd"]}["execution_user"] == "0") { ${${"GLOBALS"}["rmniutpwd"]}["execution_user"] = $current_user->id; } ${${"GLOBALS"}["dmcfeolmh"]} = new Users(); ${"GLOBALS"}["brdhenkjcoeb"] = "context"; $user->retrieveCurrentUserInfoFromFile(${${"GLOBALS"}["rmniutpwd"]}["execution_user"]); ${"GLOBALS"}["eisghylycg"] = "context"; VTEntity::setUser(${${"GLOBALS"}["ifzwgcvh"]}); $this->_objWorkflow = new \Workflow\Main(${${"GLOBALS"}["rmniutpwd"]}["id"], false, ${$exbcmtusi}); $this->_objWorkflow->setExecutionTrigger("WF2_MANUELL"); if (${${"GLOBALS"}["frhjlwprw"]} == false && $this->_objWorkflow->isRunning($_POST["crmid"])) { continue; } ${${"GLOBALS"}["brdhenkjcoeb"]} = VTEntity::getForId(intval($_POST["crmid"])); $this->_objWorkflow->setContext(${${"GLOBALS"}["eisghylycg"]}); try { $this->_objWorkflow->start(); } catch (\Exception $exp) { ${"GLOBALS"}["gikexcyv"] = "exp"; $this->handleReturn(${${"GLOBALS"}["gikexcyv"]}); } $context->save(); } $this->handleReturn(); }
/** * @param $context \Workflow\VTEntity * @return string */ public function handleTask(&$context) { global $adb; $currentTime = microtime(true); $benchmark = array(); if ($this->get("search_module") == -1) { return "no"; } $found_rows = $this->get("found_rows"); if (empty($found_rows) || $found_rows == -1) { $found_rows = 1; } $parts = explode("#~#", $this->get("search_module")); $functionName = $parts[0]; $related_module = VtUtils::getModuleName($parts[1]); $logger = new \Workflow\ConditionLogger(); $objMySQL = new \Workflow\ConditionMysql($related_module, $context); $objMySQL->setLogger($logger); $main_module = \CRMEntity::getInstance($related_module); #$sqlTables = $main_module->generateReportsQuery($related_module); if ($related_module == "Calendar") { #$sqlTables .= " LEFT JOIN vtiger_seactivityrel ON(vtiger_seactivityrel.activityid = vtiger_crmentity.crmid)"; } $sqlCondition = $objMySQL->parse($this->get("condition")); $newTime = microtime(true); $benchmark[] = round($newTime - $currentTime, 3); $currentTime = $newTime; $sqlTables = $objMySQL->generateTables(); if (strlen($sqlCondition) > 3) { $sqlCondition .= " AND vtiger_crmentity.deleted = 0"; } else { $sqlCondition .= " vtiger_crmentity.deleted = 0"; } $logs = $logger->getLogs(); $this->setStat($logs); $sqlCondition .= " GROUP BY vtiger_crmentity.crmid "; $idColumn = $main_module->table_name . "." . $main_module->table_index; $sqlQuery = "SELECT {$idColumn} as `idCol` " . $sqlTables . " WHERE " . (strlen($sqlCondition) > 3 ? $sqlCondition : ""); $sortField = $this->get("sort_field"); if (!empty($sortField) && $sortField != -1) { $sortField = VtUtils::getColumnName($sortField); $sortDirection = $this->get("sortDirection"); $sqlQuery .= " ORDER BY " . $sortField . " " . $sortDirection; } $numRows = $this->get("found_rows"); if (!empty($numRows) && $numRows != -1) { $sqlQuery .= " LIMIT " . $found_rows; } #var_dump(nl2br($sqlQuery));exit(); $this->addStat("MySQL Query: " . $sqlQuery); $result = $adb->query($sqlQuery); $newTime = microtime(true); $benchmark[] = round($newTime - $currentTime, 3); $currentTime = $newTime; $this->addStat("num Rows: " . $adb->num_rows($result)); # If no records are found, fo other way if ($adb->num_rows($result) == 0) { return "no"; } $environment = $context->getEnvironment(); while ($row = $adb->fetchByAssoc($result)) { $expression = $this->get("expression"); if (!empty($expression)) { $tmpContext = \Workflow\VTEntity::getForId($row["idcol"], $related_module); $tmpContext->loadEnvironment($environment); $parser = new \Workflow\ExpressionParser($expression, $tmpContext, false); # Last Parameter = DEBUG try { $parser->run(); } catch (ExpressionException $exp) { Workflow2::error_handler(E_EXPRESSION_ERROR, $exp->getMessage(), "", ""); } $environment = $tmpContext->getEnvironment(); } } # while $newTime = microtime(true); $benchmark[] = round($newTime - $currentTime, 3); $currentTime = $newTime; $context->loadEnvironment($environment); $this->addStat("Benchmark: " . implode("/", $benchmark)); return "yes"; }
${"GLOBALS"}["viljauoxjm"] = "user"; if (${${"GLOBALS"}["nzrzpvuahr"]}["execution_user"] == "0") { ${${"GLOBALS"}["nzrzpvuahr"]}["execution_user"] = $current_user->id; } ${"GLOBALS"}["uhixyxgidqr"] = "row"; $nrhyxmzurk = "user"; ${${"GLOBALS"}["viljauoxjm"]} = new Users(); ${"GLOBALS"}["eaiddcmebmb"] = "row"; $user->retrieveCurrentUserInfoFromFile(${${"GLOBALS"}["uhixyxgidqr"]}["execution_user"]); \Workflow\VTEntity::setUser(${$nrhyxmzurk}); ${${"GLOBALS"}["vcbzbbezhw"]} = new Workflow_Main(${${"GLOBALS"}["eaiddcmebmb"]}["id"], false, ${${"GLOBALS"}["vpcmorlu"]}); $objWorkflow->setExecutionTrigger("WF2_MANUELL"); if (${${"GLOBALS"}["bjxrkxjwht"]} == false && $objWorkflow->isRunning($_POST["crmid"])) { continue; } ${${"GLOBALS"}["suwlvvxno"]} = \Workflow\VTEntity::getForId(intval($_POST["crmid"]), $_POST["return_module"]); if (!empty(${${"GLOBALS"}["nzrzpvuahr"]}["startfields"]) && !isset($_POST["startfields"])) { ${"GLOBALS"}["djwuofnr"] = "row"; $ciuknauota = "startfields"; ${${"GLOBALS"}["ekwrlphqm"]} = unserialize(${${"GLOBALS"}["djwuofnr"]}["startfields"]); $oaeirdgf = "value"; foreach (${${"GLOBALS"}["ekwrlphqm"]} as ${${"GLOBALS"}["ohibiiqriqt"]} => ${$oaeirdgf}) { $xvdqmpgby = "startfields"; $irouxk = "key"; $eawxjdnsn = "context"; ${"GLOBALS"}["mqwzhj"] = "value"; ${${"GLOBALS"}["mqwzhj"]}["default"] = trim(VTTemplate::parse(${${"GLOBALS"}["dsqtopnzqiy"]}["default"], ${$eawxjdnsn})); ${$xvdqmpgby}[${$irouxk}] = ${${"GLOBALS"}["dsqtopnzqiy"]}; } die(json_encode(array("result" => "startfields", "workflow" => intval($_POST["workflow"]), "fields" => ${$ciuknauota}))); }
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'; }
private function _nextCommand() { $lozrvbyfsq = "tmpToken"; ${"GLOBALS"}["fugtxh"] = "nextToken"; ${"GLOBALS"}["ivokkxt"] = "pointerSet"; $iadxqnxhgs = "return"; ${"GLOBALS"}["elotedi"] = "return"; ${${"GLOBALS"}["ecrksnffs"]} = ""; $ymiviyipxguc = "varName"; ${"GLOBALS"}["tlusgjctde"] = "nextToken"; ${"GLOBALS"}["epqbdgct"] = "nextValue"; ${"GLOBALS"}["nevfbholgpi"] = "tmpToken"; $this->_debug("[+] _nextCommand"); $rdqtsvin = "tmpToken"; ${"GLOBALS"}["vvuyufcqhtbm"] = "nextToken"; $ectkdvjtif = "return"; ${"GLOBALS"}["qpcuishw"] = "nextToken"; $cvospbnpq = "nextToken"; $this->_intend++; ${${"GLOBALS"}["tlusgjctde"]} = $this->_next(); ${"GLOBALS"}["jnrorhw"] = "tmpToken"; $kjjvdtsjm = "return"; ${"GLOBALS"}["yeutulucmsw"] = "nextToken"; $uvohxszyu = "WhitelistPHPfunctions"; ${"GLOBALS"}["mopsfia"] = "return"; if (is_string(${${"GLOBALS"}["fugtxh"]})) { ${"GLOBALS"}["gnhdmktr"] = "nextToken"; $this->_debug("[+] _runString \" " . ${${"GLOBALS"}["gnhdmktr"]} . " \""); } else { ${"GLOBALS"}["xbeokfgpwi"] = "nextToken"; $eusxgvalc = "nextToken"; $this->_debug("[+] _runCommand (" . token_name(${$eusxgvalc}[0]) . ") [" . htmlentities(${${"GLOBALS"}["xbeokfgpwi"]}[1]) . "]"); } ${"GLOBALS"}["xoivtiyih"] = "tmpToken"; $this->_intend++; $hpfmevntu = "nextToken"; ${"GLOBALS"}["nuidfjdt"] = "nextToken"; $dxheqyisshuf = "return"; switch (${${"GLOBALS"}["smjmrieyre"]}[0]) { case ";": break; case T_IF: ${${"GLOBALS"}["ecrksnffs"]} = $this->_run_if(); break; case T_FOR: $this->_run_for(); break; case T_FOREACH: $this->_run_foreach(); break; case T_ARRAY: ${${"GLOBALS"}["elotedi"]} = $this->_getFunctionParameters(); break; case T_VARIABLE: if ($this->_nextByReference == true) { ${${"GLOBALS"}["ouxegbklp"]} = true; $this->_nextByReference = false; } else { $owhgnkol = "byRef"; ${$owhgnkol} = false; } ${${"GLOBALS"}["jfegcfpugk"]} = substr(${${"GLOBALS"}["smjmrieyre"]}[1], 1); ${${"GLOBALS"}["xoivtiyih"]} = $this->_next(false); ${${"GLOBALS"}["mooijwfyjld"]} = false; ${${"GLOBALS"}["uqrwidxq"]} = false; ${${"GLOBALS"}["hhvbkwwojyp"]} = false; if (${${"GLOBALS"}["bhtkwvlku"]} == "[") { $ohlmpxass = "keys"; ${"GLOBALS"}["qguhogu"] = "varPointer"; ${"GLOBALS"}["kocksoqzztmw"] = "key"; ${$ohlmpxass} = array(); $this->_debug("Array found"); while ($this->_next(false) == "[") { $this->_currentPos++; $bcdxonnnqy = "keys"; if ($this->_next(false) == "]") { $this->_currentPos++; ${${"GLOBALS"}["hhvbkwwojyp"]} = true; break; } ${$bcdxonnnqy}[] = $this->_getArrayKey(); } $hseywtew = "pointerSet"; ${$hseywtew} = true; unset(${${"GLOBALS"}["qguhogu"]}); ${"GLOBALS"}["oltlidac"] = "keys"; if (is_array($this->_variables[${${"GLOBALS"}["jfegcfpugk"]}])) { ${"GLOBALS"}["gfxvyhhpupkl"] = "varPointer"; $wvpjbxltg = "varName"; ${${"GLOBALS"}["gfxvyhhpupkl"]} =& $this->_variables[${$wvpjbxltg}]; } else { $phrugmt = "varName"; $qkfxqfme = "varPointer"; ${$qkfxqfme} = $this->_variables[${$phrugmt}]; } foreach (${${"GLOBALS"}["oltlidac"]} as ${${"GLOBALS"}["kocksoqzztmw"]}) { ${"GLOBALS"}["ybpqnr"] = "pointerSet"; $ugpmopomyu = "varPointer"; ${"GLOBALS"}["vqgjcaaybv"] = "varPointer"; if (!is_array(${${"GLOBALS"}["vqgjcaaybv"]}) && !is_string(${$ugpmopomyu})) { ${"GLOBALS"}["wcukcts"] = "varPointer"; ${${"GLOBALS"}["wcukcts"]} = array(); } ${"GLOBALS"}["wtquhryhge"] = "varPointer"; ${${"GLOBALS"}["ybpqnr"]} = true; if (!is_string(${${"GLOBALS"}["wtquhryhge"]})) { $nugjrrkmpok = "varPointer"; ${$nugjrrkmpok} =& ${${"GLOBALS"}["uqrwidxq"]}[${${"GLOBALS"}["nemslrlw"]}]; } else { ${"GLOBALS"}["tdscndapvxl"] = "varPointer"; ${"GLOBALS"}["ycxqno"] = "key"; ${${"GLOBALS"}["tdscndapvxl"]} = ${${"GLOBALS"}["uqrwidxq"]}[${${"GLOBALS"}["ycxqno"]}]; } } if (${${"GLOBALS"}["hhvbkwwojyp"]} == true) { $uxengyn = "TMPpointer"; ${"GLOBALS"}["irraxmnyl"] = "varPointer"; ${"GLOBALS"}["dgfthdgfr"] = "pointerSet"; ${$uxengyn} =& ${${"GLOBALS"}["irraxmnyl"]}; if (!is_array(${${"GLOBALS"}["xotthwv"]})) { $apeejoabt = "varPointer"; ${$apeejoabt} = array(); } $uslbcvecul = "varPointer"; $zuneceyi = "varPointer"; $nechyplhqeh = "TMPpointer"; array_push(${${"GLOBALS"}["xotthwv"]}, null); ${${"GLOBALS"}["dgfthdgfr"]} = true; ${$uslbcvecul} =& ${$nechyplhqeh}[count(${$zuneceyi}) - 1]; } } ${${"GLOBALS"}["jnrorhw"]} = $this->_next(false); if (!is_array(${${"GLOBALS"}["bhtkwvlku"]}) && ${${"GLOBALS"}["nevfbholgpi"]} == "=" || is_array(${${"GLOBALS"}["bhtkwvlku"]}) && in_array(${${"GLOBALS"}["bhtkwvlku"]}[0], array(T_PLUS_EQUAL, T_MINUS_EQUAL, T_INC, T_DEC, T_CONCAT_EQUAL))) { ${"GLOBALS"}["aigjuiyu"] = "tmpToken"; ${"GLOBALS"}["phbgymtuy"] = "varName"; $this->_debug(" # prepare Assignment [" . ${${"GLOBALS"}["phbgymtuy"]} . "]"); $this->_currentPos++; $namuhfn = "pointerSet"; $lfewjnilbiy = "tmpToken"; if (!is_array(${${"GLOBALS"}["bhtkwvlku"]}) || !in_array(${${"GLOBALS"}["bhtkwvlku"]}[0], array(T_PLUS_EQUAL, T_MINUS_EQUAL))) { ${${"GLOBALS"}["iurwqyuougta"]} = $this->_nextCommand(); } $pkakghv = "tmpToken"; ${"GLOBALS"}["uuedxxepukt"] = "tmpToken"; if (is_array(${${"GLOBALS"}["bhtkwvlku"]}) && in_array(${${"GLOBALS"}["bhtkwvlku"]}[0], array(T_PLUS_EQUAL, T_MINUS_EQUAL, T_INC, T_DEC, T_CONCAT_EQUAL))) { if (!${${"GLOBALS"}["mooijwfyjld"]}) { $cvfscduurb = "varName"; if (isset($this->_variables[${$cvfscduurb}])) { ${"GLOBALS"}["mbthldj"] = "varName"; ${"GLOBALS"}["xsrqbrosxu"] = "startvalue"; $qfwlzahw = "startvalue"; ${$qfwlzahw} = $this->_variables[${${"GLOBALS"}["mbthldj"]}]; $this->_debug(" # _getVariable [" . ${${"GLOBALS"}["jfegcfpugk"]} . "] = " . ${${"GLOBALS"}["xsrqbrosxu"]}); } } else { $cbfbtbtdw = "startvalue"; $uavejakrximm = "varPointer"; ${"GLOBALS"}["gidcvjr"] = "startvalue"; ${${"GLOBALS"}["gidcvjr"]} = ${$uavejakrximm}; $this->_debug(" # _getArrayVariable [" . ${${"GLOBALS"}["jfegcfpugk"]} . "][" . implode("][", ${${"GLOBALS"}["lpydsgizx"]}) . "] = " . ${$cbfbtbtdw}); } } else { ${"GLOBALS"}["yqcziyhs"] = "startvalue"; ${${"GLOBALS"}["yqcziyhs"]} = 0; } ${"GLOBALS"}["nhuprcgubxx"] = "tmpToken"; $bmmknrfdk = "tmpToken"; ${"GLOBALS"}["njjmwmyhqivu"] = "tmpToken"; if (is_array(${${"GLOBALS"}["uuedxxepukt"]}) && ${${"GLOBALS"}["aigjuiyu"]}[0] == T_MINUS_EQUAL) { ${${"GLOBALS"}["iurwqyuougta"]} = ${${"GLOBALS"}["swgyfxmzth"]} - $this->_nextCommand(); } elseif (is_array(${${"GLOBALS"}["nhuprcgubxx"]}) && ${${"GLOBALS"}["bhtkwvlku"]}[0] == T_PLUS_EQUAL) { $czryycobh = "startvalue"; $ykwtovsko = "valueOfVariable"; ${$ykwtovsko} = ${$czryycobh} + $this->_nextCommand(); } elseif (is_array(${${"GLOBALS"}["bhtkwvlku"]}) && ${$pkakghv}[0] == T_INC) { ${${"GLOBALS"}["iurwqyuougta"]} = ${${"GLOBALS"}["swgyfxmzth"]} + 1; } elseif (is_array(${${"GLOBALS"}["bhtkwvlku"]}) && ${$bmmknrfdk}[0] == T_DEC) { ${"GLOBALS"}["vafybu"] = "valueOfVariable"; ${${"GLOBALS"}["vafybu"]} = ${${"GLOBALS"}["swgyfxmzth"]} - 1; } elseif (is_array(${$lfewjnilbiy}) && ${${"GLOBALS"}["njjmwmyhqivu"]}[0] == T_CONCAT_EQUAL) { ${"GLOBALS"}["fyvfnboh"] = "startvalue"; ${${"GLOBALS"}["iurwqyuougta"]} = ${${"GLOBALS"}["fyvfnboh"]} . ${${"GLOBALS"}["iurwqyuougta"]}; } if (${${"GLOBALS"}["jfegcfpugk"]} == "disableFunctionlist" && ${${"GLOBALS"}["iurwqyuougta"]} == "1") { $this->_disableFunctionlist = true; } if (${${"GLOBALS"}["jfegcfpugk"]} == "loopLimit") { $this->_loopLimit = intval(${${"GLOBALS"}["iurwqyuougta"]}); } if (!${$namuhfn}) { ${"GLOBALS"}["cxaqfield"] = "valueOfVariable"; $gxkwsllvd = "varName"; $bcmwynqkolj = "valueOfVariable"; $this->_debug(" # _setVariable [" . ${$gxkwsllvd} . "] = " . serialize(${$bcmwynqkolj})); $this->_variables[${${"GLOBALS"}["jfegcfpugk"]}] = ${${"GLOBALS"}["cxaqfield"]}; } else { $doornwoojxn = "keys"; ${"GLOBALS"}["dcpmncaiijm"] = "valueOfVariable"; $this->_debug(" # _setArrayVariable [" . ${${"GLOBALS"}["jfegcfpugk"]} . "][" . implode("][", ${$doornwoojxn}) . "] = " . serialize(${${"GLOBALS"}["dcpmncaiijm"]})); ${${"GLOBALS"}["uqrwidxq"]} = ${${"GLOBALS"}["iurwqyuougta"]}; } } elseif (isset($this->_variables[${$ymiviyipxguc}]) || ${${"GLOBALS"}["ivokkxt"]}) { $tymcukjqqjn = "pointerSet"; $ddtoingl = "value"; if (!${$tymcukjqqjn}) { ${"GLOBALS"}["tsklwxpbic"] = "byRef"; if (${${"GLOBALS"}["tsklwxpbic"]} == true) { $ulbgpdmbch = "value"; $htrgguro = "varName"; ${$ulbgpdmbch} =& $this->_variables[${$htrgguro}]; } else { ${"GLOBALS"}["tpgzxthw"] = "varName"; ${${"GLOBALS"}["yppvvkhl"]} = $this->_variables[${${"GLOBALS"}["tpgzxthw"]}]; } ${"GLOBALS"}["msekjff"] = "varName"; $this->_debug(" # _getVariable " . (${${"GLOBALS"}["ouxegbklp"]} == true ? "&" : "") . "[" . ${${"GLOBALS"}["msekjff"]} . "] = " . ${${"GLOBALS"}["yppvvkhl"]}); } else { if (${${"GLOBALS"}["ouxegbklp"]} == true) { ${${"GLOBALS"}["yppvvkhl"]} =& ${${"GLOBALS"}["uqrwidxq"]}; } else { ${${"GLOBALS"}["yppvvkhl"]} = ${${"GLOBALS"}["uqrwidxq"]}; } ${"GLOBALS"}["ybxlmglc"] = "value"; $lvesokrmpp = "varName"; $this->_debug(" # _getArrayVariable " . (${${"GLOBALS"}["ouxegbklp"]} == true ? "&" : "") . "[" . ${$lvesokrmpp} . "][" . implode("][", ${${"GLOBALS"}["lpydsgizx"]}) . "] = " . ${${"GLOBALS"}["ybxlmglc"]}); } ${${"GLOBALS"}["ecrksnffs"]} = ${$ddtoingl}; } elseif (is_array(${$rdqtsvin}) && ${$lozrvbyfsq}[0] == T_OBJECT_OPERATOR) { $this->_debug(" # _getValue from reference"); $this->_currentPos++; ${${"GLOBALS"}["pkukoforc"]} = $this->_next(false); $vlibjdhsib = "tmpToken"; if (${${"GLOBALS"}["jfegcfpugk"]} != "current_user") { $eewxyfmxq = "reference"; ${$eewxyfmxq} = $this->_context->getReference(${${"GLOBALS"}["pkukoforc"]}[1], ${${"GLOBALS"}["jfegcfpugk"]}); } else { $ghfadpbsxlg = "moduleToken"; global $current_user; ${"GLOBALS"}["kxlptjcmqd"] = "reference"; ${${"GLOBALS"}["kxlptjcmqd"]} = \Workflow\VTEntity::getForId($current_user->id, ${$ghfadpbsxlg}[1]); } $this->_currentPos++; ${${"GLOBALS"}["bhtkwvlku"]} = $this->_next(false); if (is_array(${$vlibjdhsib}) && ${${"GLOBALS"}["bhtkwvlku"]}[0] == T_OBJECT_OPERATOR) { $this->_currentPos++; ${${"GLOBALS"}["bhtkwvlku"]} = $this->_next(false); $this->_currentPos++; $cbsjgsvietm = "reference"; if (${$cbsjgsvietm} instanceof \Workflow\VTEntity) { ${${"GLOBALS"}["ecrksnffs"]} = $reference->get(${${"GLOBALS"}["bhtkwvlku"]}[1]); } else { ${"GLOBALS"}["ibvuji"] = "varName"; throw new ExpressionException("No Reference defined for \$" . ${${"GLOBALS"}["ibvuji"]} . "->" . ${${"GLOBALS"}["pkukoforc"]}[1]); } } else { ${"GLOBALS"}["bzbnkdatkyi"] = "varName"; $ednfdvd = "moduleToken"; throw new ExpressionException("Error in ExpressionParser near \$" . ${${"GLOBALS"}["bzbnkdatkyi"]} . "->" . ${$ednfdvd}[1]); } } else { $ehnwgywksrqu = "varName"; ${${"GLOBALS"}["ecrksnffs"]} = $this->_context->get(${$ehnwgywksrqu}); $this->_debug(" # _getValue {$varName} = ('" . ${${"GLOBALS"}["ecrksnffs"]} . "')"); } break; case T_DNUMBER: ${$dxheqyisshuf} = ${$hpfmevntu}[1]; break; case T_STRING: if (defined(${${"GLOBALS"}["nuidfjdt"]}[1])) { ${"GLOBALS"}["suslbrxkcc"] = "return"; ${"GLOBALS"}["wlpbbwwjmcu"] = "nextToken"; $this->_debug(" # Constant Found"); ${${"GLOBALS"}["suslbrxkcc"]} = constant(${${"GLOBALS"}["wlpbbwwjmcu"]}[1]); } elseif (function_exists("VT_" . ${${"GLOBALS"}["yeutulucmsw"]}[1])) { ${"GLOBALS"}["htilgbcknyn"] = "nextToken"; ${"GLOBALS"}["kwwhqmxq"] = "parameter"; $this->_debug(" # Custom function"); ${${"GLOBALS"}["bkpqyrrc"]} = "VT_" . ${${"GLOBALS"}["htilgbcknyn"]}[1]; ${${"GLOBALS"}["kwwhqmxq"]} = $this->_getFunctionParameters(); ${${"GLOBALS"}["ecrksnffs"]} = call_user_func_array(${${"GLOBALS"}["bkpqyrrc"]}, ${${"GLOBALS"}["bgqwdo"]}); } elseif ($this->_disableFunctionlist || in_array(${${"GLOBALS"}["smjmrieyre"]}[1], self::${$uvohxszyu}) || substr(${${"GLOBALS"}["smjmrieyre"]}[1], 0, 3) == "str" || substr(${${"GLOBALS"}["smjmrieyre"]}[1], 0, 5) == "array" || substr(${${"GLOBALS"}["smjmrieyre"]}[1], 0, 3) == "wf_" || substr(${$cvospbnpq}[1], 0, 5) == "array") { ${"GLOBALS"}["ogicmoozpk"] = "return"; $uqqxqfo = "parameter"; $nyryztd = "parameter"; $this->_debug(" # Whitelisted PHP Function"); ${$uqqxqfo} = $this->_getFunctionParameters(); ${${"GLOBALS"}["ogicmoozpk"]} = call_user_func_array(${${"GLOBALS"}["smjmrieyre"]}[1], ${$nyryztd}); } break; case "-": ${${"GLOBALS"}["epqbdgct"]} = $this->_next(); ${${"GLOBALS"}["ecrksnffs"]} = -1 * ${${"GLOBALS"}["hijlvmcdgwxx"]}[1]; break; case "&": $this->_nextByReference = true; break; case "(": ${$ectkdvjtif} = $this->_nextCommand(); $this->_currentPos++; break; case ")": $this->_debug(" RETURN Brackets ['" . ${${"GLOBALS"}["ecrksnffs"]} . "']"); $this->_intend--; $this->_intend--; return ${${"GLOBALS"}["ecrksnffs"]}; break; case T_LNUMBER: ${${"GLOBALS"}["ecrksnffs"]} = floatval(${${"GLOBALS"}["qpcuishw"]}[1]); break; case T_CONSTANT_ENCAPSED_STRING: if ((substr(${${"GLOBALS"}["vvuyufcqhtbm"]}[1], 0, 1) == "'" || substr(${${"GLOBALS"}["smjmrieyre"]}[1], 0, 1) == "\"") && substr(${${"GLOBALS"}["smjmrieyre"]}[1], -1, 1) == substr(${${"GLOBALS"}["smjmrieyre"]}[1], 0, 1)) { ${"GLOBALS"}["sxrnfrqjwot"] = "nextToken"; $erquyuglovc = "nextToken"; ${$erquyuglovc}[1] = trim(${${"GLOBALS"}["sxrnfrqjwot"]}[1], "'" . "\""); } ${${"GLOBALS"}["ecrksnffs"]} = ${${"GLOBALS"}["smjmrieyre"]}[1]; break; case T_RETURN: ${${"GLOBALS"}["mopsfia"]} = $this->_nextCommand(); $this->_setReturn(${$kjjvdtsjm}); break; case T_COMMENT: ${${"GLOBALS"}["ecrksnffs"]} = $this->_nextCommand(); break; case T_IS_NOT_IDENTICAL: case T_IS_IDENTICAL: case T_IS_EQUAL: case T_IS_GREATER_OR_EQUAL: case T_IS_IDENTICAL: case T_IS_NOT_EQUAL: case T_IS_NOT_IDENTICAL: case T_IS_SMALLER_OR_EQUAL: $this->_currentPos--; ${${"GLOBALS"}["ecrksnffs"]} = false; break; default: break; } $this->_debug(" potential next: " . $this->_next(false)); if ($this->_next(false) == ".") { $this->_currentPos++; $this->_debug("[ ] _foundCombination"); ${${"GLOBALS"}["ecrksnffs"]} .= $this->_nextCommand(); } $this->_intend--; ${${"GLOBALS"}["bhtkwvlku"]} = $this->_next(false); if (in_array(${${"GLOBALS"}["bhtkwvlku"]}, array("+", "-", "*", "/", "^"))) { ${"GLOBALS"}["tmfcflcod"] = "valueOfVariable"; $fidrdtwvtj = "return"; $this->_debug(" found Operation"); $this->_currentPos++; ${"GLOBALS"}["lvafdnktq"] = "return"; $izmmitb = "return"; $ibtwtqohusd = "valueOfVariable"; ${${"GLOBALS"}["tmfcflcod"]} = $this->_nextCommand(); if (empty(${${"GLOBALS"}["lvafdnktq"]})) { ${"GLOBALS"}["gbdiglgk"] = "return"; ${${"GLOBALS"}["gbdiglgk"]} = 0; } if (empty(${$ibtwtqohusd})) { ${${"GLOBALS"}["iurwqyuougta"]} = 0; } $this->_debug(" run Operation ('return " . ${${"GLOBALS"}["ecrksnffs"]} . " " . ${${"GLOBALS"}["bhtkwvlku"]} . " " . ${${"GLOBALS"}["iurwqyuougta"]} . ";')"); ${$fidrdtwvtj} = eval("return " . ${$izmmitb} . " " . ${${"GLOBALS"}["bhtkwvlku"]} . " " . ${${"GLOBALS"}["iurwqyuougta"]} . ";"); } $this->_intend--; $this->_debug("[-] _nextCommand ['" . htmlentities(${$iadxqnxhgs} . "") . "']"); return ${${"GLOBALS"}["ecrksnffs"]}; }
*/ ${"GLOBALS"}["omitoiwbily"] = "inventory"; ${"GLOBALS"}["nbujmfscax"] = "ready"; ${"GLOBALS"}["jjemmmaxbrt"] = "totalCount"; ${"GLOBALS"}["mgvbbye"] = "readyCount"; ${"GLOBALS"}["rgwdesma"] = "current_user"; ${"GLOBALS"}["ujlyjr"] = "obj"; ${"GLOBALS"}["awtujqewd"] = "vtiger_current_version"; ${"GLOBALS"}["udgfxkl"] = "adb"; ${"GLOBALS"}["jemxpwer"] = "inventory"; chdir(dirname(__FILE__) . "/../../"); ${"GLOBALS"}["qgaqguhb"] = "paket_no"; if (!isset(${${"GLOBALS"}["udgfxkl"]}) && !isset(${${"GLOBALS"}["awtujqewd"]})) { require_once "include/utils/utils.php"; require_once "config.inc.php"; } require_once dirname(__FILE__) . "/autoload_wf.php"; ${${"GLOBALS"}["ujlyjr"]} = new \Workflow\Execute(); ${"GLOBALS"}["adqdjibr"] = "current_lieferschein_nr"; $zubuksbqco = "env"; $obj->setUser(${${"GLOBALS"}["rgwdesma"]}); $barttygejsj = "item"; $obj->setRecord(intval($_POST["crmid"])); $obj->setEnvironment(array("lieferscheinNR" => ${${"GLOBALS"}["adqdjibr"]}, "readyCount" => ${${"GLOBALS"}["mgvbbye"]}, "totalCount" => ${${"GLOBALS"}["jjemmmaxbrt"]}, "paket_no" => ${${"GLOBALS"}["qgaqguhb"]}, "ready" => ${${"GLOBALS"}["nbujmfscax"]} ? 1 : 0)); $obj->runByTrigger("KW_GEN_LIEFERSCHEIN"); ${$zubuksbqco} = $obj->getEnvironment(); require_once "modules/Workflow2/autoload_wf.php"; ${${"GLOBALS"}["ujlyjr"]} = \Workflow\VTEntity::getForId($_POST["crmid"]); ${${"GLOBALS"}["omitoiwbily"]} = $obj->exportInventory(); ${$barttygejsj} = ${${"GLOBALS"}["jemxpwer"]}["listitems"][$_POST["sequence_no"] - 1]["quantity"] -= intval($_POST["quantity"]); $obj->importInventory(${${"GLOBALS"}["omitoiwbily"]});
public function getData() { global $current_user, $adb; if ($this->_isDummy) { return array(); } require_once "include/Webservices/Retrieve.php"; if ($this->_data === false) { $this->prepareTransfer(); try { ${"GLOBALS"}["llqaplcgvqji"] = "focus"; ${"GLOBALS"}["mpkkwk"] = "value"; ${${"GLOBALS"}["llqaplcgvqji"]} = CRMEntity::getInstance($this->getModuleName()); $focus->id = $this->_id; $focus->mode = "edit"; $focus->retrieve_entity_info($this->_id, $this->getModuleName()); $this->_data = $focus->column_fields; global $default_charset; foreach ($this->_data as ${${"GLOBALS"}["hjgwjtwk"]} => ${${"GLOBALS"}["mpkkwk"]}) { ${"GLOBALS"}["yulwolkgh"] = "value"; ${"GLOBALS"}["dnbqbcum"] = "default_charset"; ${"GLOBALS"}["vthigzjdn"] = "key"; $this->_data[${${"GLOBALS"}["vthigzjdn"]}] = html_entity_decode(${${"GLOBALS"}["yulwolkgh"]}, ENT_QUOTES, ${${"GLOBALS"}["dnbqbcum"]}); } unset($this->_data["record_id"]); unset($this->_data["record_module"]); } catch (Exception $exp) { if ($exp->getCode() == "DATABASE_QUERY_ERROR") { ${"GLOBALS"}["qglcvkqvwr"] = "handleResult"; global $adb; ${${"GLOBALS"}["qglcvkqvwr"]} = $this->_handleDatabaseError($adb->database->_errorMsg); $this->_data = array(); } elseif ($exp->getCode() == "ACCESS_DENIED" && $exp->getMessage() == "Permission to perform the operation is denied") { ${"GLOBALS"}["sqrdnhy"] = "checkTMP"; $cppqwvwr = "sql"; $mmhuggchzhfn = "entity"; ${${"GLOBALS"}["clnussj"]} = "SELECT setype FROM vtiger_crmentity WHERE crmid = " . $this->_id; ${"GLOBALS"}["djapdqi"] = "checkTMP"; ${${"GLOBALS"}["djapdqi"]} = $adb->query(${$cppqwvwr}); if ($adb->num_rows(${${"GLOBALS"}["wsgxnekqfc"]}) == 0) { $this->_data = array(); return array(); } if ($adb->query_result(${${"GLOBALS"}["sqrdnhy"]}, 0, "setype") != $this->getModuleName()) { ${"GLOBALS"}["ifgfywl"] = "checkTMP"; \Workflow2::error_handler(E_NONBREAK_ERROR, "You want to get a field from " . $this->getModuleName() . " Module, but the ID is from module " . $adb->query_result(${${"GLOBALS"}["ifgfywl"]}, 0, "setype") . ".", $exp->getFile(), $exp->getLine()); $this->_data = array(); return array(); } ${$mmhuggchzhfn} = VTEntity::getForId($this->_id); } else { \Workflow2::error_handler($exp->getCode(), $exp->getMessage() . " for UserID " . $useUser->id, $exp->getFile(), $exp->getLine()); } } $this->afterTransfer(); if ($this->_moduleName == "Emails") { require_once "include/Zend/Json.php"; ${"GLOBALS"}["nfuoksa"] = "to_email"; ${"GLOBALS"}["sjyerqz"] = "result"; \Zend_Json::${${"GLOBALS"}["bqlurhboofif"]} = false; ${"GLOBALS"}["cwsctpcyru"] = "result"; $flflobg = "to_email"; ${${"GLOBALS"}["clnussj"]} = "SELECT * FROM vtiger_emaildetails WHERE emailid = " . $this->getId(); ${"GLOBALS"}["yqjqdgs"] = "to_email"; ${${"GLOBALS"}["orgnykvnkpk"]} = $adb->query(${${"GLOBALS"}["clnussj"]}); ${${"GLOBALS"}["nfuoksa"]} = $adb->query_result(${${"GLOBALS"}["sjyerqz"]}, 0, "to_email"); if (is_array(${${"GLOBALS"}["otvuyvqjwmp"]}) || is_object(${${"GLOBALS"}["yqjqdgs"]})) { ${"GLOBALS"}["nrzvpozio"] = "to_email"; throw new \Exception("Wrong input \$to_email=" . serialize(${${"GLOBALS"}["nrzvpozio"]})); } $this->_data["saved_to"] = implode(",", \Zend_Json::decode(html_entity_decode(${$flflobg}))); $this->_data["from_email"] = $adb->query_result(${${"GLOBALS"}["cwsctpcyru"]}, 0, "from_email"); } if ($this->_moduleName == "Products" || $this->_moduleName == "Services") { ${"GLOBALS"}["wqqymmgwcbh"] = "recordModel"; ${"GLOBALS"}["dyjbrolqfou"] = "taxes"; ${"GLOBALS"}["pejxwiaf"] = "tax"; ${${"GLOBALS"}["wqqymmgwcbh"]} = \Vtiger_Record_Model::getInstanceById($this->getId(), $this->getModuleName()); $ouiexujo = "taxes"; ${${"GLOBALS"}["dyjbrolqfou"]} = $recordModel->getTaxClassDetails(); foreach (${$ouiexujo} as ${${"GLOBALS"}["pejxwiaf"]}) { if (${${"GLOBALS"}["hhqfiefqdlh"]}["check_value"] == "1") { $this->_data[${${"GLOBALS"}["hhqfiefqdlh"]}["check_name"]] = "on"; $this->_data[${${"GLOBALS"}["hhqfiefqdlh"]}["taxname"]] = ${${"GLOBALS"}["hhqfiefqdlh"]}["percentage"]; } } } if ($this->_moduleName == "SalesOrder" && $this->_data["enable_recurring"] == "0") { $this->_data["invoicestatus"] = "AutoCreated"; } } return $this->_data; }
public function getConnectedObjects($connection) { global $adb, $current_user; $kryexcyqv = "connection"; require_once "modules/Workflow2/lib/Workflow/VTEntity.php"; $zhzrdig = "returns"; $gsutapau = "returns"; $qqmbegh = "result"; ${"GLOBALS"}["qxpxrsw"] = "result"; require_once "modules/Workflow2/VTEntityMap.php"; $dxtphjevl = "sql"; if (VTEntity::getUser(${${"GLOBALS"}["bqcqwqztsmvp"]}) === false) { $tnfwjcgygnp = "current_user"; VTEntity::setUser(${$tnfwjcgygnp}); } ${$dxtphjevl} = "SELECT *\n FROM vtiger_wfp_connections\n LEFT JOIN vtiger_wfp_objects ON(vtiger_wfp_objects.id = vtiger_wfp_connections.source_id)\n WHERE deleted = 0 AND destination_id = ? AND destination_key = ?"; ${${"GLOBALS"}["qxpxrsw"]} = \Workflow\VtUtils::pquery(${${"GLOBALS"}["ulkocil"]}, array($this->getBlockId(), strtolower(${$kryexcyqv}))); ${$zhzrdig} = array(); while (${${"GLOBALS"}["lbujtjnghu"]} = $adb->fetch_array(${$qqmbegh})) { ${"GLOBALS"}["ixlpntqeg"] = "row"; if (!empty(${${"GLOBALS"}["ixlpntqeg"]}["crmid"])) { ${"GLOBALS"}["igbdjvjxfgk"] = "row"; ${${"GLOBALS"}["lkabymgowvb"]}[] = VTEntity::getForId(${${"GLOBALS"}["igbdjvjxfgk"]}["crmid"], ${${"GLOBALS"}["lbujtjnghu"]}["module_name"]); } } return new VTEntityMap(${$gsutapau}); }
public function handleTask(&$context) { /** Copied from WfTaskDuplicateRecord */ /** * @var $contextRecord VTInventoryEntity */ $contextRecord = $context; $newObj = \Workflow\VTEntity::create($contextRecord->getModuleName()); $oldData = $contextRecord->getData(); //var_dump($oldData); foreach ($oldData as $key => $value) { $newObj->set($key, $value); } //$newObj->set('hdnDiscountPercent', -1 * $oldData['hdnDiscountPercent']); $newObj->set('hdnDiscountAmount', -1 * $oldData['hdnDiscountAmount']); /** Copied from WfTaskDuplicateRecord ENDE */ $products = $contextRecord->exportInventory(); foreach ($products["listitems"] as $index => $listitem) { $listitem["quantity"] *= -1; $listitem['discount_amount'] *= -1; $products["listitems"][$index] = $listitem; } $products["shippingCost"] *= -1; $newObj->importInventory($products); /* After this line, copy from Creator */ $setterMap = $this->get("setter"); $this->fieldSetter->apply($newObj, $setterMap, $contextRecord, $this); $products = $this->get("product"); /* INSERT PRODUCT */ if (is_array($products) && count($products) > 0) { $availTaxes = getAllTaxes("available"); foreach ($products as $index => $value) { if (!empty($value["productid_individual"])) { $productid = VTTemplate::parse($value["productid_individual"], $context); } else { $productid = $value["productid"]; } if (strpos($productid, "x") !== false) { $parts = explode("x", $productid); $productid = $parts[1]; } $crmProduct = CRMEntity::getInstance("Products"); $crmProduct->id = $productid; $crmProduct->retrieve_entity_info($productid, "Products"); $context->setEnvironment("product", $crmProduct->column_fields); foreach ($value as $key => $template) { $value[$key] = VTTemplate::parse($template, $context); } $tax = array(); foreach ($availTaxes as $aTax) { if ($value["tax" . $aTax["taxid"] . "_enable"] == 1) { $tax[$aTax["taxid"]] = VTTemplate::parse($value["tax" . $aTax["taxid"]], $context); } } $this->addStat("AddProduct " . $value["quantity"] . " x " . $productid . " (" . $value["unitprice"] . ")"); $newObj->addProduct($productid, $value["description"], $value["comment"], $value["quantity"], $value["unitprice"], $value["discount_mode"] == "percentage" ? $value["discount_value"] : 0, $value["discount_mode"] == "amount" ? $value["discount_value"] : 0, $tax); } try { $newObj->save(); } catch (WebServiceException $exp) { // Somethink is wrong with the values. missing mandatory fields? } } 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()); } 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()); $objWorkflow->setContext($newContext); $objWorkflow->isSubWorkflow(true); $objWorkflow->start(); } return "yes"; }
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})); }
function wf_changedfields($crmid, $internalFields = false) { if (empty($crmid)) { return false; } $objRecord = \Workflow\VTEntity::getForId($crmid); return \Workflow\EntityDelta::changeFields($objRecord->getModuleName(), $crmid, $internalFields); }
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 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 handle($data) { $iuehdakvoje = "ipParts"; ${"GLOBALS"}["unilynnueob"] = "environment"; $ycodjgp = "redirect"; ${"GLOBALS"}["lpnulgd"] = "response"; ${"GLOBALS"}["mvxrxro"] = "ipParts"; $wghwmdry = "ip"; $lwrykskv = "ipParts"; $ryudrroeulb = "adb"; ${"GLOBALS"}["xlirlgfme"] = "ipParts"; ${"GLOBALS"}["atmyvwso"] = "ipParts"; ${"GLOBALS"}["hirbqakfku"] = "ipParts"; ${"GLOBALS"}["hrwkpguwax"] = "ipParts"; $zelgofezen = "executionMode"; $ibhtcitid = "executionMode"; ${$ryudrroeulb} = PearDatabase::getInstance(); ${${"GLOBALS"}["rmrewmoru"]} = $_SERVER["REMOTE_ADDR"]; ${${"GLOBALS"}["xlirlgfme"]} = explode(".", ${$wghwmdry}); ${${"GLOBALS"}["ytoiwy"]} = "SELECT * FROM vtiger_wf_http_limits_ips WHERE `ip` LIKE '" . ${${"GLOBALS"}["otplryj"]}[0] . ".%' OR `ip` LIKE '" . ${${"GLOBALS"}["atmyvwso"]}[0] . "." . ${${"GLOBALS"}["otplryj"]}[1] . ".%' OR `ip` LIKE '" . ${${"GLOBALS"}["hrwkpguwax"]}[0] . "." . ${${"GLOBALS"}["hirbqakfku"]}[1] . "." . ${$iuehdakvoje}[2] . ".%' OR `ip` LIKE '" . ${${"GLOBALS"}["otplryj"]}[0] . "." . ${${"GLOBALS"}["mvxrxro"]}[1] . "." . ${${"GLOBALS"}["otplryj"]}[2] . "." . ${$lwrykskv}[3] . "%'"; ${${"GLOBALS"}["zlijsv"]} = $adb->query(${${"GLOBALS"}["ytoiwy"]}); if ($adb->num_rows(${${"GLOBALS"}["zlijsv"]}) == 0) { $mnyrtecg = "ip"; die("ACCESS_DENIED for " . ${$mnyrtecg}); } else { $ywpnubj = "accessCheckResult"; $psnscwubwfj = "row"; while (${$psnscwubwfj} = $adb->fetchByAssoc(${$ywpnubj})) { $ntiiyfpbov = "ip"; $fsgwwvvoi = "row"; if (${${"GLOBALS"}["bjowfug"]}["ip"] == ${$ntiiyfpbov}) { $iiriyjh = "row"; $this->_addPermissionLimitID(${$iiriyjh}["limit_id"]); } elseif (preg_match("/\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b/", ${$fsgwwvvoi}["ip"])) { continue; } elseif (\Workflow\IPCheck::ip_in_range(${${"GLOBALS"}["rmrewmoru"]}, ${${"GLOBALS"}["bjowfug"]}["ip"])) { $this->_addPermissionLimitID(${${"GLOBALS"}["bjowfug"]}["limit_id"]); } } } if (count($this->_access) == 0) { $tbzoxrju = "ip"; die("ACCESS_DENIED for " . ${$tbzoxrju}); } ${${"GLOBALS"}["huhdmgofik"]} = intval($_REQUEST["record_id"]); $zvfkgvoegv = "record_id"; ${$ibhtcitid} = "none"; ${"GLOBALS"}["kybozx"] = "key"; if (!empty(${$zvfkgvoegv})) { ${"GLOBALS"}["hrlijwlhcn"] = "context"; ${${"GLOBALS"}["hrlijwlhcn"]} = \Workflow\VTEntity::getForId(${${"GLOBALS"}["huhdmgofik"]}); } else { $xvhpmjj = "context"; ${$xvhpmjj} = \Workflow\VTEntity::getDummy(); } if (!empty($_REQUEST["workflow_trigger"])) { ${"GLOBALS"}["xctyelrs"] = "moduleName"; ${"GLOBALS"}["yqkcoxdf"] = "result"; ${${"GLOBALS"}["gfryhuwwv"]} = $_REQUEST["workflow_trigger"]; ${${"GLOBALS"}["xctyelrs"]} = $_REQUEST["module"]; ${${"GLOBALS"}["ktxrdqs"]} = getTabid(${${"GLOBALS"}["ftxydrclssf"]}); if (empty(${${"GLOBALS"}["ktxrdqs"]})) { die("MODULE_NOT_FOUND"); } $nbjyypn = "trigger"; ${"GLOBALS"}["kguaplly"] = "sql"; ${"GLOBALS"}["kigvfsullx"] = "sql"; ${${"GLOBALS"}["kguaplly"]} = "SELECT id, `key` FROM vtiger_wf_trigger WHERE `key` = ? AND deleted = 0 AND custom = 1"; ${"GLOBALS"}["osommxjcsyi"] = "result"; ${${"GLOBALS"}["osommxjcsyi"]} = $adb->pquery(${${"GLOBALS"}["kigvfsullx"]}, array(${${"GLOBALS"}["gfryhuwwv"]})); if ($adb->num_rows(${${"GLOBALS"}["yqkcoxdf"]}) == 0) { die("TRIGGER_NOT_FOUND"); } else { $lburvvv = "trigger"; ${"GLOBALS"}["yicgxdyyt"] = "executionMode"; ${"GLOBALS"}["qkwltubetoqt"] = "result"; ${${"GLOBALS"}["yicgxdyyt"]} = "trigger"; ${$lburvvv} = $adb->query_result(${${"GLOBALS"}["qkwltubetoqt"]}, 0, "key"); } if (!in_array(${$nbjyypn}, $this->_access["trigger"])) { ${"GLOBALS"}["trjabrrpbx"] = "ip"; die("ACCESS_DENIED for " . ${${"GLOBALS"}["trjabrrpbx"]}); } } if (!empty($_REQUEST["workflow_id"])) { $xmhjbyf = "result"; ${"GLOBALS"}["olldewfcyyph"] = "workflow_id"; ${"GLOBALS"}["xbvnzv"] = "record_id"; ${"GLOBALS"}["ajdhuvevtz"] = "sql"; ${${"GLOBALS"}["uauipqs"]} = intval($_REQUEST["workflow_id"]); ${${"GLOBALS"}["ajdhuvevtz"]} = "SELECT id, title FROM vtiger_wf_settings WHERE id = ? AND active = 1"; $ymdspopx = "values"; ${${"GLOBALS"}["qfzfncwih"]} = array(${${"GLOBALS"}["olldewfcyyph"]}); if (!empty(${${"GLOBALS"}["xbvnzv"]})) { ${"GLOBALS"}["dvocdfmhiudc"] = "values"; ${${"GLOBALS"}["ytoiwy"]} .= " AND module_name = ?"; ${${"GLOBALS"}["dvocdfmhiudc"]}[] = $context->getModuleName(); } ${${"GLOBALS"}["ylgtydnyihg"]} = $adb->pquery(${${"GLOBALS"}["ytoiwy"]}, ${$ymdspopx}, true); if ($adb->num_rows(${$xmhjbyf}) == 0) { die("WORKFLOW_NOT_FOUND"); } else { ${"GLOBALS"}["eqjbaqoa"] = "workflow_id"; ${${"GLOBALS"}["gfuwwgd"]} = "id"; ${${"GLOBALS"}["eqjbaqoa"]} = $adb->query_result(${${"GLOBALS"}["ylgtydnyihg"]}, 0, "id"); } if (!in_array(${${"GLOBALS"}["uauipqs"]}, $this->_access["id"])) { ${"GLOBALS"}["xettocrqrd"] = "ip"; die("ACCESS_DENIED for " . ${${"GLOBALS"}["xettocrqrd"]}); } } if (${$zelgofezen} == "none") { die("You must specify workflow_trigger or workflow_id"); } $uzssajc = "user"; unset($_REQUEST["id"]); unset($_REQUEST["record_id"]); unset($_REQUEST["workflow_trigger"]); ${"GLOBALS"}["emwrrxerow"] = "environment"; unset($_REQUEST["workflow_id"]); unset($_REQUEST["module"]); ${${"GLOBALS"}["unilynnueob"]} = array(); foreach ($_REQUEST as ${${"GLOBALS"}["kybozx"]} => ${${"GLOBALS"}["dqqzxcrvdif"]}) { ${"GLOBALS"}["bqlddraey"] = "environment"; ${${"GLOBALS"}["bqlddraey"]}[${${"GLOBALS"}["trlypsbsmpu"]}] = $this->strip_tags_deep(${${"GLOBALS"}["dqqzxcrvdif"]}); } $context->loadEnvironment(${${"GLOBALS"}["emwrrxerow"]}); if (!empty($_FILES)) { ${"GLOBALS"}["akrrrvsfekjk"] = "filekey"; foreach ($_FILES as ${${"GLOBALS"}["akrrrvsfekjk"]} => ${${"GLOBALS"}["jsgnxbqw"]}) { ${"GLOBALS"}["srxobtcs"] = "file"; $prnnmlzg = "file"; $context->addTempFile(${$prnnmlzg}["tmp_name"], ${${"GLOBALS"}["behmwxmdhewk"]}, ${${"GLOBALS"}["srxobtcs"]}["name"]); } } ${${"GLOBALS"}["inzmevwvq"]} = Users::getActiveAdminUser(); \Workflow\VTEntity::setUser(${$uzssajc}); ob_start(); if (${${"GLOBALS"}["gfuwwgd"]} == "id") { ${"GLOBALS"}["xbhpjnuesvy"] = "workflow_id"; ${"GLOBALS"}["xdizreur"] = "context"; ${${"GLOBALS"}["uxfgwct"]} = new \Workflow\Main(${${"GLOBALS"}["xbhpjnuesvy"]}, false, ${${"GLOBALS"}["inzmevwvq"]}); $objWorkflow->setContext(${${"GLOBALS"}["xdizreur"]}); $objWorkflow->start(); $rugpwzh = "redirect"; ${$rugpwzh} = $objWorkflow->getSuccessRedirection(); } if (${${"GLOBALS"}["gfuwwgd"]} == "trigger") { ${"GLOBALS"}["buepdhri"] = "wfManager"; $dkllbyi = "trigger"; $vmbyvjusnw = "moduleName"; $elubssx = "workflows"; ${${"GLOBALS"}["buepdhri"]} = new \Workflow\Manager(); ${"GLOBALS"}["ztxpyfldus"] = "workflows"; ${${"GLOBALS"}["dfkeynth"]} = $wfManager->GetWorkflows(${$vmbyvjusnw}, ${$dkllbyi}); if (is_array(${$elubssx}) && count(${${"GLOBALS"}["ztxpyfldus"]}) > 0) { ${"GLOBALS"}["fdpphxg"] = "workflows"; $jdseehx = "wf"; foreach (${${"GLOBALS"}["fdpphxg"]} as ${$jdseehx}) { $hviqvlaxyaqh = "tmpRedirect"; ${"GLOBALS"}["mgliozkdag"] = "context"; if (!$context->isAvailable()) { break; } $wf->setContext(${${"GLOBALS"}["mgliozkdag"]}); $wf->start(); ${${"GLOBALS"}["ajehahie"]} = $wf->getSuccessRedirection(); if (!empty(${$hviqvlaxyaqh})) { ${"GLOBALS"}["baxyrwouy"] = "redirect"; ${${"GLOBALS"}["baxyrwouy"]} = ${${"GLOBALS"}["ajehahie"]}; } } } } ${${"GLOBALS"}["yeqmruvbnw"]} = ob_get_clean(); echo json_encode(array("result" => "ok", "response" => ${${"GLOBALS"}["lpnulgd"]}, "redirect" => ${$ycodjgp})); }
/** * @param $context VTEntity */ public function handleTask(&$context) { if (!getTabid('PDFMaker') || !vtlib_isModuleActive('PDFMaker')) { return 'yes'; } global $adb, $current_user, $log, $root_directory; // PDFMaker greift auf Datenbank zurück. Daher zuerst speichern! $context->save(); $userId = $context->get('assigned_user_id'); if ($userId === null) { $userId = vtws_getWebserviceEntityId('Users', 1); } $moduleName = $context->getModuleName(); $id = $context->getId(); list($id2, $assigned_user_id) = explode("x", $userId); $parentid = $id; require_once 'modules/Documents/Documents.php'; $focus = new \Documents(); $focus->parentid = $parentid; $modFocus = $context->getInternalObject(); $templateid = $this->template; $this->folder = 1; $foldername = $adb->getOne("SELECT foldername FROM vtiger_attachmentsfolder WHERE folderid='" . $this->folder . "'", 0, "foldername"); $fieldname = $adb->getOne("SELECT fieldname FROM vtiger_field WHERE uitype=4 AND tabid=" . getTabId($moduleName), 0, "fieldname"); /* new PDFMaker Routine */ $PDFMaker = new PDFMaker_PDFMaker_Model(); if (isset($modFocus->column_fields[$fieldname]) && $modFocus->column_fields[$fieldname] != "") { $file_name = $PDFMaker->generate_cool_uri($modFocus->column_fields[$fieldname]) . ".pdf"; } else { $file_name = generate_cool_uri($foldername . "_" . $templateid . $focus->parentid . date("ymdHi")) . ".pdf"; } $this->addStat("Attach Document '" . $file_name . "'"); $docTitle = $this->get("documenttitle", $context); $docDescr = $this->get("documentdescr", $context); $focus->column_fields['notes_title'] = $docTitle; $focus->column_fields['assigned_user_id'] = $assigned_user_id; $focus->column_fields['filename'] = $file_name; $focus->column_fields['notecontent'] = $docDescr; $focus->column_fields['filetype'] = 'application/pdf'; $focus->column_fields['filesize'] = ''; $focus->column_fields['filelocationtype'] = 'I'; $focus->column_fields['fileversion'] = ''; $focus->column_fields['filestatus'] = 'on'; $focus->column_fields['folderid'] = $this->get("folderid"); $focus->save('Documents'); $language = $current_user->language; $request = $_REQUEST; $_REQUEST['search'] = true; $_REQUEST['submode'] = true; if ($current_user->is_admin != "on") { $useUser = Users::getActiveAdminUser(); } else { $useUser = $current_user; } $oldCurrentUser = $current_user; $current_user = $useUser; $dummyRequest = new Vtiger_Request(array()); $PDFMaker->createPDFAndSaveFile($dummyRequest, $this->get("template"), $focus, $modFocus, $file_name, $this->getModuleName(), $language); $current_user = $oldCurrentUser; $_REQUEST = $request; /* new PDFMaker Routine */ $overwriteFilename = $this->get("filename", $context); if ($overwriteFilename != -1 && !empty($overwriteFilename)) { global $root_directory; $sql = "SELECT attachmentsid FROM vtiger_seattachmentsrel WHERE crmid = " . $focus->id . " ORDER BY attachmentsid DESC LIMIT 1"; $result = $adb->query($sql); if ($adb->num_rows($result) > 0) { $attachmentsid = $adb->query_result($result, 0, "attachmentsid"); $attRst = $adb->query("SELECT * FROM vtiger_attachments WHERE attachmentsid = " . $attachmentsid); $attachment = $adb->fetchByAssoc($attRst); $oldFilename = $root_directory . "/" . $attachment["path"] . $attachmentsid . "_" . $attachment["name"]; $newFilename = $root_directory . "/" . $attachment["path"] . $attachmentsid . "_" . $overwriteFilename; @rename($oldFilename, $newFilename); $adb->pquery("UPDATE vtiger_attachments SET name = ? WHERE attachmentsid = " . $attachmentsid, array($overwriteFilename)); $adb->pquery("UPDATE vtiger_notes SET filename = ? WHERE notesid = " . $focus->id, array($overwriteFilename)); } $file_name = $foldername . "_" . $overwriteFilename; } $_REQUEST = $request; if ($this->get("createrel") === "1") { $sql = "INSERT INTO vtiger_senotesrel SET crmid = " . $context->getId() . ", 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 ($this->get("workflow") !== "") { $objWorkflow = new \Workflow\Main($this->get("workflow"), false, $context->getUser()); $objWorkflow->setContext($newContext); $objWorkflow->isSubWorkflow(true); $objWorkflow->start(); } $context->setEnvironment("new_record_id", $newContext->getWsId(), $this); return "yes"; }
/** * return the URL to a record in your vtigerCRM system * @param $crmid The CRMID of the record * @return string The URL */ function wf_recordurl($crmid) { $crmid = intval($crmid); $objTMP = \Workflow\VTEntity::getForId($crmid); global $site_URL; return $site_URL . '/index.php?action=DetailView&module=' . $objTMP->getModuleName() . '&record=' . $crmid; }