} $mainData = \Workflow\VtUtils::getMainRecordData($relmod, $ids); uasort($mainData, function ($a, $b) { return strcmp($a["number"], $b["number"]); }); $html = ''; $script = ''; $fieldId = 'field_' . preg_replace('/[^a-zA-Z0-9_]/', '_', $data['name']); $field = '<select style="width:410px;" name="' . $data['name'] . '" id="' . $fieldId . '" class="select2" data-placeholder="' . vtranslate('choose Reference', 'Workflow2') . '">'; if (!empty($data['config']['nullable'])) { $field .= '<option value="" selected="selected"><em>- ' . vtranslate('no Selection', 'Workflow2') . '</em></option>'; } if (count($mainData) > 0) { foreach ($mainData as $crmid => $record) { $field .= '<option value="' . $crmid . '" data-url="' . $record['link'] . '">[' . $record['number'] . '] ' . $record['label'] . '</option>'; } } $field .= '</select>'; $html = "<label><div style='min-height:26px;padding:2px 0;'><div style=''><strong>" . $data['label'] . "</strong></div><div style='text-align:right;'>" . $field . "<div style='display:none;margin-top:5px;' id='url_" . $data['name'] . "'></div></div></div></label>"; $script = ''; if (!empty($data['config']['nullable'])) { $script .= 'jQuery("#' . $fieldId . '").select2("val", "");'; } $script .= 'jQuery("#' . $fieldId . '").on("change", function(e) {var selected = jQuery("#' . $fieldId . ' option:selected"); if(selected.val() == "") { jQuery("#url_' . $data['name'] . '").html("");return;}; jQuery("#url_' . $data['name'] . '").show().html("Link: <a href=\'" + selected.data("url") + "\' target=\'_blank\'><strong>" + selected.text() + "</strong></a>"); });'; return array('html' => $html, 'javascript' => $script); } } // The class neeeds to be registered \Workflow\Fieldtype::register('records', '\\Workflow\\Plugins\\Fieldtypes\\Records');
$script = ''; $fieldId = 'field_' . preg_replace('/[^a-zA-Z0-9_]/', '_', $data['name']); $field1 = '<div class="insertReferencefield" style="float:right;" data-name="' . $data['name'] . '][accountid" data-module="Accounts"></div>'; $field2 = '<div class="insertReferencefield" style="float:right;" data-name="' . $data['name'] . '][contactid" data-module="Contacts" data-parentfield="' . $data['name'] . '][accountid"></div>'; $html .= "<label><div style='min-height:26px;padding:2px 0;'><div style=''><strong>" . $data['label'] . "</strong></div><div style='text-align:right;'><div style='overflow:hidden;'><strong>Organization</strong><br/>" . $field1 . "</div><div style='overflow:hidden;'><strong>Contact</strong><br/>" . $field2 . "</div></div></div></label>"; $script = ''; if (!empty($data['config']['nullable'])) { $script .= 'jQuery("#' . $fieldId . '").select2("val", "");'; } $script .= 'jQuery(function() { jQuery("#contactid_contactid_display").attr("readonly", "readonly"); });'; return array('html' => $html, 'javascript' => $script); } /** * @param $value * @param $name * @param $type * @param $context VTEntity * @param $allValues * @param $fieldConfig * @return mixed */ public function getValue($value, $name, $type, $context, $allValues, $fieldConfig) { $orgaField = $fieldConfig['orgaid']; $context->setEnvironment($orgaField, $value['accountid']); return $value['contactid']; } } // The class neeeds to be registered \Workflow\Fieldtype::register('contact', '\\Workflow\\Plugins\\Fieldtypes\\Contact');
break; case 'text': default: $field = '<input type="text" id="reqfield_' . $data['name'] . '" style="width:400px;" name="' . $data['name'] . '" value="' . $data['config']["default"] . '">'; break; } $html = "<label><div style='min-height:26px;padding:2px 0;'><div style=''><strong>" . $data['label'] . "</strong></div><div style='text-align:right;'>" . $field . "</div></div></label>"; return array('html' => $html, 'javascript' => $script); } /** * @param $value * @param $name * @param $type * @param \Workflow\VTEntity $context * @return \type */ public function getValue($value, $name, $type, $context) { if ($type == 'date') { $value = \DateTimeField::convertToDBFormat($value); } if ($type == 'file') { // var_dump($value, $name, $type, $_FILES, $this); $context->addTempFile($_FILES['fileUpload']['tmp_name'][$name], $value, $_FILES['fileUpload']['name'][$name]); return '1'; } return $value; } } \Workflow\Fieldtype::register('core', '\\Workflow\\Plugins\\Fieldtypes\\Core');
public function renderFrontend($context, $data) { ${"GLOBALS"}["euplsolgq"] = "html"; $lknnefy = "fieldData"; $gvawfdbbp = "data"; $mwrytupspdof = "data"; if (empty(${$mwrytupspdof}[$this->field . "_version"]) || ${${"GLOBALS"}["woxwiglozmm"]}[$this->field . "_version"] < FormGenerator::VERSION) { ${"GLOBALS"}["ouscqqthdmz"] = "data"; ${${"GLOBALS"}["woxwiglozmm"]}[$this->field] = $this->upgrade(intval(${${"GLOBALS"}["ouscqqthdmz"]}[$this->field . "_version"]), ${${"GLOBALS"}["woxwiglozmm"]}[$this->field]); } ${$lknnefy} = ${$gvawfdbbp}[$this->field]; ${${"GLOBALS"}["wbophh"]} = array("html" => "", "script" => ""); foreach (${${"GLOBALS"}["utojvxeag"]} as ${${"GLOBALS"}["woxwiglozmm"]}) { $shjfnabbfdg = "context"; ${"GLOBALS"}["ikxisoop"] = "data"; $jnyccxl = "field"; ${${"GLOBALS"}["rkyxrpi"]} = \Workflow\Fieldtype::getType(${${"GLOBALS"}["ikxisoop"]}["type"]); ${${"GLOBALS"}["qqfsrkkxdg"]} = $type->renderFrontend(${${"GLOBALS"}["woxwiglozmm"]}, ${$shjfnabbfdg}); ${${"GLOBALS"}["wbophh"]}["html"] .= ${${"GLOBALS"}["qqfsrkkxdg"]}["html"] . "<input type=\"hidden\" name=\"_fieldtype][" . ${${"GLOBALS"}["woxwiglozmm"]}["name"] . "\" value=\"" . ${${"GLOBALS"}["woxwiglozmm"]}["type"] . "\" />"; ${${"GLOBALS"}["wbophh"]}["javascript"] .= ${$jnyccxl}["javascript"]; } return ${${"GLOBALS"}["euplsolgq"]}; }
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(); }
$mainData = \Workflow\VtUtils::getMainRecordData($relmod, $records); $fieldId = 'field_' . preg_replace('/[^a-zA-Z0-9_]/', '_', $data['name']); uasort($mainData, function ($a, $b) { return strcmp($a["number"], $b["number"]); }); } $html = ''; $script = ''; $field = '<select style="width:410px;" name="' . $data['name'] . '" id="' . $fieldId . '" class="select2" data-placeholder="' . vtranslate('choose Reference', 'Workflow2') . '">'; if (!empty($data['config']['nullable'])) { $field .= '<option value="" selected="selected"><em>- ' . vtranslate('no Selection', 'Workflow2') . '</em></option>'; } if (count($mainData) > 0) { foreach ($mainData as $crmid => $record) { $field .= '<option value="' . $crmid . '" data-url="' . $record['link'] . '">[' . $record['number'] . '] ' . $record['label'] . '</option>'; } } $field .= '</select>'; $html = "<label><div style='min-height:26px;padding:2px 0;'><div style=''><strong>" . $data['label'] . "</strong></div><div style='text-align:right;'>" . $field . "<div style='display:none;margin-top:5px;' id='url_" . $data['name'] . "'></div></div></div></label>"; $script = ''; if (!empty($data['config']['nullable'])) { $script .= 'jQuery("#' . $fieldId . '").select2("val", "");'; } $script .= 'jQuery("#' . $fieldId . '").on("change", function(e) {var selected = jQuery("#' . $fieldId . ' option:selected"); if(selected.val() == "") { jQuery("#url_' . $data['name'] . '").html("");return;}; jQuery("#url_' . $data['name'] . '").show().html("Link: <a href=\'" + selected.data("url") + "\' target=\'_blank\'><strong>" + selected.text() + "</strong></a>"); });'; return array('html' => $html, 'javascript' => $script); } } // The class neeeds to be registered \Workflow\Fieldtype::register('reference', '\\Workflow\\Plugins\\Fieldtypes\\Reference');