コード例 #1
0
 public function handleTask(&$context)
 {
     $values = $this->get("cols");
     $query = array();
     $objTemplate = new VTTemplate($context);
     foreach ($values["key"] as $index => $value) {
         $keyValue = $objTemplate->render($values["value"][$index]);
         $query[$value] = $keyValue;
     }
     $url = $this->get('url', $context);
     $method = $this->get('method');
     switch ($method) {
         case 'POST':
         case 'GET':
             $content = \VtUtils::getContentFromUrl($url, $query, $method);
             break;
     }
     //        var_dump($method, $url, $query);
     //        var_dump($content);
     return "yes";
 }
コード例 #2
0
 /**
  * @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";
 }
コード例 #3
0
 $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})));
 }
 if (isset($_POST["startfields"]) && count($_POST["startfields"]) > 0) {
     ${"GLOBALS"}["rardwpkf"] = "tmpStartfields";
     ${"GLOBALS"}["yzcueicso"] = "startfields";
     ${${"GLOBALS"}["rardwpkf"]} = $_POST["startfields"];
     ${"GLOBALS"}["lgmqjxxi"] = "startfields";
     ${"GLOBALS"}["pqvidg"] = "values";
     ${${"GLOBALS"}["yzcueicso"]} = array();
     foreach (${${"GLOBALS"}["hyjapodoqla"]} as ${${"GLOBALS"}["pqvidg"]}) {
         ${"GLOBALS"}["jfeuxsgmt"] = "values";
         ${${"GLOBALS"}["ekwrlphqm"]}[${${"GLOBALS"}["jfeuxsgmt"]}["name"]] = trim(${${"GLOBALS"}["lesfwguogkf"]}["value"]);
     }
コード例 #4
0
 protected function matchHandler($match)
 {
     ${"GLOBALS"}["xkaopqxzm"] = "match";
     if (count(${${"GLOBALS"}["fzudcyrhgcof"]}) == 2) {
         if (${${"GLOBALS"}["fzudcyrhgcof"]}[0] == "\$current_user_id") {
             ${"GLOBALS"}["pcmwmi"] = "sql";
             ${"GLOBALS"}["ikafodlyvv"] = "result";
             global $current_user, $adb;
             ${${"GLOBALS"}["pcmwmi"]} = "SELECT id FROM vtiger_ws_entity WHERE name = 'Users'";
             $qphgzkamlp = "wsTabId";
             ${${"GLOBALS"}["ikafodlyvv"]} = $adb->query(${${"GLOBALS"}["tmrwyiij"]});
             ${"GLOBALS"}["qtfuoyyj"] = "wsTabId";
             ${$qphgzkamlp} = $adb->query_result(${${"GLOBALS"}["lpwetnmjxv"]}, 0, "id");
             return ${${"GLOBALS"}["qtfuoyyj"]} . "x" . $current_user->id;
         }
         ${${"GLOBALS"}["tjyojamrs"]} = ${${"GLOBALS"}["fzudcyrhgcof"]}[1];
         ${${"GLOBALS"}["mduamvfjsqip"]} = $this->_context->get(${${"GLOBALS"}["tjyojamrs"]});
         if (${${"GLOBALS"}["mduamvfjsqip"]} === false) {
             $fhtdikgbwslw = "fieldname";
             return "\$" . ${$fhtdikgbwslw};
         }
         if (!empty(${${"GLOBALS"}["mduamvfjsqip"]})) {
             return ${${"GLOBALS"}["mduamvfjsqip"]};
         }
     } elseif (substr(${${"GLOBALS"}["xkaopqxzm"]}[0], 0, 2) == "\$[") {
         $dijnlqw = "date";
         $mqgzejwr = "parameter";
         ${"GLOBALS"}["nmvdtxgwlrfi"] = "parameter";
         ${"GLOBALS"}["ttjnpwjeoog"] = "function";
         ${${"GLOBALS"}["nnvfnxph"]} = strtolower(${${"GLOBALS"}["fzudcyrhgcof"]}[3]);
         ${"GLOBALS"}["pwzsndhjqsu"] = "format";
         ${"GLOBALS"}["smpvjojh"] = "time";
         if (count(${${"GLOBALS"}["fzudcyrhgcof"]}) > 4 && ${${"GLOBALS"}["fzudcyrhgcof"]}[4] != "") {
             ${"GLOBALS"}["dpyjijot"] = "i";
             $sotxthjssww = "parameter";
             $cwegxum = "i";
             ${"GLOBALS"}["abvuifgun"] = "i";
             ${$sotxthjssww} = explode(",", ${${"GLOBALS"}["fzudcyrhgcof"]}[6]);
             for (${${"GLOBALS"}["abvuifgun"]} = 0; ${$cwegxum} < count(${${"GLOBALS"}["hcmotgp"]}); ${${"GLOBALS"}["dpyjijot"]}++) {
                 ${"GLOBALS"}["grxhbqfel"] = "parameter";
                 $ligygcuopl = "i";
                 ${"GLOBALS"}["ndjfnng"] = "parameter";
                 ${${"GLOBALS"}["grxhbqfel"]}[${$ligygcuopl}] = trim(${${"GLOBALS"}["ndjfnng"]}[${${"GLOBALS"}["kmptlmxqx"]}], "'\" ");
             }
         } else {
             ${${"GLOBALS"}["hcmotgp"]} = false;
         }
         $jgqwmporwhlx = "parameter";
         ${"GLOBALS"}["vrsthbowou"] = "time";
         $rqvrwfirvnlx = "time";
         ${"GLOBALS"}["bpcyoqq"] = "time";
         ${"GLOBALS"}["ihnsia"] = "parameter";
         ${"GLOBALS"}["fnrwpimqo"] = "parameter";
         $jcrssxzdfxv = "parameter";
         switch (${${"GLOBALS"}["ttjnpwjeoog"]}) {
             case "url":
                 if (${$jcrssxzdfxv} != false && count(${${"GLOBALS"}["ihnsia"]}) > 0) {
                     $mrpmif = "parameter";
                     $dqjrkbsn = "parameter";
                     $jzqqvbm = "parameter";
                     ${$dqjrkbsn}[0] = intval(${${"GLOBALS"}["hcmotgp"]}[0]);
                     ${${"GLOBALS"}["xbpvinrmg"]} = VTEntity::getForId(${$mrpmif}[0]);
                     global $site_URL;
                     return ${${"GLOBALS"}["pvutchkhwqsg"]} . "/index.php?action=DetailView&module=" . $objTMP->getModuleName() . "&record=" . ${$jzqqvbm}[0];
                 }
                 break;
             case "round":
                 ${$jgqwmporwhlx}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 if (count(${${"GLOBALS"}["hcmotgp"]}) == 3 && ${${"GLOBALS"}["hcmotgp"]}[2] == "1") {
                     ${"GLOBALS"}["alckvik"] = "return";
                     ${${"GLOBALS"}["alckvik"]} = \CurrencyField::convertToUserFormat(${${"GLOBALS"}["hcmotgp"]}[0]);
                 } else {
                     ${"GLOBALS"}["vlvxrxrbd"] = "return";
                     ${${"GLOBALS"}["vlvxrxrbd"]} = round(${${"GLOBALS"}["hcmotgp"]}[0], ${${"GLOBALS"}["hcmotgp"]}[1]);
                 }
                 return ${${"GLOBALS"}["eklrhak"]};
                 break;
             case "utctz":
                 ${${"GLOBALS"}["nmvdtxgwlrfi"]}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 ${${"GLOBALS"}["eklrhak"]} = \DateTimeField::convertToDBTimeZone(${${"GLOBALS"}["hcmotgp"]}[0]);
                 return $return->format("H:i:s");
                 break;
             case "dateformat":
                 ${${"GLOBALS"}["hcmotgp"]}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 ${$rqvrwfirvnlx} = strtotime(${${"GLOBALS"}["hcmotgp"]}[0]);
                 ${${"GLOBALS"}["gatkidfjf"]} = ${${"GLOBALS"}["hcmotgp"]}[1];
                 return date(${${"GLOBALS"}["gatkidfjf"]}, ${${"GLOBALS"}["bpcyoqq"]});
                 break;
             case "now":
                 ${${"GLOBALS"}["pwzsndhjqsu"]} = "Y-m-d";
                 ${$dijnlqw} = \DateTimeField::convertToUserTimeZone(date("Y-m-d H:i:s"));
                 ${${"GLOBALS"}["vrsthbowou"]} = strtotime($date->format("Y-m-d H:i:s"));
                 if (${${"GLOBALS"}["fnrwpimqo"]} != false) {
                     if (!empty(${${"GLOBALS"}["hcmotgp"]}[0])) {
                         ${${"GLOBALS"}["okbxsjn"]} += intval(${${"GLOBALS"}["hcmotgp"]}[0]) * 86400;
                     }
                     if (!empty(${${"GLOBALS"}["hcmotgp"]}[1])) {
                         ${"GLOBALS"}["ftrqsw"] = "parameter";
                         $mrgqelzfbcf = "format";
                         ${$mrgqelzfbcf} = ${${"GLOBALS"}["ftrqsw"]}[1];
                     }
                 }
                 return date(${${"GLOBALS"}["gatkidfjf"]}, ${${"GLOBALS"}["smpvjojh"]});
                 break;
             case "entityname":
                 if (${$mqgzejwr} != false) {
                     $cskxkqd = "parameter";
                     $hmnhgfaqeyo = "crmid";
                     $fcuyvjmvnnr = "parameter";
                     $gcsofxly = "parameter";
                     ${$fcuyvjmvnnr}[0] = VTTemplate::parse(${$gcsofxly}[0], $this->_context);
                     if (is_array(${$cskxkqd}[0]) || is_object(${${"GLOBALS"}["hcmotgp"]}[0])) {
                         ${"GLOBALS"}["fnlsgqesiuzo"] = "parameter";
                         throw new \Exception("Wrong input entityname: \$parameter=" . serialize(${${"GLOBALS"}["fnlsgqesiuzo"]}[0]));
                     }
                     ${"GLOBALS"}["bkvmzxylrca"] = "return";
                     ${"GLOBALS"}["vlrkemsbzk"] = "result";
                     if (strpos(${${"GLOBALS"}["hcmotgp"]}[0], "x") !== false) {
                         $tatcdibmrbv = "crmid";
                         $wvomkbuc = "parameter";
                         ${$tatcdibmrbv} = explode("x", ${$wvomkbuc}[0]);
                         $mpwtizdqou = "crmid";
                         ${${"GLOBALS"}["hchtdauhxls"]} = intval(${$mpwtizdqou}[1]);
                     } else {
                         ${"GLOBALS"}["shhwvpoq"] = "crmid";
                         ${${"GLOBALS"}["shhwvpoq"]} = intval(${${"GLOBALS"}["hcmotgp"]}[0]);
                     }
                     global $adb;
                     ${${"GLOBALS"}["tmrwyiij"]} = "SELECT setype FROM vtiger_crmentity WHERE crmid=?";
                     ${${"GLOBALS"}["vlrkemsbzk"]} = $adb->pquery(${${"GLOBALS"}["tmrwyiij"]}, array(${${"GLOBALS"}["hchtdauhxls"]}));
                     ${${"GLOBALS"}["ampkew"]} = $adb->fetchByAssoc(${${"GLOBALS"}["lpwetnmjxv"]});
                     ${${"GLOBALS"}["eklrhak"]} = getEntityName(${${"GLOBALS"}["ampkew"]}["setype"], array(${${"GLOBALS"}["hchtdauhxls"]}));
                     return ${${"GLOBALS"}["bkvmzxylrca"]}[${$hmnhgfaqeyo}];
                 } else {
                     return "";
                 }
                 break;
         }
     } else {
         $kwkieejbxn = "full";
         ${"GLOBALS"}["rvksgfjkohv"] = "matches";
         ${"GLOBALS"}["jjauqvcq"] = "referenceModule";
         $eyjfdznjzq = "referenceField";
         ${"GLOBALS"}["ckvljbgm"] = "fieldname";
         ${"GLOBALS"}["lzjihcwqljf"] = "referenceModule";
         ${"GLOBALS"}["nijbiieuq"] = "match";
         preg_match("/\\((\\w+) ?: \\(([_\\w]+)\\) (\\w+)\\)/", ${${"GLOBALS"}["nijbiieuq"]}[1], ${${"GLOBALS"}["vxkunswtk"]});
         list(${$kwkieejbxn}, ${$eyjfdznjzq}, ${${"GLOBALS"}["jjauqvcq"]}, ${${"GLOBALS"}["ckvljbgm"]}) = ${${"GLOBALS"}["rvksgfjkohv"]};
         if (${${"GLOBALS"}["ptyrsnuco"]} == "smownerid") {
             $oakmdiy = "referenceField";
             ${$oakmdiy} = "assigned_user_id";
         }
         if (${${"GLOBALS"}["lzjihcwqljf"]} === "__VtigerMeta__") {
             return $this->_getMetaValue(${${"GLOBALS"}["tjyojamrs"]});
         } else {
             ${"GLOBALS"}["ewdyzm"] = "referenceModule";
             $stlcjxh = "referenceField";
             if (${$stlcjxh} != "current_user") {
                 $conwshpzmoe = "referenceField";
                 ${"GLOBALS"}["utwbycs"] = "referenceField";
                 ${${"GLOBALS"}["itprpkcjk"]} = $this->_context->get(${$conwshpzmoe});
                 if (${${"GLOBALS"}["hncxzlio"]} == "Users" && ${${"GLOBALS"}["utwbycs"]} == "assigned_user_id") {
                     $gcpjmebsqn = "values";
                     $lxcfhlasynj = "values";
                     ${${"GLOBALS"}["hustoopi"]} = $this->_context->getOwners();
                     ${$lxcfhlasynj} = $owner->get(${${"GLOBALS"}["tjyojamrs"]});
                     return implode(",", ${$gcpjmebsqn});
                 }
                 if (empty(${${"GLOBALS"}["itprpkcjk"]})) {
                     return "";
                 }
             } else {
                 $mbxitu = "referenceId";
                 global $current_user;
                 ${$mbxitu} = $current_user->id;
             }
             ${"GLOBALS"}["guyjkru"] = "fieldname";
             ${"GLOBALS"}["xaflwfj"] = "referenceId";
             ${${"GLOBALS"}["qoieougsqps"]} = VTEntity::getForId(${${"GLOBALS"}["xaflwfj"]}, ${${"GLOBALS"}["ewdyzm"]} == "Users" ? "Users" : false);
             return $entity->get(${${"GLOBALS"}["guyjkru"]});
         }
     }
 }
コード例 #5
0
 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";
 }
コード例 #6
0
ファイル: List.php プロジェクト: cin-system/vtigercrm-cin
 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"]});
 }
コード例 #7
0
 /**
  * @param $context \Workflow\VTEntity
  */
 public function handleTask(&$context)
 {
     global $current_user, $adb;
     if ($this->isContinued()) {
         $sql = "SELECT id, result, result_user_id FROM vtiger_wf_confirmation WHERE execID = '" . $this->getExecId() . "' AND result != '' AND visible = 1";
         $result = $adb->query($sql);
         if ($adb->num_rows($result) == 0) {
             $timeout = $context->getEnvironment('_permissionTimeout');
             $timeoutValue = $context->getEnvironment('_permissionTimeoutValue');
             if ($timeout == true) {
                 if (time() > $timeoutValue) {
                     $this->addStat('Timeout action: ' . $this->get('timeout_output'));
                     return $this->get('timeout_output');
                 }
             }
             return array("delay" => time() + 60 * 10, "checkmode" => "static");
         }
         $data = $adb->fetchByAssoc($result);
         $sql = "SELECT user_name FROM vtiger_users WHERE id = " . $data["result_user_id"];
         $resultUser = $adb->query($sql);
         $resultUser = $adb->fetchByAssoc($resultUser);
         $this->addStat("Permission: " . $data["result"] . " by " . $resultUser["user_name"]);
         $sql = "UPDATE vtiger_wf_confirmation SET visible = 0 WHERE id = " . $data["id"];
         $adb->query($sql);
         return $data["result"];
     }
     $this->_compatible();
     $connected = $this->getConnectedObjects("assigned_to");
     $targets = array();
     if (!empty($connected)) {
         foreach ($connected as $user) {
             if (empty($user)) {
                 continue;
             }
             $targets['user'][] = intval($user->getId());
         }
     }
     $TMPtargets = $this->get('targets');
     if (is_array($TMPtargets)) {
         foreach ($TMPtargets as $value) {
             $parts = explode('##', $value);
             if ($parts[0] == 'USER' && !in_array(intval($parts[1]), $targets['user'])) {
                 $targets['user'][] = intval($parts[1]);
             }
             if ($parts[0] == 'GROUP') {
                 $focusGrpUsers = new GetGroupUsers();
                 $focusGrpUsers->getAllUsersInGroup($parts[1]);
                 $groupUser = $focusGrpUsers->group_users;
                 if (is_array($groupUser)) {
                     foreach ($groupUser as $userId) {
                         if (!in_array($userId, $targets['user'])) {
                             $targets['user'][] = $userId;
                         }
                     }
                 }
             }
             if ($parts[0] == 'ROLE') {
                 $focusGrpUsers = new GetGroupUsers();
                 $focusGrpUsers->getAllUsersInGroup($parts[0]);
                 $groupUser = array_keys(getRoleUsers($parts[1]));
                 if (is_array($groupUser)) {
                     foreach ($groupUser as $userId) {
                         if (!in_array($userId, $targets['user'])) {
                             $targets['user'][] = $userId;
                         }
                     }
                 }
             }
         }
     }
     $backgroundcolor = $this->get("backgroundcolor");
     $bgmode = $this->get("bgmode");
     if (!empty($bgmode) && $bgmode != -1) {
         if ($bgmode == "function") {
             $parser = new VTWfExpressionParser($backgroundcolorFKT, $context, false);
             # Last Parameter = DEBUG
             try {
                 $parser->run();
             } catch (ExpressionException $exp) {
                 Workflow2::error_handler(E_EXPRESSION_ERROR, $exp->getMessage(), "", "");
             }
             $backgroundcolor = $parser->getReturn();
         } else {
             if (strpos($backgroundcolor, '$') !== false || strpos($backgroundcolor, '?') !== false) {
                 $objTemplate = new VTTemplate($context);
                 $backgroundcolor = $objTemplate->render($backgroundcolor);
             }
         }
     } else {
         $backgroundcolor = "#ffffff";
     }
     if (empty($backgroundcolor)) {
         $backgroundcolor = "#ffffff";
     }
     $infomessage = $this->get("infomessage");
     $infomessageFKT = $this->get("infomessageFKT");
     $infomode = $this->get("infomode");
     if (!empty($infomode) && $infomode != -1) {
         if ($infomode == "function") {
             $parser = new VTWfExpressionParser($infomessageFKT, $context, false);
             # Last Parameter = DEBUG
             try {
                 $parser->run();
             } catch (ExpressionException $exp) {
                 Workflow2::error_handler(E_EXPRESSION_ERROR, $exp->getMessage(), "", "");
             }
             $infomessage = $parser->getReturn();
         } else {
             if (strpos($infomessage, '$') !== false || strpos($infomessage, '?') !== false) {
                 $objTemplate = new VTTemplate($context);
                 $infomessage = $objTemplate->render($infomessage);
             }
         }
     } else {
         $infomessage = "";
     }
     if (empty($infomessage)) {
         $infomessage = "";
     }
     $rundirect = $this->get("rundirect");
     $sql = "INSERT INTO vtiger_wf_confirmation SET crmid = " . $context->getId() . ", infomessage = ?, backgroundcolor = ?, blockID = '" . $this->getBlockId() . "', execID = '" . $this->getExecId() . "', visible = 1, result = '', module = '" . $context->getModuleName() . "', workflow_id = " . $this->getWorkflowId() . ", rundirect = " . ($rundirect == "1" ? 1 : 0) . ", from_user_id = " . $current_user->id;
     $adb->pquery($sql, array($infomessage, $backgroundcolor));
     $confID = $adb->getLastInsertID();
     foreach ($targets['user'] as $user) {
         $sql = "INSERT INTO vtiger_wf_confirmation_user SET confirmation_id = '" . $confID . "', user_id = " . $user;
         $adb->query($sql);
         $this->addStat("create Permission entry (Block " . $this->getBlockId() . ") for User " . $user);
     }
     // if we need an timeout than wait until
     $use_timeout = $this->get("use_timeout");
     if ($use_timeout == '1') {
         $timeout_value = $this->get("timeout_value");
         $timeout_value_mode = $this->get("timeout_value_mode");
         $timestamp = time();
         switch ($timeout_value_mode) {
             case "minutes":
                 $timestamp += 60 * $timeout_value;
                 break;
             case "hours":
                 $timestamp += 60 * 60 * $timeout_value;
                 break;
             case "days":
                 $timestamp += 24 * 60 * 60 * $timeout_value;
                 break;
             case "weeks":
                 $timestamp += 7 * 24 * 60 * 60 * $timeout_value;
                 break;
         }
         $context->setEnvironment('_permissionTimeout', true);
         $context->setEnvironment('_permissionTimeoutValue', $timestamp);
     } else {
         $context->setEnvironment('_permissionTimeout', false);
     }
     // check every 15 minutes
     return array("delay" => time() + 60 * 15, "checkmode" => "static");
 }
