public function process(Vtiger_Request $request) { if ($_FILES['import_file']['error'] == 0) { $tmp_file_name = $_FILES['import_file']['tmp_name']; $fh = fopen($tmp_file_name, "r"); $xml_content = fread($fh, filesize($tmp_file_name)); fclose($fh); $PDFMaker = new PDFMaker_PDFMaker_Model(); $adb = PearDatabase::getInstance(); $xml = new SimpleXMLElement($xml_content); foreach ($xml->template as $data) { $filename = $this->cdataDecode($data->templatename); $nameOfFile = $this->cdataDecode($data->filename); $description = $this->cdataDecode($data->description); $modulename = $this->cdataDecode($data->module); $pdf_format = $this->cdataDecode($data->settings->format); $pdf_orientation = $this->cdataDecode($data->settings->orientation); $tabid = getTabId($modulename); if ($PDFMaker->GetVersionType() == "professional" || in_array($tabid, $PDFMaker->GetBasicModules())) { if ($data->settings->margins->top > 0) { $margin_top = $data->settings->margins->top; } else { $margin_top = 0; } if ($data->settings->margins->bottom > 0) { $margin_bottom = $data->settings->margins->bottom; } else { $margin_bottom = 0; } if ($data->settings->margins->left > 0) { $margin_left = $data->settings->margins->left; } else { $margin_left = 0; } if ($data->settings->margins->right > 0) { $margin_right = $data->settings->margins->right; } else { $margin_right = 0; } $dec_point = $this->cdataDecode($data->settings->decimals->point); $dec_decimals = $this->cdataDecode($data->settings->decimals->decimals); $dec_thousands = $this->cdataDecode($data->settings->decimals->thousands); $header = $this->cdataDecode($data->header); $body = $this->cdataDecode($data->body); $footer = $this->cdataDecode($data->footer); $templateid = $adb->getUniqueID('vtiger_pdfmaker'); $sql1 = "insert into vtiger_pdfmaker (filename,module,description,body,deleted,templateid) values (?,?,?,?,?,?)"; $params1 = array($filename, $modulename, $description, $body, 0, $templateid); $adb->pquery($sql1, $params1); $sql2 = "INSERT INTO vtiger_pdfmaker_settings (templateid, margin_top, margin_bottom, margin_left, margin_right, format, orientation, decimals, decimal_point, thousands_separator, header, footer, encoding, file_name) \n VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; $params2 = array($templateid, $margin_top, $margin_bottom, $margin_left, $margin_right, $pdf_format, $pdf_orientation, $dec_decimals, $dec_point, $dec_thousands, $header, $footer, "auto", $nameOfFile); $adb->pquery($sql2, $params2); $PDFMaker->AddLinks($modulename); } } } header('Location: index.php?module=PDFMaker&view=List'); }
public function getFieldUI(Vtiger_Request $request) { $fieldsList = $request->get('fieldIdList'); $module = $request->get('sourceModule'); $fieldModelList = Settings_LayoutEditor_Field_Model::getInstanceFromFieldId($fieldsList, getTabId($module)); $viewer = $this->getViewer($request); $qualifiedModuleName = $request->getModule(false); $viewer->assign('SELECTED_MODULE_NAME', $module); $viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel()); $viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName); $viewer->assign('FIELD_MODELS_LIST', $fieldModelList); $viewer->view('FieldUi.tpl', $qualifiedModuleName); }
public function process(Vtiger_Request $request) { ${"GLOBALS"}["ekosczsy"] = "tabid"; ${${"GLOBALS"}["ekosczsy"]} = getTabId($request->get("workflowModule")); ${"GLOBALS"}["mhuirymtoy"] = "tabid"; ${${"GLOBALS"}["hvamuhbnnwu"]} = \PearDatabase::getInstance(); if ($request->get("hidden") == true) { ob_start(); } if (!empty(${${"GLOBALS"}["mhuirymtoy"]})) { ${"GLOBALS"}["outajbzyo"] = "result"; ${${"GLOBALS"}["rnhwfqjyx"]} = "SELECT linkid FROM vtiger_links WHERE linktype = 'DETAILVIEWSIDEBARWIDGET' AND linklabel = 'Workflows' AND tabid = " . ${${"GLOBALS"}["bxwgaby"]}; ${${"GLOBALS"}["dsrfsmvy"]} = $adb->query(${${"GLOBALS"}["rnhwfqjyx"]}); ${${"GLOBALS"}["xdyqgnxwn"]} = $request->get("MODE"); $xyxnkgw = "mode"; if (${${"GLOBALS"}["xdyqgnxwn"]} == "ADD" && $adb->num_rows(${${"GLOBALS"}["outajbzyo"]}) > 1) { ${"GLOBALS"}["cnubqpsfrtf"] = "tabid"; $adb->query("DELETE FROM vtiger_links WHERE (linktype = 'DETAILVIEWSIDEBARWIDGET' OR linktype = 'LISTVIEWSIDEBARWIDGET') AND linklabel = 'Workflows' AND tabid = " . ${${"GLOBALS"}["bxwgaby"]}, true); ${${"GLOBALS"}["rnhwfqjyx"]} = "SELECT linkid FROM vtiger_links WHERE linktype = 'DETAILVIEWSIDEBARWIDGET' AND linklabel = 'Workflows' AND tabid = " . ${${"GLOBALS"}["cnubqpsfrtf"]}; ${${"GLOBALS"}["dsrfsmvy"]} = $adb->query(${${"GLOBALS"}["rnhwfqjyx"]}); } if (${${"GLOBALS"}["xdyqgnxwn"]} == "DEL" || empty(${$xyxnkgw}) && $adb->num_rows(${${"GLOBALS"}["dsrfsmvy"]}) > 0) { ${"GLOBALS"}["jywgricc"] = "tabid"; $lxcddedp = "mode"; ${$lxcddedp} = "DEL"; $adb->query("DELETE FROM vtiger_links WHERE (linktype = 'DETAILVIEWSIDEBARWIDGET' OR linktype = 'LISTVIEWSIDEBARWIDGET') AND linklabel = 'Workflows' AND tabid = " . ${${"GLOBALS"}["jywgricc"]}, true); echo getTranslatedString("LBL_ACTIVATE_SIDEBAR", "Settings:Workflow2"); } elseif ($adb->num_rows(${${"GLOBALS"}["dsrfsmvy"]}) == 0) { ${"GLOBALS"}["ocotbv"] = "mode"; ${${"GLOBALS"}["ocotbv"]} = "ADD"; ${"GLOBALS"}["hdlxhrdrllur"] = "linkid"; ${${"GLOBALS"}["rzgmacoc"]} = $adb->getUniqueID("vtiger_links"); $adb->query("INSERT INTO vtiger_links SET linkid = '" . ${${"GLOBALS"}["rzgmacoc"]} . "',linktype = 'DETAILVIEWSIDEBARWIDGET', linklabel = 'Workflows', tabid = " . ${${"GLOBALS"}["bxwgaby"]} . ",linkurl='" . "module=Workflow2&view=SidebarWidget" . "'", true); ${${"GLOBALS"}["rzgmacoc"]} = $adb->getUniqueID("vtiger_links"); $qcahtlck = "tabid"; $adb->query("INSERT INTO vtiger_links SET linkid = '" . ${${"GLOBALS"}["hdlxhrdrllur"]} . "',linktype = 'LISTVIEWSIDEBARWIDGET', linklabel = 'Workflows', tabid = " . ${$qcahtlck} . ",linkurl='" . "module=Workflow2&src_module=" . $request->get("workflowModule") . "&view=SidebarListWidget" . "'", true); echo getTranslatedString("LBL_DEACTIVATE_SIDEBAR", "Settings:Workflow2"); } } if ($request->get("hidden") == true) { ob_end_clean(); } if ($request->get("workflowModule") == "Calendar") { ${"GLOBALS"}["jrpyqoyvdoz"] = "request2"; ${${"GLOBALS"}["jrpyqoyvdoz"]} = ${${"GLOBALS"}["ognxjavta"]}; $request->set("MODE", ${${"GLOBALS"}["xdyqgnxwn"]}); $request->set("workflowModule", "Events"); $request->set("hidden", true); $this->process(${${"GLOBALS"}["ognxjavta"]}); } }
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"]}); }
/** * Function to initialize the sortby fields array */ function initSortByField($module) { global $adb, $log; $log->debug("Entering function initSortByField ({$module})"); // Define the columnname's and uitype's which needs to be excluded $exclude_columns = array('parent_id', 'quoteid', 'vendorid', 'access_count'); $exclude_uitypes = array(); $tabid = getTabId($module); if ($module == 'Calendar') { $tabid = array('9', '16'); } $sql = "SELECT columnname FROM vtiger_field " . " WHERE (fieldname not like '%\\_id' OR fieldname in ('assigned_user_id'))" . " AND tabid in (" . generateQuestionMarks($tabid) . ") and vtiger_field.presence in (0,2)"; $params = array($tabid); if (count($exclude_columns) > 0) { $sql .= " AND columnname NOT IN (" . generateQuestionMarks($exclude_columns) . ")"; array_push($params, $exclude_columns); } if (count($exclude_uitypes) > 0) { $sql .= " AND uitype NOT IN (" . generateQuestionMarks($exclude_uitypes) . ")"; array_push($params, $exclude_uitypes); } $result = $adb->pquery($sql, $params); $num_rows = $adb->num_rows($result); for ($i = 0; $i < $num_rows; $i++) { $columnname = $adb->query_result($result, $i, 'columnname'); if (in_array($columnname, $this->sortby_fields)) { continue; } else { $this->sortby_fields[] = $columnname; } } if ($tabid == 21 or $tabid == 22) { $this->sortby_fields[] = 'crmid'; } $log->debug("Exiting initSortByField"); }
if ($record == "" && $save != "") { $Calendar4You->SaveView($Type_Ids, $Users_Ids, $all_users, $Load_Event_Status, $Load_Task_Status); } $detailview_permissions = $Calendar4You->CheckPermissions("DETAIL"); require 'user_privileges/user_privileges_' . $current_user->id . '.php'; require 'user_privileges/sharing_privileges_' . $current_user->id . '.php'; $ParentUsers = array(); $u_query = "select vtiger_user2role.userid as id from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like ?"; $u_params = array($current_user_parent_role_seq . "::%"); $u_result = $adb->pquery($u_query, $u_params); while ($u_row = $adb->fetchByAssoc($u_result)) { $ParentUsers[] = $u_row["id"]; } $view = convertFullCalendarView($full_calendar_view); $calendar_tabid = getTabId("Calendar"); $events_tabid = getTabId("Events"); $Showed_Field = array(); $Event_Info = array(); if ($detailview_permissions) { $sql0 = "SELECT * FROM its4you_calendar4you_event_fields WHERE userid = ? AND view = ?"; $result0 = $adb->pquery($sql0, array($current_user->id, $view)); $num_rows0 = $adb->num_rows($result0); if ($num_rows0 > 0) { while ($row0 = $adb->fetchByAssoc($result0)) { $sql01 = "SELECT uitype, columnname, fieldlabel FROM vtiger_field WHERE fieldname = ? AND tabid IN (?,?)"; $result01 = $adb->pquery($sql01, array($row0['fieldname'], $calendar_tabid, $events_tabid)); $columnname = $adb->query_result($result01, 0, "columnname"); $fieldlabel = $adb->query_result($result01, 0, "fieldlabel"); $uitype = $adb->query_result($result01, 0, "uitype"); $Field_data = array("fieldname" => $row0['fieldname'], "columnname" => $columnname, "fieldlabel" => $fieldlabel, "uitype" => $uitype); if ($row0['type'] == "1") {
/** Function to get field that is to be compared in query form for the given Comparator and field * @ param $field : field * returns the value for the comparator */ function getFilterComparedField($field) { global $adb, $ogReport; if (!empty($this->secondarymodule)) { $secModules = explode(':', $this->secondarymodule); foreach ($secModules as $secModule) { $secondary = CRMEntity::getInstance($secModule); $this->queryPlanner->addTable($secondary->table_name); } } $field = split('#', $field); $module = $field[0]; $fieldname = trim($field[1]); $tabid = getTabId($module); $field_query = $adb->pquery("SELECT tablename,columnname,typeofdata,fieldname,uitype FROM vtiger_field WHERE tabid = ? AND fieldname= ?", array($tabid, $fieldname)); $fieldtablename = $adb->query_result($field_query, 0, 'tablename'); $fieldcolname = $adb->query_result($field_query, 0, 'columnname'); $typeofdata = $adb->query_result($field_query, 0, 'typeofdata'); $fieldtypeofdata = ChangeTypeOfData_Filter($fieldtablename, $fieldcolname, $typeofdata[0]); $uitype = $adb->query_result($field_query, 0, 'uitype'); /* if($tr[0]==$ogReport->primodule) $value = $adb->query_result($field_query,0,'tablename').".".$adb->query_result($field_query,0,'columnname'); else $value = $adb->query_result($field_query,0,'tablename').$tr[0].".".$adb->query_result($field_query,0,'columnname'); */ if ($uitype == 68 || $uitype == 59) { $fieldtypeofdata = 'V'; } if ($fieldtablename == "vtiger_crmentity") { $fieldtablename = $fieldtablename . $module; } if ($fieldname == "assigned_user_id") { $fieldtablename = "vtiger_users" . $module; $fieldcolname = "user_name"; } if ($fieldname == "account_id") { $fieldtablename = "vtiger_account" . $module; $fieldcolname = "accountname"; } if ($fieldname == "contact_id") { $fieldtablename = "vtiger_contactdetails" . $module; $fieldcolname = "lastname"; } if ($fieldname == "parent_id") { $fieldtablename = "vtiger_crmentityRel" . $module; $fieldcolname = "setype"; } if ($fieldname == "vendor_id") { $fieldtablename = "vtiger_vendorRel" . $module; $fieldcolname = "vendorname"; } if ($fieldname == "potential_id") { $fieldtablename = "vtiger_potentialRel" . $module; $fieldcolname = "potentialname"; } if ($fieldname == "assigned_user_id1") { $fieldtablename = "vtiger_usersRel1"; $fieldcolname = "user_name"; } if ($fieldname == 'quote_id') { $fieldtablename = "vtiger_quotes" . $module; $fieldcolname = "subject"; } if ($fieldname == 'product_id' && $fieldtablename == 'vtiger_troubletickets') { $fieldtablename = "vtiger_productsRel"; $fieldcolname = "productname"; } if ($fieldname == 'product_id' && $fieldtablename == 'vtiger_campaign') { $fieldtablename = "vtiger_productsCampaigns"; $fieldcolname = "productname"; } if ($fieldname == 'product_id' && $fieldtablename == 'vtiger_products') { $fieldtablename = "vtiger_productsProducts"; $fieldcolname = "productname"; } if ($fieldname == 'campaignid' && $module == 'Potentials') { $fieldtablename = "vtiger_campaign" . $module; $fieldcolname = "campaignname"; } $value = $fieldtablename . "." . $fieldcolname; $this->queryPlanner->addTable($fieldtablename); return $value; }
$dropflds = array('com_vtiger_workflows.schtypeid', 'com_vtiger_workflows.schtime', 'com_vtiger_workflows.schdayofmonth', 'com_vtiger_workflows.schdayofweek', 'com_vtiger_workflows.schannualdates', 'com_vtiger_workflows.nexttrigger_time', 'vtiger_mailmanager_mailattachments.cid', 'vtiger_mailscanner_rules.assigned_to', 'vtiger_mailscanner_rules.cc', 'vtiger_mailscanner_rules.bcc', 'vtiger_recurringevents.recurringenddate', 'vtiger_mailscanner.time_zone', 'vtiger_portal.createdtime', 'vtiger_mail_accounts.sent_folder', 'vtiger_organizationdetails.vatid', 'vtiger_tab.trial'); foreach ($dropflds as $fqfn) { list($table, $field) = explode('.', $fqfn); ExecuteQuery("ALTER TABLE {$table} DROP {$field}"); } $droptable = array('vtiger_feedback', 'vtiger_shareduserinfo', 'vtiger_schedulereports', 'vtiger_calendar_default_activitytypes', 'vtiger_calendar_user_activitytypes', 'vtiger_reporttype'); foreach ($droptable as $table) { ExecuteQuery("DROP TABLE {$table}"); } //Schema changes for vtiger_troubletickets hours & days column ExecuteQuery('ALTER TABLE vtiger_troubletickets MODIFY hours varchar(200)', array()); ExecuteQuery('ALTER TABLE vtiger_troubletickets MODIFY days varchar(200)', array()); ExecuteQuery('UPDATE vtiger_field set typeofdata=? WHERE fieldname IN(?,?) AND tablename = ?', array('I~O', 'hours', 'days', 'vtiger_troubletickets')); Vtiger_Cron::deregister('ScheduleReports'); //Updating actions for PriceBooks related list in Products and Services $productsTabId = getTabId('Products'); ExecuteQuery('UPDATE vtiger_relatedlists SET actions=? WHERE label=? and tabid=?', array('ADD', 'PriceBooks', $productsTabId)); $eventsManager = new VTEventsManager($adb); $eventsManager->unregisterHandler('Vtiger_RecordLabelUpdater_Handler'); //Start: Customer - Feature #17656 Allow users to add/remove date format with the date fields in workflow send mail task. $fieldResult = $adb->pquery('SELECT fieldname, name, typeofdata FROM vtiger_field INNER JOIN vtiger_tab ON vtiger_tab.tabid = vtiger_field.tabid WHERE typeofdata LIKE ?', array('D%')); $dateFieldsList = $dateTimeFieldsList = array(); while ($rowData = $adb->fetch_array($fieldResult)) { $moduleName = $rowData['name']; $fieldName = $rowData['fieldname']; $pos = stripos($rowData['typeofdata'], 'DT'); if ($pos !== false) { $dateTimeFieldsList[$moduleName][$fieldName] = $fieldName; } else { $dateFieldsList[$moduleName][$fieldName] = $fieldName;
public function showStatistikForm($viewer) { global $adb; $class = CRMEntity::getInstance($this->getModuleName()); $fieldname = $class->list_link_field; $sql = "SELECT columnname, tablename FROM vtiger_field WHERE tabid = " . getTabId($this->getModuleName()) . " AND fieldname = ?"; $result = $adb->pquery($sql, array($fieldname)); $columnName = $adb->query_result($result, 0, "columnname"); $tableName = $adb->query_result($result, 0, "tablename"); $sql = "SELECT vtiger_wf_queue.*, recordTBL." . $columnName . " as title\n FROM vtiger_wf_queue\n LEFT JOIN " . $tableName . " as recordTBL ON (recordTBL." . $class->table_index . " = vtiger_wf_queue.crmid)\n WHERE block_id = " . $this->_taskID; $result = $adb->query($sql, true); $waiting = array(); while ($row = $adb->fetch_array($result)) { $row["timestamp"] = VtUtils::formatUserDate(VtUtils::convertToUserTZ($row["timestamp"])); $row["nextsteptime"] = VtUtils::formatUserDate(VtUtils::convertToUserTZ($row["nextsteptime"])); $waiting[] = $row; } $viewer->assign("waiting", $waiting); }
$usersTabId = getTabId('Users'); $blockIds = array(); $blockIds[] = getBlockId($usersTabId, 'LBL_USERLOGIN_ROLE'); $blockIds[] = getBlockId($usersTabId, 'LBL_CALENDAR_SETTINGS'); $updateQuery = "UPDATE vtiger_field SET sequence = CASE fieldname "; foreach ($userFields as $fieldName) { if ($fieldName == 'dayoftheweek') { $sequence = 0; } $updateQuery .= " WHEN '{$fieldName}' THEN " . ++$sequence; } $updateQuery .= " END WHERE tabid = {$usersTabId} AND block IN (" . generateQuestionMarks($blockIds) . ")"; Migration_Index_View::ExecuteQuery($updateQuery, $blockIds); echo "<br>User Fields Sequence Updated"; // updating Emails module in sharing access rules $EmailsTabId = getTabId('Emails'); $query = "SELECT tabid FROM vtiger_def_org_share"; $result = $adb->pquery($query, array()); $resultCount = $adb->num_rows($result); $exist = false; for ($i = 0; $i < $resultCount; $i++) { $tabid = $adb->query_result($result, $i, 'tabid'); if ($tabid == $EmailsTabId) { $exist = true; echo 'Emails Sharing Access entry already exist'; break; } } if (!$exist) { $ruleid = $adb->getUniqueID('vtiger_def_org_share'); $shareaccessquery = "INSERT INTO vtiger_def_org_share VALUES(?,?,?,?)";
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>"; }
public function removeLinks() { require_once 'vtlib/Vtiger/Link.php'; $tabid = getTabId("XMLExport4You"); Vtiger_Link::deleteAll($tabid); $this->DeleteAllRefLinks(); }
private function x0b() { global $x0b, $x0c, $x0d, $x0e, $x0f, $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17, $x18, $x19, $x1a, $x1b, $x1c, $x1d, $x1e, $x1f, $x20, $x21, $x22, $x23, $x24, $x25, $x26; $sql = "SELECT fieldid, fieldname, uitype\r\r\n FROM vtiger_field\r\n WHERE tabid=" . getTabId($this->module) . " AND (displaytype != 3 OR fieldid = 64) AND fieldid != 105"; $result = $this->db->query($sql); $num_rows = $this->db->num_rows($result); if ($num_rows > 0) { while ($row = $this->db->fetch_array($result)) { $related_module = ""; $fk_record = $this->focus->column_fields[$row["fieldname"]]; switch ($row["uitype"]) { case "51": $related_module = "Accounts"; break; case "57": $related_module = "Contacts"; break; case "58": $related_module = "Campaigns"; break; case "59": $related_module = "Products"; break; case "73": $related_module = "Accounts"; break; case "75": $related_module = "Vendors"; break; case "81": $related_module = "Vendors"; break; case "76": $related_module = "Potentials"; break; case "78": $related_module = "Quotes"; break; case "80": $related_module = "SalesOrder"; break; case "68": case "10": $related_module = getSalesEntityType($fk_record); break; } if ($related_module != "") { $tabid = getTabId($related_module); $field_inf = "_fieldinfo_cache"; $temp =& VTCacheUtils::${$field_inf}; unset($temp[$tabid]); $focus2 = CRMEntity::getInstance($related_module); if ($fk_record != "" && $fk_record != "0") { $result_delete = $this->db->query("SELECT deleted FROM vtiger_crmentity WHERE crmid='" . $fk_record . "' AND deleted=0"); if ($this->db->num_rows($result_delete) > 0) { $focus2->retrieve_entity_info($fk_record, $related_module); $focus2->id = $fk_record; } } $this->replacements["\$" . "R_" . $x22($related_module) . "_CRMID\$"] = $focus2->id; if (isset($related_module) and $related_module == "Contacts") { $this->replacements['$R_CONTACTS_IMAGENAME$'] = $this->x18($focus2->id); } $this->x12(); $this->x0e($related_module, $focus2, true); unset($focus2); } if ($row["uitype"] == "10" || $row["uitype"] == "68") { if ($related_module == "Accounts") { $related_module2 = "Contacts"; } else { $related_module2 = "Accounts"; } $tabid2 = getTabId($related_module2); $field_inf = "_fieldinfo_cache"; $temp =& VTCacheUtils::${$field_inf}; unset($temp[$tabid2]); $focus3 = CRMEntity::getInstance($related_module2); $this->replacements["\$" . "R_" . $x22($related_module2) . "_CRMID\$"] = $focus3->id; $this->x0e($related_module2, $focus3, true); unset($focus3); } } } }
private function _checkField($check) { $hokekyg = "check"; $irkmjqniy = "check"; $vuomcowj = "check"; $qxtftfelfc = "checkvalue"; global $adb; if (${$vuomcowj}["mode"] == "value" || empty(${$hokekyg}["mode"])) { $ljuuqqmpe = "checkvalue"; $qlncurmce = "check"; ${"GLOBALS"}["sjpunfxie"] = "checkvalue"; ${$ljuuqqmpe} = ${$qlncurmce}["rawvalue"]; if (strpos(${${"GLOBALS"}["mhtrtpoxqog"]}, "\$") !== false || strpos(${${"GLOBALS"}["sjpunfxie"]}, "?") !== false) { $kasuqypyri = "objTemplate"; ${$kasuqypyri} = new VTTemplate($this->_context); ${${"GLOBALS"}["mhtrtpoxqog"]} = $objTemplate->render(${${"GLOBALS"}["mhtrtpoxqog"]}); } } elseif (${$irkmjqniy}["mode"] == "function") { $mslifxq = "parser"; ${$mslifxq} = new ExpressionParser(${${"GLOBALS"}["eikcioit"]}["rawvalue"], $this->_context, false); try { $parser->run(); } catch (ExpressionException $exp) { \Workflow2::error_handler(E_EXPRESSION_ERROR, $exp->getMessage(), "", ""); } ${${"GLOBALS"}["mhtrtpoxqog"]} = $parser->getReturn(); } if (preg_match("/^([0-9]+)x([0-9]+)\$/", ${${"GLOBALS"}["mhtrtpoxqog"]}, ${${"GLOBALS"}["rltbvvdxzi"]})) { ${${"GLOBALS"}["mhtrtpoxqog"]} = ${${"GLOBALS"}["rltbvvdxzi"]}[2]; } $qpbidpqzyuq = "check"; if (${$qpbidpqzyuq}["field"] != "crmid") { $opnieudoijq = "result"; $icdvseqgj = "sql"; $wedbbjpbzg = "check"; ${"GLOBALS"}["ssickqrh"] = "result"; $lguveyud = "referenceUitypes"; ${"GLOBALS"}["fhxqfbe"] = "check"; ${$icdvseqgj} = "SELECT columnname, tablename, uitype FROM vtiger_field WHERE (fieldname = ? OR columnname = ?) AND tabid = " . getTabId($this->_module); ${"GLOBALS"}["ufdgmzwrnd"] = "fieldData"; ${$opnieudoijq} = $adb->pquery(${${"GLOBALS"}["gewfwuwzyf"]}, array(${${"GLOBALS"}["fhxqfbe"]}["field"], ${$wedbbjpbzg}["field"]), true); $vnwwwkurvnc = "fieldData"; ${${"GLOBALS"}["ufdgmzwrnd"]} = $adb->fetchByAssoc(${${"GLOBALS"}["ssickqrh"]}); if (${$vnwwwkurvnc}["columnname"] == "idlists" && $this->_module == "Emails") { ${${"GLOBALS"}["skdkydufqc"]} = array("vtiger_seactivityrel`.`crmid"); } else { $dknamdhd = "fieldData"; ${${"GLOBALS"}["skdkydufqc"]} = array("" . ${${"GLOBALS"}["chbluaeolj"]}["tablename"] . "`.`" . ${$dknamdhd}["columnname"]); } if (in_array(intval(${${"GLOBALS"}["chbluaeolj"]}["uitype"]), VtUtils::${$lguveyud})) { ${"GLOBALS"}["usovmy"] = "fieldData"; ${"GLOBALS"}["fcynigpd"] = "modules"; ${"GLOBALS"}["mxfotnkuck"] = "modules"; ${${"GLOBALS"}["mxfotnkuck"]} = VtUtils::getModuleForReference(getTabId($this->_module), ${${"GLOBALS"}["eikcioit"]}["field"], ${${"GLOBALS"}["usovmy"]}["uitype"]); if (count(${${"GLOBALS"}["fcynigpd"]}) == 1) { foreach (${${"GLOBALS"}["mkwcgvqozj"]} as ${${"GLOBALS"}["nrfjjlktok"]}) { ${"GLOBALS"}["ynidmvalhyi"] = "tableName"; $cegjqy = "fieldNames"; ${"GLOBALS"}["fjvfyzyeo"] = "tmpFocus"; $npekrqhn = "tableName"; $gbhhegbtpt = "fieldData"; ${"GLOBALS"}["iijrcvdcux"] = "check"; ${${"GLOBALS"}["fjvfyzyeo"]} = \CRMEntity::getInstance(${${"GLOBALS"}["nrfjjlktok"]}); ${$npekrqhn} = "t" . count($this->_joinTables) . "_" . ${${"GLOBALS"}["nrfjjlktok"]} . "_" . ${${"GLOBALS"}["iijrcvdcux"]}["field"] . ""; $this->_joinTables[] = "LEFT JOIN " . $tmpFocus->table_name . " as " . ${${"GLOBALS"}["vudkckyuiho"]} . " ON (`" . ${${"GLOBALS"}["ynidmvalhyi"]} . "`.`" . $tmpFocus->table_index . "` = `" . ${${"GLOBALS"}["skdkydufqc"]}[0] . "`)"; ${${"GLOBALS"}["chbluaeolj"]}["tablename"] = ${${"GLOBALS"}["vudkckyuiho"]}; ${${"GLOBALS"}["chbluaeolj"]}["columnname"] = $tmpFocus->list_link_field; ${$cegjqy}[] = "" . ${${"GLOBALS"}["chbluaeolj"]}["tablename"] . "`.`" . ${$gbhhegbtpt}["columnname"]; } } } } else { $qivvqrqqp = "fieldNames"; ${$qivvqrqqp} = array("vtiger_crmentity`.`crmid"); } $kmvwkdvr = "fieldNames"; $this->log("Check field: " . ${${"GLOBALS"}["eikcioit"]}["field"] . " " . ${${"GLOBALS"}["eikcioit"]}["operation"] . " - " . ${$qxtftfelfc}); if (!empty(${${"GLOBALS"}["eikcioit"]}["not"])) { ${"GLOBALS"}["msavtqzgbd"] = "not"; ${${"GLOBALS"}["msavtqzgbd"]} = true; } else { $plzzuz = "not"; ${$plzzuz} = false; } ${${"GLOBALS"}["dewpeeyj"]} = array(); foreach (${$kmvwkdvr} as ${${"GLOBALS"}["mtsrsml"]}) { ${"GLOBALS"}["pnlaybj"] = "fieldName"; ${"GLOBALS"}["rgeraojxbe"] = "tmpSQL"; $gysrpkkbjro = "not"; ${"GLOBALS"}["xoeshlppye"] = "tmpSQL"; ${"GLOBALS"}["ufiulnugtpse"] = "not"; ${"GLOBALS"}["oihhykbnakpg"] = "tmpSQL"; ${"GLOBALS"}["jhgyja"] = "fieldName"; $ocjyevynyxer = "fieldName"; $ddtsdwnjdi = "tmpSQL"; ${"GLOBALS"}["irkqsiczmnje"] = "fieldName"; ${"GLOBALS"}["xzodapm"] = "not"; $wwqfpoc = "tmpSQL"; $firifzks = "fieldName"; ${"GLOBALS"}["glhofthvju"] = "fieldName"; $djtrtm = "checkvalue"; $fxmphdvibp = "checkvalue"; $ppsxsaud = "check"; ${"GLOBALS"}["ctfovcryrmyx"] = "checkvalue"; switch (${$ppsxsaud}["operation"]) { case "equal": ${${"GLOBALS"}["dewpeeyj"]}[] = "`" . ${$firifzks} . "` " . (${${"GLOBALS"}["gltggtgnj"]} ? "!" : "") . "= " . $adb->quote(${${"GLOBALS"}["ctfovcryrmyx"]}) . ""; break; case "contains": ${${"GLOBALS"}["xoeshlppye"]}[] = "`" . ${${"GLOBALS"}["mtsrsml"]} . "` " . (${${"GLOBALS"}["gltggtgnj"]} ? "NOT " : "") . "LIKE " . $adb->quote("%" . ${${"GLOBALS"}["mhtrtpoxqog"]} . "%") . ""; break; case "starts_with": ${${"GLOBALS"}["dewpeeyj"]}[] = "`" . ${${"GLOBALS"}["pnlaybj"]} . "` " . (${${"GLOBALS"}["xzodapm"]} ? "NOT " : "") . "LIKE " . $adb->quote(${${"GLOBALS"}["mhtrtpoxqog"]} . "%") . ""; break; case "ends_with": ${${"GLOBALS"}["oihhykbnakpg"]}[] = "`" . ${${"GLOBALS"}["mtsrsml"]} . "` " . (${${"GLOBALS"}["gltggtgnj"]} ? "NOT " : "") . "LIKE " . $adb->quote("%" . ${$fxmphdvibp} . "") . ""; break; case "bigger": ${$wwqfpoc}[] = "`" . ${${"GLOBALS"}["irkqsiczmnje"]} . "` " . (${${"GLOBALS"}["gltggtgnj"]} ? "<=" : ">") . " " . $adb->quote("" . ${${"GLOBALS"}["mhtrtpoxqog"]} . "") . ""; break; case "lower": ${${"GLOBALS"}["dewpeeyj"]}[] = "`" . ${$ocjyevynyxer} . "` " . (${${"GLOBALS"}["gltggtgnj"]} ? ">=" : "<") . " " . $adb->quote("" . ${${"GLOBALS"}["mhtrtpoxqog"]} . "") . ""; break; case "is_checked": ${$ddtsdwnjdi}[] = "`" . ${${"GLOBALS"}["jhgyja"]} . "` " . (${${"GLOBALS"}["gltggtgnj"]} ? "!" : "") . "= " . $adb->quote("" . ${$djtrtm} . "") . ""; break; case "is_empty": if (!${$gysrpkkbjro}) { $snfeziwysq = "check"; $xbwkmiws = "fieldName"; ${${"GLOBALS"}["dewpeeyj"]}[] = "(`" . ${$xbwkmiws} . "` = '' OR`" . ${$snfeziwysq}["field"] . "` = '0')"; } else { ${"GLOBALS"}["pldqrvs"] = "fieldName"; ${${"GLOBALS"}["dewpeeyj"]}[] = "(`" . ${${"GLOBALS"}["pldqrvs"]} . "` != '')"; } break; case "date_empty": if (!${${"GLOBALS"}["gltggtgnj"]}) { $qdiribn = "fieldName"; $bbosypyhslk = "tmpSQL"; ${$bbosypyhslk}[] = "(`" . ${${"GLOBALS"}["mtsrsml"]} . "` IS NULL OR DATE(`" . ${$qdiribn} . "`) = '0000-00-00')"; } else { ${"GLOBALS"}["pwcutq"] = "fieldName"; $egvstey = "tmpSQL"; ${$egvstey}[] = "(`" . ${${"GLOBALS"}["pwcutq"]} . "` IS NOT NULL AND DATE(`" . ${${"GLOBALS"}["mtsrsml"]} . "`) != '0000-00-00')"; } break; case "is_numeric": ${${"GLOBALS"}["rgeraojxbe"]}[] = "(`" . ${${"GLOBALS"}["glhofthvju"]} . "` " . (${${"GLOBALS"}["ufiulnugtpse"]} ? "NOT " : "") . "REGEXP '-?[0-9]+')"; break; } } $this->_sql[] = "((" . implode(") OR (", ${${"GLOBALS"}["dewpeeyj"]}) . "))"; return false; }
public function doTask($entity) { global $current_user; $util = new VTWorkflowUtils(); $admin = $util->adminUser(); $module = $entity->getModuleName(); $taskContents = Zend_Json::decode($this->getContents($entity)); $from_email = $taskContents['fromEmail']; $from_name = $taskContents['fromName']; $to_email = $taskContents['toEmail']; $cc = $taskContents['ccEmail']; $bcc = $taskContents['bccEmail']; $subject = $taskContents['subject']; $content = $taskContents['content']; if (!empty($to_email)) { //Storing the details of emails $entityIdDetails = vtws_getIdComponents($entity->getId()); $entityId = $entityIdDetails[1]; $moduleName = 'Emails'; $userId = $current_user->id; $emailFocus = CRMEntity::getInstance($moduleName); $emailFieldValues = array('assigned_user_id' => $userId, 'subject' => $subject, 'description' => $content, 'from_email' => $from_email, 'saved_toid' => $to_email, 'ccmail' => $cc, 'bccmail' => $bcc, 'parent_id' => $entityId . "@{$userId}|", 'email_flag' => 'SENT', 'activitytype' => $moduleName, 'date_start' => date('Y-m-d'), 'time_start' => date('H:i:s'), 'mode' => '', 'id' => ''); $emailFocus->column_fields = $emailFieldValues; $emailFocus->save($moduleName); //Including email tracking details global $site_URL, $application_unique_key; $emailId = $emailFocus->id; $trackURL = "{$site_URL}/modules/Emails/TrackAccess.php?record={$entityId}&mailid={$emailId}&app_key={$application_unique_key}"; $content = "<img src='{$trackURL}' alt='' width='1' height='1'>{$content}"; if (stripos($content, '<img src="cid:logo" />')) { $logo = 1; } if (is_array($this->template)) { $Templates = $this->template; } else { $Templates = array($this->template); } if (count($Templates) > 0) { $request = new Vtiger_Request($_REQUEST, $_REQUEST); $adb = PearDatabase::getInstance(); $PDFMaker = new PDFMaker_PDFMaker_Model(); list($id3, $id) = explode("x", $entity->getId()); $modFocus = CRMEntity::getInstance($module); $modFocus->retrieve_entity_info($id, $module); $modFocus->id = $id; $language = $this->template_language; foreach ($Templates as $templateid) { if ($templateid != "0" && $templateid != "") { if ($PDFMaker->isTemplateDeleted($templateid)) { return; } $result = $adb->query("SELECT fieldname FROM vtiger_field WHERE uitype=4 AND tabid=" . getTabId($module)); $fieldname = $adb->query_result($result, 0, "fieldname"); if (isset($modFocus->column_fields[$fieldname]) && $modFocus->column_fields[$fieldname] != "") { $file_name = $PDFMaker->generate_cool_uri($modFocus->column_fields[$fieldname]) . ".pdf"; } else { $file_name = $templateid . $emailFocus->parentid . date("ymdHi") . ".pdf"; } $PDFMaker->createPDFAndSaveFile($request, $templateid, $emailFocus, $modFocus, $file_name, $module, $language); } } $status = send_mail($module, $to_email, $from_name, $from_email, $subject, $content, $cc, $bcc, 'all', $emailId, $logo); } else { $status = send_mail($module, $to_email, $from_name, $from_email, $subject, $content, $cc, $bcc, '', '', $logo); } if (!empty($emailId)) { $emailFocus->setEmailAccessCountValue($emailId); } if (!$status) { //If mail is not sent then removing the details about email $emailFocus->trash($moduleName, $emailId); } } $util->revertUser(); }
/*+******************************************************************************** * The contents of this file are subject to the vtiger CRM Public License Version 1.0 * ("License"); You may not use this file except in compliance with the License * The Original Code is: vtiger CRM Open Source * The Initial Developer of the Original Code is vtiger. * Portions created by vtiger are Copyright (C) vtiger. * All Rights Reserved. ********************************************************************************/ global $adb, $current_user, $mod_strings, $currentModule; require 'user_privileges/user_privileges_' . $current_user->id . '.php'; $modval = trim($_REQUEST['modname']); $dash = trim($_REQUEST['dash']); $home = trim($_REQUEST['home']); if (!empty($modval)) { $tabid = getTabId($modval); $ssql = "select vtiger_customview.*, vtiger_users.user_name from vtiger_customview inner join vtiger_tab on vtiger_tab.name = vtiger_customview.entitytype \n\t\t\t\tleft join vtiger_users on vtiger_customview.userid = vtiger_users.id "; $ssql .= " where vtiger_tab.tabid=?"; $sparams = array($tabid); if ($is_admin == false) { $ssql .= " and (vtiger_customview.status=0 or vtiger_customview.userid = ? or vtiger_customview.status = 3 or vtiger_customview.userid in(select vtiger_user2role.userid from vtiger_user2role inner join vtiger_users on vtiger_users.id=vtiger_user2role.userid inner join vtiger_role on vtiger_role.roleid=vtiger_user2role.roleid where vtiger_role.parentrole like '" . $current_user_parent_role_seq . "::%'))"; array_push($sparams, $current_user->id); } $result = $adb->pquery($ssql, $sparams); if ($adb->num_rows($result) == 0) { echo $mod_strings['MSG_NO_FILTERS']; die; } else { $html = '<select id=selFilterid name=selFiltername onchange=setPrimaryFld(this) class="detailedViewTextBox" onfocus="this.className=\'detailedViewTextBoxOn\'" onblur="this.className=\'detailedViewTextBox\'" style="width:60%">'; for ($i = 0; $i < $adb->num_rows($result); $i++) { if ($adb->query_result($result, $i, "viewname") == 'All') {
public function process(Vtiger_Request $request) { //Debugger::GetInstance()->Init(); $AvailableRelModules = array("Accounts", "Contacts", "Leads", "Vendors"); $current_user = $cu_model = Users_Record_Model::getCurrentUserModel(); $currentLanguage = Vtiger_Language_Handler::getLanguage(); $adb = PearDatabase::getInstance(); $viewer = $this->getViewer($request); $PDFMaker = new PDFMaker_PDFMaker_Model(); if ($PDFMaker->CheckPermissions("DETAIL") == false) { $output = '<table border=0 cellspacing=0 cellpadding=5 width=100% align=center bgcolor=white> <tr> <td class="dvtCellInfo" style="width:100%;border-top:1px solid #DEDEDE;text-align:center;"> <strong>' . vtranslate("LBL_PERMISSION") . '</strong> </td> </tr> </table>'; die($output); } $record = $request->get('record'); $module = getSalesEntityType($record); $viewer->assign('MODULE', $module); $viewer->assign('ID', $record); $relfocus = CRMEntity::getInstance($module); $relfocus->id = $record; $relfocus->retrieve_entity_info($relfocus->id, $module); $relmodule = ""; $relmodule_selid = ""; if (in_array($module, $AvailableRelModules)) { $relmodule = $module; $relmodule_selid = $relfocus->id; } else { if (isset($relfocus->column_fields['account_id']) && $relfocus->column_fields['account_id'] != "" && $relfocus->column_fields['account_id'] != "0") { $relmodule = 'Accounts'; $relmodule_selid = $relfocus->column_fields['account_id']; } if ($relmodule == "" && isset($relfocus->column_fields['related_to']) && $relfocus->column_fields['related_to'] != "" && $relfocus->column_fields['related_to'] != "0") { $relmodule_selid = $relfocus->column_fields['related_to']; $relmodule = getSalesEntityType($relmodule_selid); if (!in_array($relmodule, $AvailableRelModules)) { $relmodule = $relmodule_selid = ""; } } if ($relmodule == "" && isset($relfocus->column_fields['parent_id']) && $relfocus->column_fields['parent_id'] != "" && $relfocus->column_fields['parent_id'] != "0") { $relmodule_selid = $relfocus->column_fields['parent_id']; $relmodule = getSalesEntityType($relmodule_selid); if (!in_array($relmodule, $AvailableRelModules)) { $relmodule = $relmodule_selid = ""; } } if ($relmodule == "" && isset($relfocus->column_fields['contact_id']) && $relfocus->column_fields['contact_id'] != "" && $relfocus->column_fields['contact_id'] != "0") { $relmodule = 'Contacts'; $relmodule_selid = $relfocus->column_fields['contact_id']; } } $viewer->assign('RELMODULE', $relmodule); $viewer->assign('RELMODULE_SELID', $relmodule_selid); require 'user_privileges/user_privileges_' . $current_user->id . '.php'; if (is_dir("modules/PDFMaker/resources/mpdf") && $PDFMaker->CheckPermissions("DETAIL")) { $viewer->assign("ENABLE_PDFMAKER", 'true'); } else { $viewer->assign("ENABLE_PDFMAKER", "false"); } if (is_dir("modules/EMAILMaker") && vtlib_isModuleActive('EMAILMaker')) { $module_tabid = getTabId($module); $res = $adb->pquery("SELECT * FROM vtiger_links WHERE tabid = ? AND linktype = ? AND linkurl LIKE ?", array($module_tabid, 'DETAILVIEWSIDEBARWIDGET', 'module=EMAILMaker&view=GetEMAILActions&record=%')); if ($adb->num_rows($res) > 0) { $viewer->assign("ENABLE_EMAILMAKER", 'true'); } } $viewer->assign('PDFMAKER_MOD', return_module_language($currentLanguage, "PDFMaker")); if (!isset($_SESSION["template_languages"]) || $_SESSION["template_languages"] == "") { $temp_res = $adb->pquery("SELECT label, prefix FROM vtiger_language WHERE active = ?", array('1')); while ($temp_row = $adb->fetchByAssoc($temp_res)) { $template_languages[$temp_row["prefix"]] = $temp_row["label"]; } $_SESSION["template_languages"] = $template_languages; } $viewer->assign('TEMPLATE_LANGUAGES', $_SESSION["template_languages"]); $viewer->assign('CURRENT_LANGUAGE', $currentLanguage); $viewer->assign('IS_ADMIN', is_admin($current_user)); $templates = $PDFMaker->GetAvailableTemplates($module); if (count($templates) > 0) { $no_templates_exist = 0; } else { $no_templates_exist = 1; } $viewer->assign('CRM_TEMPLATES', $templates); $viewer->assign('CRM_TEMPLATES_EXIST', $no_templates_exist); //Action permission handling //edit and export $editAndExportAction = "1"; if (isPermitted($module, "EditView", $record) == "no") { $editAndExportAction = "0"; } //save as doc $saveDocAction = "1"; if (isPermitted("Documents", "EditView") == "no") { $saveDocAction = "0"; } //send email with pdf $sendEmailPDF = "1"; if (isPermitted("Emails", "") == "no" && isPermitted("MailManager", "") == "no") { $sendEmailPDF = "0"; } if (is_dir("modules/EMAILMaker") && vtlib_isModuleActive('EMAILMaker')) { if (isPermitted("EMAILMaker", "") == "no" && ($sendEmailPDF = "0")) { $sendEmailPDF = "0"; } else { $sendEmailPDF = "1"; } } $viewer->assign("EDIT_AND_EXPORT_ACTION", $editAndExportAction); $viewer->assign("SAVE_AS_DOC_ACTION", $saveDocAction); $viewer->assign("SEND_EMAIL_PDF_ACTION", $sendEmailPDF); $viewer->view("GetPDFActions.tpl", 'PDFMaker'); }
public function doTask($entityData) { global $current_user, $log, $root_directory; $request = new Vtiger_Request($_REQUEST, $_REQUEST); $adb = PearDatabase::getInstance(); $PDFMaker = new PDFMaker_PDFMaker_Model(); $userId = $entityData->get('assigned_user_id'); if ($userId === null) { $userId = vtws_getWebserviceEntityId('Users', 1); } $moduleName = $entityData->getModuleName(); $adminUser = $this->getAdmin(); $id = $entityData->getId(); list($id2, $assigned_user_id) = explode("x", $userId); list($id3, $parentid) = explode("x", $id); $focus = CRMEntity::getInstance("Documents"); $focus->parentid = $parentid; $modFocus = CRMEntity::getInstance($moduleName); if (isset($focus->parentid)) { $modFocus->retrieve_entity_info($focus->parentid, $moduleName); $modFocus->id = $focus->parentid; } $templateid = $this->template; if ($templateid != "" && $templateid != "0") { if ($PDFMaker->isTemplateDeleted($templateid)) { return; } $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"); if (isset($modFocus->column_fields[$fieldname]) && $modFocus->column_fields[$fieldname] != "") { $file_name = $PDFMaker->generate_cool_uri($foldername . "_" . $modFocus->column_fields[$fieldname]) . ".pdf"; } else { $file_name = $PDFMaker->generate_cool_uri($foldername . "_" . $templateid . $focus->parentid . date("ymdHi")) . ".pdf"; } $focus->column_fields['notes_title'] = $this->title; $focus->column_fields['assigned_user_id'] = $assigned_user_id; $focus->column_fields['filename'] = $file_name; $focus->column_fields['notecontent'] = $this->description; $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->folder; $focus->save('Documents'); $language = $this->template_language; $PDFMaker->createPDFAndSaveFile($request, $templateid, $focus, $modFocus, $file_name, $moduleName, $language); } }
require_once 'Smarty_setup.php'; require_once 'include/database/PearDatabase.php'; global $app_strings, $current_user, $theme, $adb; $image_path = 'themes/' . $theme . '/images/'; $idlist = vtlib_purify($_REQUEST['idlist']); $pmodule = vtlib_purify($_REQUEST['return_module']); $ids = explode(';', $idlist); $single_record = false; if (!strpos($idlist, ':')) { $single_record = true; } $language = $_SESSION['authenticated_user_language']; $mod_strings = return_module_language($language, "Emails"); $smarty = new vtigerCRM_Smarty(); $userid = $current_user->id; $tabid = getTabId($pmodule); unset(VTCacheUtils::$_fieldinfo_cache[$tabid]); if ($pmodule != "Accounts" && $pmodule != "Leads" && $pmodule != "Contacts") { $focus2 = CRMEntity::getInstance($pmodule); $focus2->retrieve_entity_info($idlist, $pmodule); $focus2->id = $idlist; $accountid = $focus2->column_fields["account_id"]; $contactid = $focus2->column_fields["contact_id"]; $relatedto = $focus2->column_fields["related_to"]; $parentid = $focus2->column_fields["parent_id"]; if ($relatedto != "" && $relatedto != "0") { $type = getSalesEntityType($relatedto); if ($type == "Accounts") { $accountid = $relatedto; } else { $contactid = $relatedto;
public function beforeGetTaskform($viewer) { global $adb; $new_module = $this->get("new_module"); if (!empty($_POST["task"]["new_module_setter"])) { $new_module = $_POST["task"]["new_module_setter"]; # $viewer->assign("module_name", $_POST["task"]["new_module_setter"]); $mandatoryFields = VtUtils::getMandatoryFields(getTabId($_POST["task"]["new_module_setter"])); $startFields = array(); $counter = 1; foreach ($mandatoryFields as $field) { if ('productid' != $field['fieldname']) { $startFields["" . $counter] = array("field" => $field["fieldname"], "mode" => "value", "value" => "", "fixed" => true); $counter++; } } $startFields["" . $counter++] = array("field" => "currency_id", "mode" => "value", "value" => "", "fixed" => true); $startFields["" . $counter++] = array("field" => "hdnTaxType", "mode" => "value", "value" => "", "fixed" => true); $startFields["" . $counter++] = array("field" => "hdnS_H_Amount", "mode" => "value", "value" => "", "fixed" => true); $this->set("setter", $startFields); $this->set("global", array()); } if (!empty($new_module) && $new_module != -1) { $field = new StdClass(); $field->name = "hdnS_H_Amount"; $field->label = getTranslatedString("Shipping & Handling Charges", $_POST["task"]["new_module_setter"]); $additionalFields = array($field); $viewer->assign("new_module", $new_module); } $workflows = Workflow2::getWorkflowsForModule($new_module, 1); $viewer->assign("extern_workflows", $workflows); $module = array(); $module["Invoice"] = getTranslatedString("Invoice", "Invoice"); $module["Quotes"] = getTranslatedString("Quotes", "Quotes"); $module["PurchaseOrder"] = getTranslatedString("PurchaseOrder", "PurchaseOrder"); $module["SalesOrder"] = getTranslatedString("SalesOrder", "SalesOrder"); asort($module); $viewer->assign("avail_module", $module); $viewer->assign("orig_module_name", $this->getModuleName()); $viewer->assign("availCurrency", getAllCurrencies()); $viewer->assign("availTaxes", getAllTaxes("available")); }
public function beforeGetTaskform($viewer) { global $adb, $vtiger_current_version; $new_module = $this->get("new_module"); if (!empty($_POST["task"]["new_module_setter"])) { $new_module = $_POST["task"]["new_module_setter"]; $mandatoryFields = VtUtils::getMandatoryFields(getTabId($_POST["task"]["new_module_setter"])); $startFields = array(); $counter = 1; foreach ($mandatoryFields as $field) { $startFields["" . $counter] = array("field" => $field["fieldname"], "mode" => "value", "value" => "", "fixed" => true); $counter++; } if ($_POST["task"]["new_module_setter"] == "Calendar") { $startFields["" . $counter] = array("field" => "time_start", "mode" => "value", "value" => "", "fixed" => true); } $this->set("setter", $startFields); $this->set("new_module", $new_module); } $workflows = Workflow2::getWorkflowsForModule($new_module, 1); $viewer->assign("extern_workflows", $workflows); $sql = "SELECT id FROM vtiger_ws_entity WHERE name = 'Users'"; $result = $adb->query($sql); $wsTabId = $adb->query_result($result, 0, "id"); if (!empty($new_module) && $new_module != -1) { $viewer->assign("new_module", $new_module); } $sql = "SELECT * FROM vtiger_tab WHERE presence = 0 AND isentitytype = 1 ORDER BY name"; $result = $adb->query($sql); $module = array(); while ($row = $adb->fetch_array($result)) { if ($row["name"] == "Calendar") { continue; } $module[$row["name"]] = getTranslatedString($row["tablabel"], $row["name"]); } #$module["Events"] = getTranslatedString($row["tablabel"],"Events"); asort($module); $viewer->assign("avail_module", $module); }
public function remove($pickListFieldName, $valueToDeleteId, $replaceValueId, $moduleName) { $db = PearDatabase::getInstance(); if (!is_array($valueToDeleteId)) { $valueToDeleteId = array($valueToDeleteId); } $primaryKey = Vtiger_Util_Helper::getPickListId($pickListFieldName); $pickListValues = array(); $valuesOfDeleteIds = "SELECT {$pickListFieldName} FROM " . $this->getPickListTableName($pickListFieldName) . " WHERE {$primaryKey} IN (" . generateQuestionMarks($valueToDeleteId) . ")"; $pickListValuesResult = $db->pquery($valuesOfDeleteIds, array($valueToDeleteId)); $num_rows = $db->num_rows($pickListValuesResult); for ($i = 0; $i < $num_rows; $i++) { $pickListValues[] = decode_html($db->query_result($pickListValuesResult, $i, $pickListFieldName)); } $replaceValueQuery = $db->pquery("SELECT {$pickListFieldName} FROM " . $this->getPickListTableName($pickListFieldName) . " WHERE {$primaryKey} IN (" . generateQuestionMarks($replaceValueId) . ")", array($replaceValueId)); $replaceValue = decode_html($db->query_result($replaceValueQuery, 0, $pickListFieldName)); //As older look utf8 characters are pushed as html-entities,and in new utf8 characters are pushed to database //so we are checking for both the values $encodedValueToDelete = array(); foreach ($pickListValues as $key => $value) { $encodedValueToDelete[$key] = Vtiger_Util_Helper::toSafeHTML($value); } $mergedValuesToDelete = array_merge($pickListValues, $encodedValueToDelete); $fieldModel = Settings_Picklist_Field_Model::getInstance($pickListFieldName, $this); //if role based then we need to delete all the values in role based picklist if ($fieldModel->isRoleBased()) { $picklistValueIdToDelete = array(); $query = 'SELECT picklist_valueid FROM ' . $this->getPickListTableName($pickListFieldName) . ' WHERE ' . $primaryKey . ' IN (' . generateQuestionMarks($valueToDeleteId) . ')'; $result = $db->pquery($query, $valueToDeleteId); $num_rows = $db->num_rows($result); for ($i = 0; $i < $num_rows; $i++) { $picklistValueIdToDelete[] = $db->query_result($result, $i, 'picklist_valueid'); } $query = 'DELETE FROM vtiger_role2picklist WHERE picklistvalueid IN (' . generateQuestionMarks($picklistValueIdToDelete) . ')'; $db->pquery($query, $picklistValueIdToDelete); } $query = 'DELETE FROM ' . $this->getPickListTableName($pickListFieldName) . ' WHERE ' . $primaryKey . ' IN (' . generateQuestionMarks($valueToDeleteId) . ')'; $db->pquery($query, $valueToDeleteId); vimport('include/utils/CommonUtils.php'); $tabId = getTabId($moduleName); $query = 'DELETE FROM vtiger_picklist_dependency WHERE sourcevalue IN (' . generateQuestionMarks($pickListValues) . ')' . ' AND sourcefield=?'; $params = array(); array_push($params, $pickListValues); array_push($params, $pickListFieldName); $db->pquery($query, $params); $query = 'SELECT tablename,columnname FROM vtiger_field WHERE fieldname=? AND presence in (0,2)'; $result = $db->pquery($query, array($pickListFieldName)); $num_row = $db->num_rows($result); for ($i = 0; $i < $num_row; $i++) { $row = $db->query_result_rowdata($result, $i); $tableName = $row['tablename']; $columnName = $row['columnname']; $query = 'UPDATE ' . $tableName . ' SET ' . $columnName . '=? WHERE ' . $columnName . ' IN (' . generateQuestionMarks($pickListValues) . ')'; $params = array($replaceValue); array_push($params, $pickListValues); $db->pquery($query, $params); } $query = 'UPDATE vtiger_field SET defaultvalue=? WHERE defaultvalue IN (' . generateQuestionMarks($pickListValues) . ') AND columnname=?'; $params = array($replaceValue); array_push($params, $pickListValues); array_push($params, $columnName); $db->pquery($query, $params); $em = new VTEventsManager($db); $data = array(); $data['fieldname'] = $pickListFieldName; $data['valuetodelete'] = $pickListValues; $data['replacevalue'] = $replaceValue; $data['module'] = $moduleName; $em->triggerEvent('vtiger.picklist.afterdelete', $data); return true; }
/** Function to get field that is to be compared in query form for the given Comparator and field * @ param $field : field * returns the value for the comparator */ function getFilterComparedField($field) { global $adb, $ogReport; $field = explode('#', $field); $module = $field[0]; $fieldname = trim($field[1]); $tabid = getTabId($module); $field_query = $adb->pquery("SELECT tablename,columnname,typeofdata,fieldname,uitype FROM vtiger_field WHERE tabid = ? AND fieldname= ?", array($tabid, $fieldname)); $fieldtablename = $adb->query_result($field_query, 0, 'tablename'); $fieldcolname = $adb->query_result($field_query, 0, 'columnname'); $typeofdata = $adb->query_result($field_query, 0, 'typeofdata'); $fieldtypeofdata = ChangeTypeOfData_Filter($fieldtablename, $fieldcolname, $typeofdata[0]); $uitype = $adb->query_result($field_query, 0, 'uitype'); /*if($tr[0]==$ogReport->primodule) $value = $adb->query_result($field_query,0,'tablename').".".$adb->query_result($field_query,0,'columnname'); else $value = $adb->query_result($field_query,0,'tablename').$tr[0].".".$adb->query_result($field_query,0,'columnname'); */ if ($uitype == 68 || $uitype == 59) { $fieldtypeofdata = 'V'; } if ($fieldtablename == "vtiger_crmentity") { $fieldtablename = $fieldtablename . $module; } if ($fieldname == "assigned_user_id") { $fieldtablename = "vtiger_users" . $module; $fieldcolname = "user_name"; } if ($fieldtablename == "vtiger_crmentity" && $fieldname == "modifiedby") { $fieldtablename = "vtiger_lastModifiedBy" . $module; $fieldcolname = "user_name"; } if ($fieldname == "assigned_user_id1") { $fieldtablename = "vtiger_usersRel1"; $fieldcolname = "user_name"; } $value = $fieldtablename . "." . $fieldcolname; return $value; }
* * * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev * * * * This is commercial software, only users who have purchased a valid * * license and accept to the terms of the License Agreement can install * * and use this program. * * * **************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ if (!defined('BOOTSTRAP')) { die('Access denied'); } require_once "hybrid_auth_functions.php"; $addon_hybrid_auth = db_get_row("SELECT * FROM ?:addons WHERE addon = 'hybrid_auth'"); if (!empty($addon_hybrid_auth)) { createTables(); transferSettingsToTable(); moveUsersToTables(); db_query("ALTER TABLE ?:users DROP COLUMN identifier;"); $settings_section = db_get_row("SELECT section_id FROM ?:settings_sections WHERE type = 'ADDON' AND name = 'hybrid_auth'"); deleteSettingsBySection($settings_section['section_id']); $tab_id = getTabId($settings_section); $settings = array(array('name' => 'icons_pack', 'section_id' => $settings_section['section_id'], 'section_tab_id' => $tab_id, 'type' => 'S', 'position' => 10, 'value' => 'flat_32x32'), array('name' => 'autogen_email', 'section_id' => $settings_section['section_id'], 'section_tab_id' => $tab_id, 'type' => 'C', 'position' => 20, 'value' => 'N')); $descriptions = array('Icons pack', 'Autogeneration email'); setSettings($settings, $descriptions); if (!hasField("?:hybrid_auth_providers", "app_params")) { db_query("ALTER TABLE ?:hybrid_auth_providers ADD COLUMN app_params TEXT DEFAULT '';"); } }
public function process(Vtiger_Request $request) { PDFMaker_Debugger_Model::GetInstance()->Init(); $PDFMaker = new PDFMaker_PDFMaker_Model(); if ($PDFMaker->CheckPermissions("EDIT") == false) { $PDFMaker->DieDuePermission(); } $viewer = $this->getViewer($request); if ($request->has('templateid') && !$request->isEmpty('templateid')) { $templateid = $request->get('templateid'); $pdftemplateResult = $PDFMaker->GetEditViewData($templateid); $select_module = $pdftemplateResult["module"]; $select_format = $pdftemplateResult["format"]; $select_orientation = $pdftemplateResult["orientation"]; } else { $templateid = ""; if ($request->has("return_module") && !$request->isEmpty("return_module")) { $select_module = $request->get("return_module"); } else { $select_module = ""; } $select_format = "A4"; $select_orientation = "portrait"; } $PDFMaker->CheckTemplatePermissions($select_module, $templateid); $viewer->assign("EMODE", "edit"); $viewer->assign("TEMPLATEID", $templateid); $viewer->assign("MODULENAME", vtranslate($select_module, $select_module)); $viewer->assign("SELECTMODULE", $select_module); $viewer->assign("BODY", $pdftemplateResult["body"]); $cu_model = Users_Record_Model::getCurrentUserModel(); $this->cu_language = $cu_model->get('language'); $viewer->assign("THEME", $theme); $viewer->assign("IMAGE_PATH", $image_path); $app_strings_big = Vtiger_Language_Handler::getModuleStringsFromFile($this->cu_language); $app_strings = $app_strings_big['languageStrings']; $viewer->assign("APP", $app_strings); $viewer->assign("PARENTTAB", getParentTab()); $modArr = $PDFMaker->GetAllModules(); $Modulenames = $modArr[0]; $ModuleIDS = $modArr[1]; // ****************************************** Company and User information: ********************************** $CUI_BLOCKS["Account"] = vtranslate("LBL_COMPANY_INFO", 'PDFMaker'); $CUI_BLOCKS["Assigned"] = vtranslate("LBL_USER_INFO", 'PDFMaker'); $CUI_BLOCKS["Logged"] = vtranslate("LBL_LOGGED_USER_INFO", 'PDFMaker'); $viewer->assign("CUI_BLOCKS", $CUI_BLOCKS); $adb = PearDatabase::getInstance(); $sql = "SELECT * FROM vtiger_organizationdetails"; $result = $adb->pquery($sql, array()); $organization_logoname = decode_html($adb->query_result($result, 0, 'logoname')); $organization_header = decode_html($adb->query_result($result, 0, 'headername')); $organization_stamp_signature = $adb->query_result($result, 0, 'stamp_signature'); global $site_URL; $path = $site_URL . "/test/logo/"; if (isset($organization_logoname)) { $organization_logo_img = "<img src=\"" . $path . $organization_logoname . "\">"; $viewer->assign("COMPANYLOGO", $organization_logo_img); } if (isset($organization_stamp_signature)) { $organization_stamp_signature_img = "<img src=\"" . $path . $organization_stamp_signature . "\">"; $viewer->assign("COMPANY_STAMP_SIGNATURE", $organization_stamp_signature_img); } if (isset($organization_header)) { $organization_header_img = "<img src=\"" . $path . $organization_header . "\">"; $viewer->assign("COMPANY_HEADER_SIGNATURE", $organization_header_img); } $Acc_Info = array('' => vtranslate("LBL_PLS_SELECT", 'PDFMaker'), "COMPANY_NAME" => vtranslate("LBL_COMPANY_NAME", 'PDFMaker'), "COMPANY_LOGO" => vtranslate("LBL_COMPANY_LOGO", 'PDFMaker'), "COMPANY_ADDRESS" => vtranslate("LBL_COMPANY_ADDRESS", 'PDFMaker'), "COMPANY_CITY" => vtranslate("LBL_COMPANY_CITY", 'PDFMaker'), "COMPANY_STATE" => vtranslate("LBL_COMPANY_STATE", 'PDFMaker'), "COMPANY_ZIP" => vtranslate("LBL_COMPANY_ZIP", 'PDFMaker'), "COMPANY_COUNTRY" => vtranslate("LBL_COMPANY_COUNTRY", 'PDFMaker'), "COMPANY_PHONE" => vtranslate("LBL_COMPANY_PHONE", "PDFMaker"), "COMPANY_FAX" => vtranslate("LBL_COMPANY_FAX", 'PDFMaker'), "COMPANY_WEBSITE" => vtranslate("LBL_COMPANY_WEBSITE", 'PDFMaker')); $viewer->assign("ACCOUNTINFORMATIONS", $Acc_Info); $sql_user_block = "SELECT blockid, blocklabel FROM vtiger_blocks WHERE tabid=29 ORDER BY sequence ASC"; $res_user_block = $adb->query($sql_user_block); $user_block_info_arr = array(); while ($row_user_block = $adb->fetch_array($res_user_block)) { $sql_user_field = "SELECT fieldid, uitype FROM vtiger_field WHERE block=" . $row_user_block['blockid'] . " and (displaytype != 3 OR uitype = 55) ORDER BY sequence ASC"; $res_user_field = $adb->query($sql_user_field); $num_user_field = $adb->num_rows($res_user_field); if ($num_user_field > 0) { $user_field_id_array = array(); while ($row_user_field = $adb->fetch_array($res_user_field)) { $user_field_id_array[] = $row_user_field['fieldid']; // print_r($user_field_id_array); } $user_block_info_arr[$row_user_block['blocklabel']] = $user_field_id_array; } } $user_mod_strings = $this->getModuleLanguageArray("Users"); $b = 0; foreach ($user_block_info_arr as $block_label => $block_fields) { $b++; if (isset($user_mod_strings[$block_label]) and $user_mod_strings[$block_label] != "") { $optgroup_value = $user_mod_strings[$block_label]; } else { $optgroup_value = vtranslate($block_label, 'PDFMaker'); } if (count($block_fields) > 0) { $field_ids = implode(",", $block_fields); $sql1 = "SELECT * FROM vtiger_field WHERE fieldid IN (" . $field_ids . ")"; $result1 = $adb->query($sql1); while ($row1 = $adb->fetchByAssoc($result1)) { $fieldname = $row1['fieldname']; $fieldlabel = $row1['fieldlabel']; $option_key = strtoupper("Users" . "_" . $fieldname); if (isset($current_mod_strings[$fieldlabel]) and $current_mod_strings[$fieldlabel] != "") { $option_value = $current_mod_strings[$fieldlabel]; } elseif (isset($app_strings[$fieldlabel]) and $app_strings[$fieldlabel] != "") { $option_value = $app_strings[$fieldlabel]; } else { $option_value = $fieldlabel; } $User_Info[$optgroup_value][$option_key] = $option_value; $Logged_User_Info[$optgroup_value]["R_" . $option_key] = $option_value; } } //variable RECORD ID added if ($b == 1) { $option_value = "Record ID"; $option_key = strtoupper("USERS_CRMID"); $User_Info[$optgroup_value][$option_key] = $option_value; $Logged_User_Info[$optgroup_value]["R_" . $option_key] = $option_value; } //end } // ****************************************** END: Company and User information ********************************** $viewer->assign("USERINFORMATIONS", $User_Info); $viewer->assign("LOGGEDUSERINFORMATION", $Logged_User_Info); $Invterandcon = array("" => vtranslate("LBL_PLS_SELECT", 'PDFMaker'), "TERMS_AND_CONDITIONS" => vtranslate("LBL_TERMS_AND_CONDITIONS", 'PDFMaker')); $viewer->assign("INVENTORYTERMSANDCONDITIONS", $Invterandcon); //labels $global_lang_labels = @array_flip($app_strings); $global_lang_labels = @array_flip($global_lang_labels); asort($global_lang_labels); $viewer->assign("GLOBAL_LANG_LABELS", $global_lang_labels); $module_lang_labels = array(); if ($select_module != "") { $mod_lang = $this->getModuleLanguageArray($select_module); $module_lang_labels = @array_flip($mod_lang); $module_lang_labels = @array_flip($module_lang_labels); asort($module_lang_labels); } else { $module_lang_labels[""] = vtranslate("LBL_SELECT_MODULE_FIELD", 'PDFMaker'); } $viewer->assign("MODULE_LANG_LABELS", $module_lang_labels); $Header_Footer_Strings = array("" => vtranslate("LBL_PLS_SELECT", 'PDFMaker'), "PAGE" => $app_strings["Page"], "PAGES" => $app_strings["Pages"]); $viewer->assign("HEADER_FOOTER_STRINGS", $Header_Footer_Strings); //PDF FORMAT SETTINGS $Formats = array("A3" => "A3", "A4" => "A4", "A5" => "A5", "A6" => "A6", "Letter" => "Letter", "Legal" => "Legal", "Custom" => "Custom"); // ITS4YOU VlZa $viewer->assign("FORMATS", $Formats); if (strpos($select_format, ";") > 0) { $tmpArr = explode(";", $select_format); $select_format = "Custom"; $custom_format["width"] = $tmpArr[0]; $custom_format["height"] = $tmpArr[1]; $viewer->assign("CUSTOM_FORMAT", $custom_format); } $viewer->assign("SELECT_FORMAT", $select_format); //PDF ORIENTATION SETTINGS $Orientations = array("portrait" => vtranslate("portrait", 'PDFMaker'), "landscape" => vtranslate("landscape", 'PDFMaker')); $viewer->assign("ORIENTATIONS", $Orientations); $viewer->assign("SELECT_ORIENTATION", $select_orientation); //PDF MARGIN SETTINGS if ($request->has("templateid") && !$request->isEmpty("templateid")) { $Margins = array("top" => $pdftemplateResult["margin_top"], "bottom" => $pdftemplateResult["margin_bottom"], "left" => $pdftemplateResult["margin_left"], "right" => $pdftemplateResult["margin_right"]); $Decimals = array("point" => $pdftemplateResult["decimal_point"], "decimals" => $pdftemplateResult["decimals"], "thousands" => $pdftemplateResult["thousands_separator"] != "sp" ? $pdftemplateResult["thousands_separator"] : " "); } else { $Margins = array("top" => "2", "bottom" => "2", "left" => "2", "right" => "2"); $Decimals = array("point" => ",", "decimals" => "2", "thousands" => " "); } $viewer->assign("MARGINS", $Margins); $viewer->assign("DECIMALS", $Decimals); //PDF HEADER / FOOTER $header = ""; $footer = ""; if ($request->has("templateid") && !$request->isEmpty("templateid")) { $header = $pdftemplateResult["header"]; $footer = $pdftemplateResult["footer"]; } $viewer->assign("HEADER", $header); $viewer->assign("FOOTER", $footer); $hfVariables = array("##PAGE##" => vtranslate("LBL_CURRENT_PAGE", 'PDFMaker'), "##PAGES##" => vtranslate("LBL_ALL_PAGES", 'PDFMaker'), "##PAGE##/##PAGES##" => vtranslate("LBL_PAGE_PAGES", 'PDFMaker')); $viewer->assign("HEAD_FOOT_VARS", $hfVariables); $dateVariables = array("##DD.MM.YYYY##" => vtranslate("LBL_DATE_DD.MM.YYYY", 'PDFMaker'), "##DD-MM-YYYY##" => vtranslate("LBL_DATE_DD-MM-YYYY", 'PDFMaker'), "##MM-DD-YYYY##" => vtranslate("LBL_DATE_MM-DD-YYYY", 'PDFMaker'), "##YYYY-MM-DD##" => vtranslate("LBL_DATE_YYYY-MM-DD", 'PDFMaker')); $viewer->assign("DATE_VARS", $dateVariables); $cmod = $this->getModuleLanguageArray("Settings"); //$cmod = return_specified_module_language($current_language, "Settings"); $viewer->assign("CMOD", $cmod); //Ignored picklist values $pvsql = "SELECT value FROM vtiger_pdfmaker_ignorepicklistvalues"; $pvresult = $adb->query($pvsql); $pvvalues = ""; while ($pvrow = $adb->fetchByAssoc($pvresult)) { $pvvalues .= $pvrow["value"] . ", "; } $viewer->assign("IGNORE_PICKLIST_VALUES", rtrim($pvvalues, ", ")); $More_Fields = array("CURRENCYNAME" => vtranslate("LBL_CURRENCY_NAME", 'PDFMaker'), "CURRENCYSYMBOL" => vtranslate("LBL_CURRENCY_SYMBOL", 'PDFMaker'), "CURRENCYCODE" => vtranslate("LBL_CURRENCY_CODE", 'PDFMaker'), "TOTALWITHOUTVAT" => vtranslate("LBL_VARIABLE_SUMWITHOUTVAT", 'PDFMaker'), "TOTALDISCOUNT" => vtranslate("LBL_VARIABLE_TOTALDISCOUNT", 'PDFMaker'), "TOTALDISCOUNTPERCENT" => vtranslate("LBL_VARIABLE_TOTALDISCOUNT_PERCENT", 'PDFMaker'), "TOTALAFTERDISCOUNT" => vtranslate("LBL_VARIABLE_TOTALAFTERDISCOUNT", 'PDFMaker'), "VAT" => vtranslate("LBL_VARIABLE_VAT", 'PDFMaker'), "VATPERCENT" => vtranslate("LBL_VARIABLE_VAT_PERCENT", 'PDFMaker'), "VATBLOCK" => vtranslate("LBL_VARIABLE_VAT_BLOCK", 'PDFMaker'), "TOTALWITHVAT" => vtranslate("LBL_VARIABLE_SUMWITHVAT", 'PDFMaker'), "SHTAXTOTAL" => vtranslate("LBL_SHTAXTOTAL", 'PDFMaker'), "SHTAXAMOUNT" => vtranslate("LBL_SHTAXAMOUNT", 'PDFMaker'), "ADJUSTMENT" => vtranslate("LBL_ADJUSTMENT", 'PDFMaker'), "TOTAL" => vtranslate("LBL_VARIABLE_TOTALSUM", 'PDFMaker')); //formatable VATBLOCK content $vatblock_table = '<table border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse;"> <tr> <td>' . $app_strings["Name"] . '</td> <td>' . vtranslate("LBL_VATBLOCK_VAT_PERCENT", 'PDFMaker') . '</td> <td>' . vtranslate("LBL_VATBLOCK_SUM", 'PDFMaker') . '</td> <td>' . vtranslate("LBL_VATBLOCK_VAT_VALUE", 'PDFMaker') . '</td> </tr> <tr> <td colspan="4">#VATBLOCK_START#</td> </tr> <tr> <td>$VATBLOCK_LABEL$</td> <td>$VATBLOCK_VALUE$</td> <td>$VATBLOCK_NETTO$</td> <td>$VATBLOCK_VAT$</td> </tr> <tr> <td colspan="4">#VATBLOCK_END#</td> </tr> </table>'; $vatblock_table = str_replace(array("\r\n", "\r", "\n", "\t"), "", $vatblock_table); $vatblock_table = ereg_replace(" {2,}", ' ', $vatblock_table); $viewer->assign("VATBLOCK_TABLE", $vatblock_table); $ModCommentsModules = array(); foreach ($ModuleIDS as $module => $IDS) { if ($module == 'Calendar') { $sql1 = "SELECT blockid, blocklabel FROM vtiger_blocks WHERE tabid IN (9,16) ORDER BY sequence ASC"; } elseif ($module == "Quotes" || $module == "Invoice" || $module == "SalesOrder" || $module == "PurchaseOrder" || $module == "Issuecards" || $module == "Receiptcards" || $module == "Creditnote" || $module == "StornoInvoice") { $sql1 = "SELECT blockid, blocklabel FROM vtiger_blocks WHERE tabid=" . $IDS . " AND blocklabel != 'LBL_DETAILS_BLOCK' AND blocklabel != 'LBL_ITEM_DETAILS' ORDER BY sequence ASC"; } else { $sql1 = "SELECT blockid, blocklabel FROM vtiger_blocks WHERE tabid=" . $IDS . " ORDER BY sequence ASC"; } $res1 = $adb->query($sql1); $block_info_arr = array(); while ($row = $adb->fetch_array($res1)) { if ($row['blockid'] == '41' && $row['blocklabel'] == '') { $row['blocklabel'] = 'LBL_EVENT_INFORMATION'; } $sql2 = "SELECT fieldid, uitype, columnname, fieldlabel\n FROM vtiger_field\n WHERE block=" . $row['blockid'] . "\n AND (displaytype != 3 OR uitype = 55)\n ORDER BY sequence ASC"; $res2 = $adb->query($sql2); $num_rows2 = $adb->num_rows($res2); if ($num_rows2 > 0) { $field_id_array = array(); while ($row2 = $adb->fetch_array($res2)) { $field_id_array[] = $row2['fieldid']; $tmpArr = array($row2["columnname"], $row2["fieldlabel"]); switch ($row2['uitype']) { case "51": $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Accounts"); break; case "57": $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Contacts"); break; case "58": $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Campaigns"); break; case "59": $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Products"); break; case "73": $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Accounts"); break; case "75": $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Vendors"); break; case "81": $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Vendors"); break; case "76": $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Potentials"); break; case "78": $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Quotes"); break; case "80": $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "SalesOrder"); break; case "68": $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Accounts"); $All_Related_Modules[$module][] = array_merge($tmpArr, (array) "Contacts"); break; case "10": $fmrs = $adb->query('SELECT relmodule FROM vtiger_fieldmodulerel WHERE fieldid=' . $row2['fieldid']); while ($rm = $adb->fetch_array($fmrs)) { $All_Related_Modules[$module][] = array_merge($tmpArr, (array) $rm['relmodule']); } break; } } // ITS4YOU MaJu //$block_info_arr[$row['blocklabel']] = $field_id_array; if (!empty($block_info_arr[$row['blocklabel']])) { foreach ($field_id_array as $field_id_array_value) { $block_info_arr[$row['blocklabel']][] = $field_id_array_value; } } else { $block_info_arr[$row['blocklabel']] = $field_id_array; } // ITS4YOU-END } } if ($module == "Quotes" || $module == "Invoice" || $module == "SalesOrder" || $module == "PurchaseOrder") { $block_info_arr["LBL_DETAILS_BLOCK"] = array(); } //ModComments support //if (in_array($module, $ModCommentsModules)) { // $block_info_arr["TEMP_MODCOMMENTS_BLOCK"] = array(); //} $ModuleFields[$module] = $block_info_arr; } //Permissions are taken into consideration when dealing with realted modules $AllowedRelMods = array(); if (count($All_Related_Modules) > 0) { foreach ($All_Related_Modules as $Mod => $RelMods) { foreach ($RelMods as $RelModKey => $RelMod) { $RelModName = $RelMod[2]; if (isPermitted($RelModName, '') == "yes") { $AllowedRelMods[$Mod][$RelModKey] = $RelMod; } } } } $All_Related_Modules = $AllowedRelMods; // Fix of emtpy selectbox in case of selected module does not have any related modules foreach ($Modulenames as $key => $value) { if (!isset($All_Related_Modules[$key])) { $All_Related_Modules[$key] = array(); } } $viewer->assign("ALL_RELATED_MODULES", $All_Related_Modules); if ($select_module != "" && count($All_Related_Modules[$select_module]) > 0) { foreach ($All_Related_Modules[$select_module] as $RelModArr) { $Related_Modules[$RelModArr[2] . "|" . $RelModArr[0]] = vtranslate($RelModArr[2]) . " (" . $RelModArr[1] . ")"; } } $viewer->assign("RELATED_MODULES", $Related_Modules); $tacModules = array(); $tac4you = is_numeric(getTabId("Tac4you")); if ($tac4you == true) { $sql = "SELECT tac4you_module FROM vtiger_tac4you_module WHERE presence = 1"; $result = $adb->query($sql); while ($row = $adb->fetchByAssoc($result)) { $tacModules[$row["tac4you_module"]] = $row["tac4you_module"]; } } $desc4youModules = array(); $desc4you = is_numeric(getTabId("Descriptions4you")); if ($desc4you == true) { $sql = "SELECT b.name FROM vtiger_links AS a\n INNER JOIN vtiger_tab AS b USING (tabid)\n WHERE linktype = 'DETAILVIEWWIDGET'\n AND linkurl = 'block://ModDescriptions4you:modules/Descriptions4you/ModDescriptions4you.php'"; $result = $adb->query($sql); while ($row = $adb->fetchByAssoc($result)) { $desc4youModules[$row["name"]] = $row["name"]; } } $Settings_Profiles_Record_Model = new Settings_Profiles_Record_Model(); foreach ($ModuleFields as $module => $Blocks) { $Optgroupts = array(); $current_mod_strings = $this->getModuleLanguageArray($module); $moduleModel = Vtiger_Module_Model::getInstance($module); $b = 0; if ($module == 'Calendar') { $b++; $Optgroupts[] = '"' . vtranslate('Calendar') . '","' . $b . '"'; $Convert_ModuleFields['Calendar|1'] .= ',"Record ID","CALENDAR_CRMID"'; $SelectModuleFields['Calendar'][vtranslate('Calendar')]["CALENDAR_CRMID"] = "Record ID"; $EventModel = Vtiger_Module_Model::getInstance('Events'); } foreach ($Blocks as $block_label => $block_fields) { $b++; $Options = array(); if ($block_label != "TEMP_MODCOMMENTS_BLOCK") { $optgroup_value = vtranslate($block_label, $module); if ($optgroup_value == $block_label) { $optgroup_value = vtranslate($block_label, 'PDFMaker'); } } else { $optgroup_value = vtranslate("LBL_MODCOMMENTS_INFORMATION", 'PDFMaker'); } $Optgroupts[] = '"' . $optgroup_value . '","' . $b . '"'; if (count($block_fields) > 0) { $field_ids = implode(",", $block_fields); $sql1 = "SELECT * FROM vtiger_field WHERE fieldid IN (" . $field_ids . ")"; $result1 = $adb->query($sql1); while ($row1 = $adb->fetchByAssoc($result1)) { $fieldname = $row1['fieldname']; $fieldlabel = $row1['fieldlabel']; $fieldModel = Vtiger_Field_Model::getInstance($fieldname, $moduleModel); if (!$fieldModel || !$fieldModel->getPermissions('readonly')) { if ($module == 'Calendar') { $eventFieldModel = Vtiger_Field_Model::getInstance($fieldname, $EventModel); if (!$eventFieldModel || !$eventFieldModel->getPermissions('readonly')) { continue; } } else { continue; } } $option_key = strtoupper($module . "_" . $fieldname); if (isset($current_mod_strings[$fieldlabel]) and $current_mod_strings[$fieldlabel] != "") { $option_value = $current_mod_strings[$fieldlabel]; } elseif (isset($app_strings[$fieldlabel]) and $app_strings[$fieldlabel] != "") { $option_value = $app_strings[$fieldlabel]; } else { $option_value = $fieldlabel; } if ($module == 'Calendar') { if ($option_key == 'CALENDAR_ACTIVITYTYPE' || $option_key == 'CALENDAR_DUE_DATE') { $Convert_ModuleFields['Calendar|1'] .= ',"' . $option_value . '","' . $option_key . '"'; $SelectModuleFields['Calendar'][vtranslate('Calendar')][$option_key] = $option_value; continue; } elseif (!isset($Existing_ModuleFields[$option_key])) { $Existing_ModuleFields[$option_key] = $optgroup_value; } else { $Convert_ModuleFields['Calendar|1'] .= ',"' . $option_value . '","' . $option_key . '"'; $SelectModuleFields['Calendar'][vtranslate('Calendar')][$option_key] = $option_value; $Unset_Module_Fields[] = '"' . $option_value . '","' . $option_key . '"'; unset($SelectModuleFields['Calendar'][$Existing_ModuleFields[$option_key]][$option_key]); continue; } } $Options[] = '"' . $option_value . '","' . $option_key . '"'; $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value; } } //variable RECORD ID added if ($b == 1) { $option_value = "Record ID"; $option_key = strtoupper($module . "_CRMID"); $Options[] = '"' . $option_value . '","' . $option_key . '"'; $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value; $option_value = vtranslate('Created Time') . ' (' . vtranslate('Due Date & Time') . ')'; $option_key = strtoupper($module . "_CREATEDTIME_DATETIME"); $Options[] = '"' . $option_value . '","' . $option_key . '"'; $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value; $option_value = vtranslate('Modified Time') . ' (' . vtranslate('Due Date & Time') . ')'; $option_key = strtoupper($module . "_MODIFIEDTIME_DATETIME"); $Options[] = '"' . $option_value . '","' . $option_key . '"'; $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value; } //end if ($block_label == "LBL_TERMS_INFORMATION" && isset($tacModules[$module])) { $option_value = vtranslate("LBL_TAC4YOU", 'PDFMaker'); $option_key = strtoupper($module . "_TAC4YOU"); $Options[] = '"' . $option_value . '","' . $option_key . '"'; $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value; } if ($block_label == "LBL_DESCRIPTION_INFORMATION" && isset($desc4youModules[$module])) { $option_value = vtranslate("LBL_DESC4YOU", 'PDFMaker'); $option_key = strtoupper($module . "_DESC4YOU"); $Options[] = '"' . $option_value . '","' . $option_key . '"'; $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value; } //ModComments support if ($block_label == "TEMP_MODCOMMENTS_BLOCK" && in_array($module, $ModCommentsModules) == true) { $option_value = vtranslate("LBL_MODCOMMENTS", 'PDFMaker'); $option_key = strtoupper($module . "_MODCOMMENTS"); $Options[] = '"' . $option_value . '","' . $option_key . '"'; $SelectModuleFields[$module][$optgroup_value][$option_key] = $option_value; } $Convert_RelatedModuleFields[$module . "|" . $b] = implode(",", $Options); $OptionsRelMod = array(); if (($block_label == "LBL_DETAILS_BLOCK" || $block_label == "LBL_ITEM_DETAILS") && ($module == "Quotes" || $module == "Invoice" || $module == "SalesOrder" || $module == "PurchaseOrder" || $module == "Issuecards" || $module == "Receiptcards" || $module == "Creditnote" || $module == "StornoInvoice")) { foreach ($More_Fields as $variable => $variable_name) { $variable_key = strtoupper($variable); $Options[] = '"' . $variable_name . '","' . $variable_key . '"'; $SelectModuleFields[$module][$optgroup_value][$variable_key] = $variable_name; if ($variable_key != "VATBLOCK") { $OptionsRelMod[] = '"' . $variable_name . '","' . strtoupper($module) . '_' . $variable_key . '"'; } } } //this concatenation is because of need to have extra Details block in Inventory modules which are as related modules $Convert_RelatedModuleFields[$module . "|" . $b] .= implode(',', $OptionsRelMod); $Convert_ModuleFields[$module . "|" . $b] = implode(",", $Options); } if ($module == 'Calendar') { $Convert_ModuleFields['Calendar|1'] = str_replace(',"Record ID","CALENDAR_CRMID",', "", $Convert_ModuleFields['Calendar|1']); $Convert_ModuleFields['Calendar|1'] .= ',"Record ID","CALENDAR_CRMID"'; unset($SelectModuleFields['Calendar'][vtranslate('Calendar')]["CALENDAR_CRMID"]); $SelectModuleFields['Calendar'][vtranslate('Calendar')]["CALENDAR_CRMID"] = "Record ID"; } $Convert_ModuleBlocks[$module] = implode(",", $Optgroupts); } foreach ($Convert_ModuleFields as $cmf_key => $cmf_value) { if (substr($cmf_key, 0, 9) == 'Calendar|' && $cmf_key != 'Calendar|1') { foreach ($Unset_Module_Fields as $to_unset) { $cmf_value = str_replace($to_unset, '', $cmf_value); $cmf_value = str_replace(",,", ',', $cmf_value); $Convert_ModuleFields[$cmf_key] = trim($cmf_value, ','); } } } $viewer->assign("MODULE_BLOCKS", $Convert_ModuleBlocks); $viewer->assign("RELATED_MODULE_FIELDS", $Convert_RelatedModuleFields); $viewer->assign("MODULE_FIELDS", $Convert_ModuleFields); //Product block fields start // Product bloc templates $sql = "SELECT * FROM vtiger_pdfmaker_productbloc_tpl"; $result = $adb->query($sql); $Productbloc_tpl[""] = vtranslate("LBL_PLS_SELECT", 'PDFMaker'); while ($row = $adb->fetchByAssoc($result)) { $Productbloc_tpl[$row["body"]] = $row["name"]; } $viewer->assign("PRODUCT_BLOC_TPL", $Productbloc_tpl); $ProductBlockFields = $PDFMaker->GetProductBlockFields(); foreach ($ProductBlockFields as $viewer_key => $pbFields) { $viewer->assign($viewer_key, $pbFields); } //Product block fields end $viewer->assign("SELECT_MODULE_FIELD", $SelectModuleFields[$select_module]); $smf_filename = $SelectModuleFields[$select_module]; unset($smf_filename["Details"]); $viewer->assign("SELECT_MODULE_FIELD_FILENAME", $smf_filename); $version_type = ucfirst($PDFMaker->GetVersionType()); $viewer->assign("VERSION", $version_type . " " . PDFMaker_Version_Helper::$version); $category = getParentTab(); $viewer->assign("CATEGORY", $category); $viewer->view('Edit.tpl', 'PDFMaker'); }
$theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; $record = $_REQUEST["record"]; $sql = "SELECT setype FROM vtiger_crmentity WHERE crmid = '" . $record . "'"; $relmodule = $adb->getOne($sql, 0, "setype"); $log->info("Inside Email Template Detail View"); $smarty = new vtigerCRM_smarty(); $smarty->assign("APP", $app_strings); $smarty->assign("THEME", $theme); $smarty->assign("MOD", $mod_strings); $smarty->assign("MODULE", $relmodule); $smarty->assign("IMAGE_PATH", $image_path); $smarty->assign("ID", $_REQUEST["record"]); require 'user_privileges/user_privileges_' . $current_user->id . '.php'; if (is_dir("modules/PDFMaker/mpdf")) { if ($is_admin == true || $profileGlobalPermission[2] == 0 || $profileGlobalPermission[1] == 0 || $profileTabsPermission[getTabId("PDFMaker")] == 0) { $smarty->assign("ENABLE_PDFMAKER", 'true'); } } $smarty->assign('PDFMAKER_MOD', return_module_language($current_language, "PDFMaker")); if (!isset($_SESSION["template_languages"]) || $_SESSION["template_languages"] == "") { $temp_res = $adb->query("SELECT label, prefix FROM vtiger_language WHERE active=1"); while ($temp_row = $adb->fetchByAssoc($temp_res)) { $template_languages[$temp_row["prefix"]] = $temp_row["label"]; } $_SESSION["template_languages"] = $template_languages; } $smarty->assign('TEMPLATE_LANGUAGES', $_SESSION["template_languages"]); $smarty->assign('CURRENT_LANGUAGE', $current_language); $category = getParentTab(); $smarty->assign("CATEGORY", $category);
/** Function to get field that is to be compared in query form for the given Comparator and field * @ param $field : field * returns the value for the comparator */ function getFilterComparedField($field) { global $adb, $ogReport; if (!empty($this->secondarymodule)) { $secModules = explode(':', $this->secondarymodule); foreach ($secModules as $secModule) { $secondary = CRMEntity::getInstance($secModule); $this->queryPlanner->addTable($secondary->table_name); } } $field = split('#', $field); $module = $field[0]; $fieldname = trim($field[1]); $tabid = getTabId($module); $field_query = $adb->pquery("SELECT tablename,columnname,typeofdata,fieldname,uitype FROM vtiger_field WHERE tabid = ? AND fieldname= ?", array($tabid, $fieldname)); $fieldtablename = $adb->query_result($field_query, 0, 'tablename'); $fieldcolname = $adb->query_result($field_query, 0, 'columnname'); $typeofdata = $adb->query_result($field_query, 0, 'typeofdata'); $fieldtypeofdata = ChangeTypeOfData_Filter($fieldtablename, $fieldcolname, $typeofdata[0]); $uitype = $adb->query_result($field_query, 0, 'uitype'); /*if($tr[0]==$ogReport->primodule) $value = $adb->query_result($field_query,0,'tablename').".".$adb->query_result($field_query,0,'columnname'); else $value = $adb->query_result($field_query,0,'tablename').$tr[0].".".$adb->query_result($field_query,0,'columnname'); */ if ($uitype == 68 || $uitype == 59) { $fieldtypeofdata = 'V'; } if ($fieldtablename == "vtiger_crmentity" && $module != $this->primarymodule) { $fieldtablename = $fieldtablename . $module; } if ($fieldname == "assigned_user_id") { $fieldtablename = "vtiger_users" . $module; $fieldcolname = "user_name"; } if ($fieldtablename == "vtiger_crmentity" && $fieldname == "modifiedby") { $fieldtablename = "vtiger_lastModifiedBy" . $module; $fieldcolname = "user_name"; } if ($fieldname == "assigned_user_id1") { $fieldtablename = "vtiger_usersRel1"; $fieldcolname = "user_name"; } $value = $fieldtablename . "." . $fieldcolname; $this->queryPlanner->addTable($fieldtablename); return $value; }
</td> </tr> </table> </div> <!-- Displayed info --> <div id="TabEventInfoInCalendar" style="display: none; width: 100%;"> <?php if ($mode != "user" && $id != "invite") { $Event_Fields = array(); $Fields_Label = array(); if ($id == "task") { $for_module = "Calendar"; } else { $for_module = "Events"; } $tabid = getTabId($for_module); $sql_field = "SELECT fieldid, uitype, fieldname, fieldlabel FROM vtiger_field WHERE tabid=? and (displaytype != 3 OR uitype = 55) and vtiger_field.fieldname not in ('notime') ORDER BY sequence ASC"; $res_field = $adb->pquery($sql_field, array($tabid)); $num_field = $adb->num_rows($res_field); if ($num_field > 0) { while ($row_field = $adb->fetch_array($res_field)) { $fieldid = $row_field['fieldid']; $fieldlabel = getTranslatedString($row_field['fieldlabel'], "Calendar"); $field_data = array(); $field_data["fieldid"] = $fieldid; $field_data["fieldname"] = $row_field['fieldname']; $field_data["fieldlabel"] = $fieldlabel; $field_data['module'] = $for_module; $Fields_Array[$fieldid] = $field_data; unset($field_data); $Fields_Label[$row_field['fieldname']] = $fieldlabel;
private function x2c() { global $x15d, $x15e, $x15f, $x160, $x161, $x162, $x163, $x164, $x165, $x166, $x167, $x168, $x169, $x16a, $x16b, $x16c, $x16d, $x16e, $x16f, $x170, $x171, $x172, $x173, $x174, $x175, $x176, $x177, $x178; $x59 = array(); $x145 = $x16a(getTabId("ModComments")); $x146 = ""; if ($x145 == true) { $x3d = "SELECT relmodule FROM vtiger_fieldmodulerel WHERE module='ModComments' AND relmodule = ?"; $x3e = self::$x0f->pquery($x3d, array(self::$x0c)); if (self::$x0f->num_rows($x3e) > 0) { $x146 = $this->x2d(self::$x0e->id); } } self::$x21["\$" . $x175(self::$x0c) . "_MODCOMMENTS\$"] = $x165($x146, ENT_QUOTES, self::$x11); }
/** * @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"; }