public function beforeGetTaskform($viewer) { global $adb; if (!\Workflow\VtUtils::existTable("vtiger_wf_customnumbering")) { echo "Create table vtiger_wf_confirmation_user ... ok<br>"; $adb->query("CREATE TABLE IF NOT EXISTS `vtiger_wf_customnumbering` (\r\n `serie` varchar(24) NOT NULL,\r\n `prefix` varchar(16) NOT NULL,\r\n `current` int(10) unsigned NOT NULL,\r\n `length` tinyint(4) NOT NULL,\r\n PRIMARY KEY (`serie`)\r\n ) ENGINE=InnoDB;"); } $crmidColObj = CRMEntity::getInstance($this->getModuleName()); $viewer->assign('crmidCol', $crmidColObj->table_index); $moduleName = $this->getModuleName(); $fields = VtUtils::getFieldsWithBlocksForModule($moduleName, false); $selectedId = $this->get('field'); if ($selectedId === -1 || empty($selectedId)) { $sql = 'SELECT * FROM vtiger_field WHERE uitype = 4 AND tabid = ' . getTabid($moduleName); $result = $adb->query($sql); $selectedId = $adb->query_result($result, 0, 'fieldname'); $this->set('field', $selectedId); } $sql = 'SELECT * FROM vtiger_wf_customnumbering'; $result = $adb->query($sql); $series = array(); while ($row = $adb->fetchByAssoc($result)) { $series[$row['serie']] = $row; } if (isset($series[$this->get('serie')])) { $viewer->assign('lockFields', true); } $viewer->assign('series', $series); $viewer->assign('fields', $fields); /* Insert here source code to create custom configurations pages */ }
public function process(Vtiger_Request $request) { ${"GLOBALS"}["xtbxpaosomd"] = "module"; ${"GLOBALS"}["cqsbdcf"] = "params"; $ylhwigwjj = "adb"; ${$ylhwigwjj} = PearDatabase::getInstance(); $irlzrbtqca = "params"; ${$irlzrbtqca} = $request->getAll(); ${"GLOBALS"}["bjpfpvsjmoe"] = "block"; ${${"GLOBALS"}["vlwbcehp"]} = ${${"GLOBALS"}["fvrxafpqr"]}["moduleName"]; ${"GLOBALS"}["slnjoremiwq"] = "result"; ${${"GLOBALS"}["imkzic"]} = VtUtils::getFieldsWithBlocksForModule(${${"GLOBALS"}["xtbxpaosomd"]}, true); if (!empty(${${"GLOBALS"}["cqsbdcf"]}["blocks"])) { ${"GLOBALS"}["tdxbgjlxl"] = "moduleFields"; die(json_encode(${${"GLOBALS"}["tdxbgjlxl"]})); } ${${"GLOBALS"}["quwfbet"]} = array(); foreach (${${"GLOBALS"}["imkzic"]} as ${${"GLOBALS"}["jutloijjy"]} => ${${"GLOBALS"}["bjpfpvsjmoe"]}) { foreach (${${"GLOBALS"}["swvrrtqrvf"]} as ${${"GLOBALS"}["fxiwohqzyqth"]}) { $qusdhjlspiv = "result"; ${$qusdhjlspiv}[] = array("type" => $field->type, "group" => ${${"GLOBALS"}["jutloijjy"]}, "name" => $field->name, "label" => $field->label); } } die(json_encode(${${"GLOBALS"}["slnjoremiwq"]})); }
public function getFromFields() { if ($this->_fromFields === null) { $search_module = $this->get("search_module"); if (!empty($search_module)) { if ($search_module != -1) { $parts = explode("#~#", $search_module); } } else { return; } $this->_fromFields = VtUtils::getFieldsWithBlocksForModule($parts[0], true); } return $this->_fromFields; }
public function beforeGetTaskform($viewer) { global $adb, $current_language, $mod_strings; if (!getTabid('PDFMaker') || !vtlib_isModuleActive('PDFMaker')) { $viewer->assign('disable', true); $this->addConfigHint(getTranslatedString('LBL_FOR_THIS_YOU_NEED_PDFMAKER', 'Settings:Workflow2')); return; } $copies = $this->get('copies'); if ($copies === -1 || empty($copies)) { $this->set('copies', 1); } $viewer->assign("related_modules", VtUtils::getEntityModules(true)); $search_module = $this->get("search_module"); $parts = false; if (!empty($_POST["task"]["search_module"])) { $parts = explode("#~#", $_POST["task"]["search_module"]); } elseif (!empty($search_module)) { if ($search_module != -1) { $parts = explode("#~#", $search_module); $tabid = $parts[1]; } } if (!empty($parts)) { $moduleName = $parts[0]; $tabid = $parts[1]; } else { $moduleName = $this->getModuleName(); $tabid = getTabid($moduleName); } $viewer->assign("related_tabid", $tabid); $fields = VtUtils::getFieldsWithBlocksForModule($moduleName); $viewer->assign("sort_fields", $fields); require_once 'modules/PDFMaker/helpers/Version.php'; $viewer->assign('PDFMAKER_VERSION', PDFMaker_Version_Helper::$version); $sql = "SELECT folderid, foldername FROM vtiger_attachmentsfolder ORDER BY sequence"; $result = $adb->query($sql); $folders = array(); while ($row = $adb->fetch_array($result)) { $folders[] = $row; } $viewer->assign("folders", $folders); $sql = "SELECT templateid, filename, description FROM vtiger_pdfmaker WHERE module = '" . $moduleName . "'"; $result = $adb->query($sql); $templates = array(); while ($row = $adb->fetch_array($result)) { $templates[] = $row; } $viewer->assign("templates", $templates); $workflows = \Workflow2::getWorkflowsForModule("Documents", 1); $viewer->assign("workflows", $workflows); }
public function beforeGetTaskform($viewer) { global $adb, $current_language, $mod_strings; $viewer->assign("related_modules", VtUtils::getEntityModules(true)); $search_module = $this->get("search_module"); if (!empty($_POST["task"]["search_module"])) { $parts = explode("#~#", $_POST["task"]["search_module"]); } elseif (!empty($search_module)) { if ($search_module != -1) { $parts = explode("#~#", $search_module); } } else { return; } if (!empty($parts)) { $viewer->assign("related_tabid", $parts[1]); $search_module_name = VtUtils::getModuleName($parts[1]); #$workflowSettings = $this->getWorkflow()->getSettings(); $workflows = $workflows = Workflow2::getWorkflowsForModule($search_module_name, 1); $viewer->assign("workflows", $workflows); $fields = VtUtils::getFieldsWithBlocksForModule($search_module_name); $viewer->assign("sort_fields", $fields); $moduleObj = \Vtiger_Module_Model::getInstance($search_module_name); $viewer->assign('productCache', array()); if ($moduleObj instanceof \Inventory_Module_Model) { $viewer->assign('searchByProduct', true); $product = $this->get('products'); if (!empty($product)) { //$dataObj = \Vtiger_Record_Model::getInstanceById($product); $productCache[$product] = array('label' => \Vtiger_Functions::getCRMRecordLabel($product)); $viewer->assign('productCache', $productCache); } } $views = array(); $allviews = \CustomView_Record_Model::getAll($search_module_name); foreach ($allviews as $view) { $views[$view->get('cvid')] = $view->get('viewname'); } $viewer->assign('customviews', $views); } }
public function beforeGetTaskform($viewer) { $fields = VtUtils::getFieldsWithBlocksForModule('Emails'); $viewer->assign("sort_fields", $fields); /* Insert here source code to create custom configurations pages */ }
public static function getFieldsForModule($module_name, $references = false) { ${"GLOBALS"}["oukrqe"] = "references"; return VtUtils::getFieldsWithBlocksForModule(${${"GLOBALS"}["nlmyndvn"]}, ${${"GLOBALS"}["oukrqe"]}); }
public function beforeGetTaskform($viewer) { global $adb, $current_language, $mod_strings; $viewer->assign("related_modules", VtUtils::getEntityModules(true)); $search_module = $this->get("search_module"); if (!empty($_POST["task"]["search_module"])) { $parts = explode("#~#", $_POST["task"]["search_module"]); } elseif (!empty($search_module)) { if ($search_module != -1) { $parts = explode("#~#", $search_module); } } else { return; } if (!empty($parts)) { $viewer->assign("search_module", $parts[0]); $viewer->assign("related_tabid", $parts[1]); $search_module_name = VtUtils::getModuleName($parts[1]); #$workflowSettings = $this->getWorkflow()->getSettings(); $fields = VtUtils::getFieldsWithBlocksForModule($search_module_name); $viewer->assign("sort_fields", $fields); } }
public function beforeGetTaskform($viewer) { global $adb; $connected = $this->getConnectedObjects("Absender"); if (count($connected) > 0) { $viewer->assign("from", array("from_mail" => $connected[0]->get("email1"), "from_name" => trim($connected[0]->get("first_name") . " " . $connected[0]->get("last_name")), "from_readonly" => true)); } // $smtpServer = \Workflow\ConnectionProvider::getAvailableConfigurations('smtp'); // var_dump($smtpServer);exit(); $connected = $this->getConnectedObjects("BCC"); $bccs = $connected->get("email1"); $viewer->assign("bccs", $bccs); $from_email = $this->get("from_mail"); if ($from_email === -1) { global $current_user; $from_email = $current_user->column_fields["email1"]; $from_name = $current_user->column_fields["first_name"] . " " . $current_user->column_fields["last_name"]; $this->set("from_mail", $from_email); $this->set("from_name", $from_name); } $availableSpecialAttachments = \Workflow\Attachment::getAvailableOptions($this->getModuleName()); $attachmentHTML = array(); $attachmentJAVASCRIPT = array(); foreach ($availableSpecialAttachments as $item) { $attachmentHTML[] = '<div>' . $item['html'] . '</div>'; $attachmentJAVASCRIPT[] = !empty($item['script']) ? $item['script'] : ''; } // implode the array to one string $viewer->assign('attachmentsHTML', implode("\n", $attachmentHTML)); // transmit array to create single script tags $viewer->assign('attachmentsJAVASCRIPT', $attachmentJAVASCRIPT); if (vtlib_isModuleActive('Emails')) { $availableAttachments = \Workflow\InterfaceFiles::getAvailableFiles($this->getModuleName()); } else { throw new \Exception('To use this task, you need to activate the "Emails" module.'); } $jsList = array(); foreach ($availableAttachments as $title => $group) { foreach ($group as $index => $value) { $jsList[$index] = $value; } } $viewer->assign("jsAttachmentsList", $jsList); $viewer->assign("available_attachments", $availableAttachments); if ($this->get("attachments") == -1) { $this->set("attachments", '{}'); } if ($this->get("attachments") == "") { $this->set("attachments", '{}'); } $sql = "SELECT * FROM vtiger_emailtemplates WHERE deleted = 0"; $result = $adb->query($sql); $mailtemplates = array(); while ($row = $adb->fetchByAssoc($result)) { $mailtemplates['Email Templates'][$row["templateid"]] = $row["templatename"]; } if (vtlib_isModuleActive('EMAILMaker') && class_exists('EMAILMaker_Module_Model')) { $emailmaker = new \EMAILMaker_Module_Model(); if (method_exists($emailmaker, 'GetAvailableTemplates')) { $templates = $emailmaker->GetAvailableTemplates($this->getModuleName()); foreach ($templates as $categoryTitle => $category) { if (!is_array($category)) { $mailtemplates['EMAILMaker']['s#emailmaker#' . $categoryTitle] = $category; } else { foreach ($category as $templateid => $template) { $mailtemplates['EMAILMaker ' . $categoryTitle]['s#emailmaker#' . $templateid] = $template; } } } } } $viewer->assign("MAIL_TEMPLATES", $mailtemplates); $viewer->assign("fields", \VtUtils::getFieldsWithBlocksForModule($this->getModuleName(), true)); if (defined("WF_DEMO_MODE") && constant("WF_DEMO_MODE") == true) { echo "<p style='text-align:center;margin:0;padding:5px 0;background-color:#fbcb09;font-weight:bold;'>The sendmail Task won't work on demo.stefanwarnat.de</p>"; } }
public function process(Vtiger_Request $request) { $suqqivj = "params"; $abnhbiiwjxgw = "uitypes"; ${"GLOBALS"}["cxfpljg"] = "workflowID"; $oythwcwuij = "params"; $uxwwlkkdmi = "type"; $ymsjqqh = "params"; $rnglpjgj = "params"; $mbwcsxgslm = "params"; $xqdffflqhid = "moduleFields"; $vkrksu = "blockValue"; $uhvudfgft = "workflowID"; ${${"GLOBALS"}["ftxpwggzrr"]} = PearDatabase::getInstance(); ${"GLOBALS"}["ykxzyofbq"] = "type"; ${${"GLOBALS"}["tfaukbzz"]} = $request->getAll(); ${$uhvudfgft} = intval(${$ymsjqqh}["workflowID"]); if (!empty(${$suqqivj}["workflow_module"])) { $kibqefvtfv = "tabID"; ${${"GLOBALS"}["jvgzmmkv"]} = getTabId(${${"GLOBALS"}["tfaukbzz"]}["workflow_module"]); if (empty(${$kibqefvtfv})) { return ""; } } ${${"GLOBALS"}["ykxzyofbq"]} = ${$rnglpjgj}["type"]; $ygweexnlwsne = "params"; ${"GLOBALS"}["dxsvbac"] = "uitypes"; ${"GLOBALS"}["qkfvanhv"] = "init"; switch (${$uxwwlkkdmi}) { case "email": ${$abnhbiiwjxgw} = array(13, 104); break; default: ${${"GLOBALS"}["dxsvbac"]} = false; break; } $qmicsdts = "sql"; if (!empty(${${"GLOBALS"}["tfaukbzz"]}["workflow_module"])) { ${${"GLOBALS"}["znsxayvgwv"]} = VtUtils::getFieldsWithBlocksForModule(${${"GLOBALS"}["tfaukbzz"]}["workflow_module"], true, ${${"GLOBALS"}["tfaukbzz"]}["reftemplate"]); } else { ${${"GLOBALS"}["znsxayvgwv"]} = array(); } echo "<div style=\"padding:10px;\">"; echo "<p>" . getTranslatedString("LBL_INSERT_TEMPLATE_VARIABLE", "Workflow2") . ":</p>"; echo "<select id=\"insertTemplateField_Select\" class=\"chzn-select\" style=\"width:400px;\">"; if (!empty(${$oythwcwuij}["functions"]) && ${${"GLOBALS"}["tfaukbzz"]}["functions"] == "1") { echo "<optgroup label=\"" . getTranslatedString("global functions", "Workflow2") . "\">"; echo "<option value='[Now]'>Now()</option>"; echo "<option value='[Now,-x]'>" . sprintf(getTranslatedString("- %s days", "Workflow2"), "x") . "</option>"; echo "<option value='[Now,+x]'>" . sprintf(getTranslatedString("+ %s days", "Workflow2"), "x") . "</option>"; echo "<option value='" . "{ ..custom function.. }}>'>" . "\$" . "{ ..custom function.. }}></option>"; echo "</optgroup>"; } if (!empty(${$mbwcsxgslm}["refFields"]) && ${$ygweexnlwsne}["refFields"] == "true") { ${"GLOBALS"}["xgflwscx"] = "references"; $mnvhxhvbhsb = "params"; ${"GLOBALS"}["drqyeiujrim"] = "references"; ${${"GLOBALS"}["xgflwscx"]} = VtUtils::getReferenceFieldsForModule(${$mnvhxhvbhsb}["workflow_module"]); echo "<optgroup label=\"" . getTranslatedString("LBL_REFERENCES", "Workflow2") . "\">"; echo "<option value=\"id\">" . getTranslatedString("LBL_ID_OF_CURRENT_RECORD", "Workflow2") . " (" . getTranslatedString(${${"GLOBALS"}["tfaukbzz"]}["workflow_module"], ${${"GLOBALS"}["tfaukbzz"]}["workflow_module"]) . ")</option>"; foreach (${${"GLOBALS"}["drqyeiujrim"]} as ${${"GLOBALS"}["dafepd"]}) { ${"GLOBALS"}["nnqztiblbs"] = "ref"; $slunrgqfhwlo = "ref"; ${${"GLOBALS"}["mnppne"]} = str_replace(array("[source]", "[module]", "[destination]"), array(${${"GLOBALS"}["dafepd"]}["fieldname"], ${${"GLOBALS"}["dafepd"]}["module"], "id"), "([source]: ([module]) [destination])"); $tauosxbwiycy = "name"; echo "<option value=\"" . ${$tauosxbwiycy} . "\">" . getTranslatedString(${${"GLOBALS"}["dafepd"]}["fieldlabel"], ${$slunrgqfhwlo}["module"]) . " (" . getTranslatedString(${${"GLOBALS"}["nnqztiblbs"]}["module"], ${${"GLOBALS"}["dafepd"]}["module"]) . ")</option>"; } echo "</optgroup>"; } else { echo "<option value=\"id\">" . getTranslatedString("LBL_ID_OF_CURRENT_RECORD", "Workflow2") . "</option>"; } ${${"GLOBALS"}["qkfvanhv"]} = false; ${${"GLOBALS"}["rpwlinoeruc"]} = false; foreach (${$xqdffflqhid} as ${${"GLOBALS"}["fugvczqprg"]} => ${$vkrksu}) { $pqfbxvx = "blockKey"; $pkuwndqwc = "blockValue"; ${"GLOBALS"}["xngsjfeis"] = "field"; ${"GLOBALS"}["zfcscyqss"] = "init"; $ysessmc = "close"; ${${"GLOBALS"}["zfcscyqss"]} = "<optgroup label=\"" . ${$pqfbxvx} . "\">"; foreach (${$pkuwndqwc} as ${${"GLOBALS"}["nmluafbbj"]} => ${${"GLOBALS"}["xngsjfeis"]}) { $mmgjtjrsvqg = "uitypes"; $nbgdqimtjfi = "uitypes"; if (${$nbgdqimtjfi} === false || in_array($field->uitype, ${$mmgjtjrsvqg})) { $fhgjjmpn = "init"; if (${$fhgjjmpn} !== false) { ${"GLOBALS"}["ucznnblkwte"] = "init"; $htciocvmhgj = "close"; echo ${${"GLOBALS"}["ucznnblkwte"]}; ${${"GLOBALS"}["hdyprkrhczq"]} = false; ${$htciocvmhgj} = true; } echo "<option value='" . $field->name . "'>" . $field->label . "</option>"; } } if (${$ysessmc} == true) { echo "</optgroup>"; } } ${$qmicsdts} = "SELECT * FROM vtiger_wfp_blocks WHERE workflow_id = " . ${${"GLOBALS"}["cxfpljg"]} . " AND env_vars != ''"; ${${"GLOBALS"}["phfqsvze"]} = $adb->query(${${"GLOBALS"}["udwnmshnu"]}); if ($adb->num_rows(${${"GLOBALS"}["phfqsvze"]}) > 0) { ${"GLOBALS"}["ierbsmsl"] = "envVars"; $bczogurxby = "envVars"; ${$bczogurxby} = array(); while (${${"GLOBALS"}["ugsspydv"]} = $adb->fetchByAssoc(${${"GLOBALS"}["phfqsvze"]})) { ${"GLOBALS"}["mmvitgpg"] = "entity"; $lwcsgrt = "ent"; $tvqssse = "entity"; ${$tvqssse} = explode("#~~#", ${${"GLOBALS"}["ugsspydv"]}["env_vars"]); foreach (${${"GLOBALS"}["mmvitgpg"]} as ${$lwcsgrt}) { if (!in_array(${${"GLOBALS"}["pouecxkcfj"]}, ${${"GLOBALS"}["ahvvlbihd"]})) { $bqkhedsred = "ent"; $eqpxcdkmlu = "envVars"; ${$eqpxcdkmlu}[] = ${$bqkhedsred}; } } } echo "<optgroup label=\"" . getTranslatedString("LBL_GET_KNOWN_ENVVARS", "Workflow2") . "\">"; foreach (${${"GLOBALS"}["ierbsmsl"]} as ${${"GLOBALS"}["osymiilgq"]}) { ${"GLOBALS"}["ougrcnsmys"] = "var"; echo "<option value='env" . ${${"GLOBALS"}["osymiilgq"]} . "]'>\$env" . ${${"GLOBALS"}["ougrcnsmys"]} . "]</option>"; } echo "</optgroup>"; } echo "</select>"; echo "</div>"; }