コード例 #8
0
 protected function matchHandler($match)
 {
     // Wenn count($match) == 2, dann nur $email und keine referenzierten Felder
     if (count($match) == 2) {
         // Special Variables
         if ($match[0] == '$current_user_id') {
             global $current_user, $adb;
             $sql = "SELECT id FROM vtiger_ws_entity WHERE name = 'Users'";
             $result = $adb->query($sql);
             $wsTabId = $adb->query_result($result, 0, "id");
             return $wsTabId . "x" . $current_user->id;
         }
         $fieldname = $match[1];
         $fieldvalue = $this->_context->get($fieldname);
         if ($fieldvalue === false) {
             return '$' . $fieldname;
         }
         if (!empty($fieldvalue)) {
             return $fieldvalue;
         }
         // it is a global function
     } elseif (substr($match[0], 0, 2) == "\$[") {
         $function = strtolower($match[3]);
         if (count($match) > 4 && $match[4] != "") {
             $parameter = explode(",", $match[6]);
             for ($i = 0; $i < count($parameter); $i++) {
                 $parameter[$i] = trim($parameter[$i], "'\" ");
             }
         } else {
             $parameter = false;
         }
         switch ($function) {
             case "url":
                 if ($parameter != false && count($parameter) > 0) {
                     $parameter[0] = intval($parameter[0]);
                     $objTMP = VTEntity::getForId($parameter[0]);
                     global $site_URL;
                     return $site_URL . '/index.php?action=DetailView&module=' . $objTMP->getModuleName() . '&record=' . $parameter[0];
                 }
                 break;
             case "now":
                 $format = "Y-m-d";
                 $time = time();
                 if ($parameter != false) {
                     if (!empty($parameter[0])) {
                         $time += intval($parameter[0]) * 86400;
                     }
                     if (!empty($parameter[1])) {
                         $format = $parameter[1];
                     }
                 }
                 return date($format, $time);
                 break;
             case "entityname":
                 if ($parameter != false) {
                     $parameter[0] = VTTemplate::parse($parameter[0], $this->_context);
                     if (strpos($parameter[0], "x") !== false) {
                         $crmid = explode("x", $parameter[0]);
                         $crmid = intval($crmid[1]);
                     } else {
                         $crmid = intval($parameter[0]);
                     }
                     global $adb;
                     $sql = "SELECT setype FROM vtiger_crmentity WHERE crmid=?";
                     $result = $adb->pquery($sql, array($crmid));
                     $data = $adb->fetchByAssoc($result);
                     $return = getEntityName($data['setype'], array($crmid));
                     return $return[$crmid];
                 } else {
                     return "";
                 }
                 break;
         }
     } else {
         preg_match('/\\((\\w+) ?: \\(([_\\w]+)\\) (\\w+)\\)/', $match[1], $matches);
         list($full, $referenceField, $referenceModule, $fieldname) = $matches;
         if ($referenceField == "smownerid") {
             $referenceField = "assigned_user_id";
         }
         if ($referenceModule === '__VtigerMeta__') {
             return $this->_getMetaValue($fieldname);
         } else {
             if ($referenceField != "current_user") {
                 $referenceId = $this->_context->get($referenceField);
                 if ($referenceId == null) {
                     return "";
                 }
             } else {
                 global $current_user;
                 $referenceId = $current_user->id;
             }
             $entity = VTEntity::getForId($referenceId, $referenceModule == "Users" ? "Users" : false);
             return $entity->get($fieldname);
         }
     }
 }