public function beforeGetTaskform($viewer)
 {
     global $adb;
     if (!\Workflow\VtUtils::existTable("vtiger_wf_customnumbering")) {
         echo "Create table vtiger_wf_confirmation_user ... ok<br>";
         $adb->query("CREATE TABLE IF NOT EXISTS `vtiger_wf_customnumbering` (\r\n              `serie` varchar(24) NOT NULL,\r\n              `prefix` varchar(16) NOT NULL,\r\n              `current` int(10) unsigned NOT NULL,\r\n              `length` tinyint(4) NOT NULL,\r\n              PRIMARY KEY (`serie`)\r\n            ) ENGINE=InnoDB;");
     }
     $crmidColObj = CRMEntity::getInstance($this->getModuleName());
     $viewer->assign('crmidCol', $crmidColObj->table_index);
     $moduleName = $this->getModuleName();
     $fields = VtUtils::getFieldsWithBlocksForModule($moduleName, false);
     $selectedId = $this->get('field');
     if ($selectedId === -1 || empty($selectedId)) {
         $sql = 'SELECT * FROM vtiger_field WHERE uitype = 4 AND tabid = ' . getTabid($moduleName);
         $result = $adb->query($sql);
         $selectedId = $adb->query_result($result, 0, 'fieldname');
         $this->set('field', $selectedId);
     }
     $sql = 'SELECT * FROM vtiger_wf_customnumbering';
     $result = $adb->query($sql);
     $series = array();
     while ($row = $adb->fetchByAssoc($result)) {
         $series[$row['serie']] = $row;
     }
     if (isset($series[$this->get('serie')])) {
         $viewer->assign('lockFields', true);
     }
     $viewer->assign('series', $series);
     $viewer->assign('fields', $fields);
     /* Insert here source code to create custom configurations pages */
 }
 public function process(Vtiger_Request $request)
 {
     ${"GLOBALS"}["xtbxpaosomd"] = "module";
     ${"GLOBALS"}["cqsbdcf"] = "params";
     $ylhwigwjj = "adb";
     ${$ylhwigwjj} = PearDatabase::getInstance();
     $irlzrbtqca = "params";
     ${$irlzrbtqca} = $request->getAll();
     ${"GLOBALS"}["bjpfpvsjmoe"] = "block";
     ${${"GLOBALS"}["vlwbcehp"]} = ${${"GLOBALS"}["fvrxafpqr"]}["moduleName"];
     ${"GLOBALS"}["slnjoremiwq"] = "result";
     ${${"GLOBALS"}["imkzic"]} = VtUtils::getFieldsWithBlocksForModule(${${"GLOBALS"}["xtbxpaosomd"]}, true);
     if (!empty(${${"GLOBALS"}["cqsbdcf"]}["blocks"])) {
         ${"GLOBALS"}["tdxbgjlxl"] = "moduleFields";
         die(json_encode(${${"GLOBALS"}["tdxbgjlxl"]}));
     }
     ${${"GLOBALS"}["quwfbet"]} = array();
     foreach (${${"GLOBALS"}["imkzic"]} as ${${"GLOBALS"}["jutloijjy"]} => ${${"GLOBALS"}["bjpfpvsjmoe"]}) {
         foreach (${${"GLOBALS"}["swvrrtqrvf"]} as ${${"GLOBALS"}["fxiwohqzyqth"]}) {
             $qusdhjlspiv = "result";
             ${$qusdhjlspiv}[] = array("type" => $field->type, "group" => ${${"GLOBALS"}["jutloijjy"]}, "name" => $field->name, "label" => $field->label);
         }
     }
     die(json_encode(${${"GLOBALS"}["slnjoremiwq"]}));
 }
Exemple #3
0
 public function process(Vtiger_Request $request)
 {
     global $current_user;
     global $root_directory;
     $baflayps = "adb";
     ${"GLOBALS"}["luuhjzd"] = "result";
     $hnrergoqncb = "workflowID";
     ${"GLOBALS"}["swtsotcec"] = "qualifiedModuleName";
     ${$baflayps} = PearDatabase::getInstance();
     ${"GLOBALS"}["qpgwks"] = "sql";
     ${${"GLOBALS"}["hxnhbexxth"]} = $request->getModule();
     $hrnudh = "sql";
     ${"GLOBALS"}["dgvcsdbd"] = "viewer";
     ${${"GLOBALS"}["swtsotcec"]} = $request->getModule(false);
     $ylrvxdxw = "errors";
     ${${"GLOBALS"}["dgvcsdbd"]} = $this->getViewer(${${"GLOBALS"}["vndwqun"]});
     ${$hnrergoqncb} = (int) $request->get("workflow_id");
     ${${"GLOBALS"}["qpgwks"]} = "SELECT * FROM vtiger_wf_errorlog WHERE workflow_id = " . ${${"GLOBALS"}["iixbxxmrvuvd"]};
     ${${"GLOBALS"}["ftihtoot"]} = $adb->query(${$hrnudh});
     $viewer->assign("workflow_id", ${${"GLOBALS"}["iixbxxmrvuvd"]});
     ${${"GLOBALS"}["twlpnmw"]} = array();
     while (${${"GLOBALS"}["poxjutxofp"]} = $adb->fetchByAssoc(${${"GLOBALS"}["luuhjzd"]})) {
         $neerouqdsox = "row";
         ${"GLOBALS"}["cnptdybl"] = "row";
         ${${"GLOBALS"}["cnptdybl"]}["datum_eintrag"] = VtUtils::formatUserDate(${${"GLOBALS"}["poxjutxofp"]}["datum_eintrag"]);
         ${${"GLOBALS"}["twlpnmw"]}[] = ${$neerouqdsox};
     }
     $viewer->assign("errors", ${$ylrvxdxw});
     echo $viewer->view("ErrorLog.tpl", ${${"GLOBALS"}["glixorebwvtb"]}, true);
 }
 public function process(Vtiger_Request $request)
 {
     ${"GLOBALS"}["zuvbgco"] = "url";
     ${${"GLOBALS"}["nvqrslc"]} = PearDatabase::getInstance();
     ${${"GLOBALS"}["ivimgqkchpe"]} = new Vtiger_Response();
     ${${"GLOBALS"}["zuvbgco"]} = $request->get("url");
     try {
         if (!filter_var(${${"GLOBALS"}["vwlgxcvjvn"]}, FILTER_VALIDATE_URL)) {
             throw new Exception("URL is not valid");
         }
         ${"GLOBALS"}["rwirxck"] = "needLicense";
         $eneasgio = "content";
         ${$eneasgio} = VtUtils::getContentFromUrl(${${"GLOBALS"}["vwlgxcvjvn"]});
         try {
             ${"GLOBALS"}["bykxupaxtecx"] = "root";
             ${${"GLOBALS"}["bykxupaxtecx"]} = new SimpleXMLElement(${${"GLOBALS"}["jpkdykvrxcnm"]});
         } catch (Exception $exp) {
             throw new Exception("no task repository");
         }
         if (empty($root->title)) {
             throw new Exception("no task repository (title missing)");
         }
         ${${"GLOBALS"}["jjgsblrkloz"]} = (string) $root->needLicense == "1";
         $response->setResult(array("success" => true, "title" => (string) $root->title, "license" => ${${"GLOBALS"}["rwirxck"]}));
     } catch (Exception $exp) {
         $response->setResult(array("success" => false, "error" => $exp->getMessage()));
     }
     $response->emit();
 }
Exemple #5
0
 protected function setUp()
 {
     global $adb, $phpUnitLeadId;
     ${"GLOBALS"}["vqinqhvudy"] = "sql";
     ${"GLOBALS"}["omirinrsle"] = "sql";
     ${${"GLOBALS"}["omirinrsle"]} = "SELECT leadid FROM\n                    vtiger_leaddetails\n                     LEFT JOIN vtiger_crmentity ON(vtiger_crmentity.crmid = vtiger_leaddetails.leadid)\n                WHERE firstname = 'PHPUNIT' AND lastname = 'PHPUNIT' AND deleted = 0";
     ${${"GLOBALS"}["dlfzmzsoafs"]} = $adb->query(${${"GLOBALS"}["vqinqhvudy"]});
     if ($adb->num_rows(${${"GLOBALS"}["dlfzmzsoafs"]}) > 0) {
         $pcbcvlo = "result";
         ${${"GLOBALS"}["odcnybklnoz"]} = $adb->query_result(${$pcbcvlo}, 0, "leadid");
     } else {
         $zgdgywgjnie = "document";
         ${"GLOBALS"}["fbjylokbk"] = "result";
         ${$zgdgywgjnie} = CRMEntity::getInstance("Leads");
         $document->column_fields["firstname"] = "PHPUNIT";
         $document->column_fields["lastname"] = "PHPUNIT";
         $qxhkyg = "sql";
         $document->column_fields["annualrevenue"] = "1000";
         $document->column_fields["cf_654"] = 1;
         $document->column_fields["assigned_user_id"] = 1;
         $elbiflyj = "sql";
         $document->save("Leads");
         ${$elbiflyj} = "SELECT leadid FROM\n                                vtiger_leaddetails\n                                 LEFT JOIN vtiger_crmentity ON(vtiger_crmentity.crmid = vtiger_leaddetails.leadid)\n                            WHERE firstname = 'PHPUNIT' AND lastname = 'PHPUNIT' AND deleted = 0";
         $adb->query(${$qxhkyg});
         ${${"GLOBALS"}["odcnybklnoz"]} = $adb->query_result(${${"GLOBALS"}["fbjylokbk"]}, 0, "leadid");
     }
     VTEntity::setUser(VtUtils::getAdminUser());
     print "\nMySuite::setUp()";
 }
 public function process(Vtiger_Request $request)
 {
     ${"GLOBALS"}["joshjxnqy"] = "qualifiedModuleName";
     ${"GLOBALS"}["clhmonsj"] = "viewer";
     ${"GLOBALS"}["mvqzwlvp"] = "request";
     ${${"GLOBALS"}["clhmonsj"]} = $this->getViewer(${${"GLOBALS"}["mvqzwlvp"]});
     $tgmmmle = "qualifiedModuleName";
     ${${"GLOBALS"}["joshjxnqy"]} = $request->getModule(false);
     ${${"GLOBALS"}["wdvnidxoyj"]} = VtUtils::getEntityModules(true);
     $viewer->assign("modules", ${${"GLOBALS"}["wdvnidxoyj"]});
     $viewer->view("WorkflowImporter.tpl", ${$tgmmmle});
 }
 public function beforeGetTaskform($viewer)
 {
     global $current_language, $mod_strings;
     $viewer->assign("related_modules", VtUtils::getRelatedModules($this->getModuleName()));
     $related_module = $this->get("related_module");
     if (!empty($_POST["task"]["related_module"])) {
         $parts = explode("#~#", $_POST["task"]["related_module"]);
     } elseif (!empty($related_module)) {
         if ($related_module != -1) {
             $parts = explode("#~#", $related_module);
         }
     } else {
         return;
     }
     if (!empty($parts)) {
         $viewer->assign("related_tabid", $parts[1]);
     }
 }
 public function handleTask(&$context)
 {
     $values = $this->get("cols");
     $query = array();
     $objTemplate = new VTTemplate($context);
     foreach ($values["key"] as $index => $value) {
         $keyValue = $objTemplate->render($values["value"][$index]);
         $query[$value] = $keyValue;
     }
     $url = $this->get('url', $context);
     $method = $this->get('method');
     switch ($method) {
         case 'POST':
         case 'GET':
             $content = \VtUtils::getContentFromUrl($url, $query, $method);
             break;
     }
     //        var_dump($method, $url, $query);
     //        var_dump($content);
     return "yes";
 }
 public function process(Vtiger_Request $request)
 {
     $dhllnm = "response";
     ${"GLOBALS"}["ftkqxwswkko"] = "request";
     ${"GLOBALS"}["umllvjth"] = "viewer";
     ${${"GLOBALS"}["epurlbl"]} = PearDatabase::getInstance();
     ${$dhllnm} = new Vtiger_Response();
     $tmhsvr = "params";
     ${$tmhsvr} = $request->getAll();
     ${${"GLOBALS"}["umllvjth"]} = $this->getViewer(${${"GLOBALS"}["ftkqxwswkko"]});
     ${${"GLOBALS"}["bonutetjn"]} = base64_decode($request->get("repository_url"));
     try {
         $beuqykhkk = "needLicense";
         $lhrjrsrv = "url";
         if (!filter_var(${$lhrjrsrv}, FILTER_VALIDATE_URL)) {
             throw new Exception("URL is not valid");
         }
         $oddcoi = "data";
         ${${"GLOBALS"}["hgeoufhguo"]} = VtUtils::getContentFromUrl(${${"GLOBALS"}["bonutetjn"]});
         try {
             ${"GLOBALS"}["fqwyxgloq"] = "root";
             ${${"GLOBALS"}["fqwyxgloq"]} = new SimpleXMLElement(${${"GLOBALS"}["hgeoufhguo"]});
         } catch (Exception $exp) {
             throw new Exception("no task repository");
         }
         if (empty($root->title)) {
             throw new Exception("no task repository (title missing)");
         }
         ${$beuqykhkk} = (string) $root->needLicense == "1";
         ${${"GLOBALS"}["yqifpoueqak"]} = array("title" => $root->title, "needLicense" => ${${"GLOBALS"}["ixzgwrjb"]}, "url" => ${${"GLOBALS"}["bonutetjn"]});
         $viewer->assign("nonce", sha1(vglobal("site_URL") . ${${"GLOBALS"}["bonutetjn"]} . "0s-f,mäp" . ${${"GLOBALS"}["yqifpoueqak"]}["title"]));
         $viewer->assign("data", ${$oddcoi});
         $viewer->view("AddRemoteRepository.tpl", $request->getModule(false));
     } catch (Exception $exp) {
         echo "no valid Repository " . $exp->getMessage();
     }
 }
 public function process(Vtiger_Request $request)
 {
     ${"GLOBALS"}["aoutkjk"] = "result";
     ${${"GLOBALS"}["elflftjwv"]} = PearDatabase::getInstance();
     ${"GLOBALS"}["onzttzdkr"] = "sql";
     ${${"GLOBALS"}["trmkguttw"]} = new Vtiger_Response();
     ${"GLOBALS"}["earprjnjkeq"] = "type_id";
     $cjtvetbnqr = "sql";
     $ohqfejmo = "result";
     ${${"GLOBALS"}["xcbqispjyiv"]} = $request->getAll();
     ${${"GLOBALS"}["earprjnjkeq"]} = (int) $request->get("type_id");
     ${${"GLOBALS"}["gfuxeseykw"]} = (int) $request->get("skipSignatureCheck");
     ${${"GLOBALS"}["onzttzdkr"]} = "SELECT * FROM vtiger_wf_repository_types WHERE id = " . ${${"GLOBALS"}["nacjfyfsjtk"]};
     ${${"GLOBALS"}["aoutkjk"]} = $adb->query(${$cjtvetbnqr});
     if ($adb->num_rows(${$ohqfejmo}) > 0) {
         ${"GLOBALS"}["qnoovzk"] = "tmpfname";
         ${"GLOBALS"}["kudogfvupgdj"] = "data";
         $hzkbuj = "data";
         ${"GLOBALS"}["xvphvct"] = "data";
         $cftpmf = "data";
         ${"GLOBALS"}["wkqqujnorudt"] = "fileDownloadUrl";
         ${$hzkbuj} = $adb->fetchByAssoc(${${"GLOBALS"}["brnzuhqxg"]});
         ${${"GLOBALS"}["wkqqujnorudt"]} = ${${"GLOBALS"}["kudogfvupgdj"]}["url"];
         ${${"GLOBALS"}["rmdeckcfy"]} = VtUtils::getContentFromUrl(html_entity_decode(${${"GLOBALS"}["fwpnyelos"]}));
         ${"GLOBALS"}["chudqzpgkk"] = "skipSignatureCheck";
         ${${"GLOBALS"}["qnoovzk"]} = tempnam(sys_get_temp_dir(), "WFD2");
         file_put_contents(${${"GLOBALS"}["btnuwdutiif"]}, ${${"GLOBALS"}["rmdeckcfy"]});
         if (!${${"GLOBALS"}["chudqzpgkk"]} && false == \Workflow\Repository::checkSignature(${${"GLOBALS"}["btnuwdutiif"]}, ${${"GLOBALS"}["xvphvct"]}["repos_id"], ${${"GLOBALS"}["otmrpohq"]}["checksum"])) {
             $jvbshbjxi = "tmpfname";
             echo "checksum";
             @unlink(${$jvbshbjxi});
             return;
         }
         \Workflow\Repository::installFile(${${"GLOBALS"}["btnuwdutiif"]}, ${$cftpmf}["version"], ${${"GLOBALS"}["otmrpohq"]}["repos_id"]);
         @unlink(${${"GLOBALS"}["btnuwdutiif"]});
     }
 }
 public function beforeGetTaskform($viewer)
 {
     $fields = $this->get('fields');
     if (empty($fields) || $fields == -1) {
         $fields = array();
     }
     $viewer->assign("StaticFieldsField", 'fields');
     $viewer->assign("fields", $fields);
     $viewer->assign("fromFields", $this->getFromFields());
     $viewer->assign("related_modules", VtUtils::getEntityModules(true));
     $search_module = $this->get("search_module");
     if (!empty($_POST["task"]["search_module"])) {
         $parts = explode("#~#", $_POST["task"]["search_module"]);
     } elseif (!empty($search_module)) {
         if ($search_module != -1) {
             $parts = explode("#~#", $search_module);
         }
     } else {
         return;
     }
     if (!empty($parts)) {
         $viewer->assign("related_tabid", $parts[1]);
     }
 }
    function content_56948e001f64c($_smarty_tpl)
    {
        ?>
<div style="text-align:left;position:relative;padding:5px;">
    <div id='workflow_layer_executer' style='display:none;width:100%;height:100%;top:0px;left:0px;background-image:url(modules/Workflow2/icons/modal_white.png);font-size:12px;letter-spacing:1px;border:1px solid #777777;  position:absolute;text-align:center;'><br><img src='modules/Workflow2/icons/sending.gif'><br><br><strong>Executing Workflow ...</strong><br><a href='#' onclick='jQuery("#workflow_layer_executer").hide();return false;'>Close</a></a></div>
    <?php 
        if ($_smarty_tpl->tpl_vars['show_listview']->value == true) {
            ?>
        <?php 
            if (count($_smarty_tpl->tpl_vars['workflows']->value) > 0) {
                ?>
            <?php 
                echo vtranslate('LBL_FORCE_EXECUTION', 'Workflow2');
                ?>

            <select name="workflow2_workflowid" id="workflow2_workflowid" size=7 class="detailedViewTextBox" style="width:100%;">
                <!--<option value='0'><<?php 
                ?>
?php echo getTranslatedString("LBL_CHOOSE", "Workflow2"); ?<?php 
                ?>
></option>-->
                <?php 
                $_smarty_tpl->tpl_vars['workflow'] = new Smarty_Variable();
                $_smarty_tpl->tpl_vars['workflow']->_loop = false;
                $_from = $_smarty_tpl->tpl_vars['workflows']->value;
                if (!is_array($_from) && !is_object($_from)) {
                    settype($_from, 'array');
                }
                foreach ($_from as $_smarty_tpl->tpl_vars['workflow']->key => $_smarty_tpl->tpl_vars['workflow']->value) {
                    $_smarty_tpl->tpl_vars['workflow']->_loop = true;
                    ?>
                    <option value='<?php 
                    echo $_smarty_tpl->tpl_vars['workflow']->value['id'];
                    ?>
' data-withoutrecord="<?php 
                    echo $_smarty_tpl->tpl_vars['workflow']->value['withoutrecord'];
                    ?>
"><?php 
                    echo $_smarty_tpl->tpl_vars['workflow']->value['title'];
                    ?>
</option>
                <?php 
                }
                ?>
            </select>
            <button class="btn btn-success"  onclick="runSidebarWorkflow('<?php 
                echo $_smarty_tpl->tpl_vars['crmid']->value;
                ?>
');"name='runWorkfow' ><?php 
                echo vtranslate('execute', 'Workflow2');
                ?>
</button>
        <?php 
            } else {
                ?>
            <span style="color:#777;font-style:italic;"><?php 
                echo vtranslate('LBL_NO_WORKFLOWS', 'Workflow2');
                ?>
</span>
        <?php 
            }
            ?>
    <?php 
        }
        ?>

    <?php 
        if ($_smarty_tpl->tpl_vars['isAdmin']->value == true) {
            ?>
    <a class="pull-right" href="#" onclick="showEntityData('<?php 
            echo $_smarty_tpl->tpl_vars['crmid']->value;
            ?>
');return false;" name='showEntityData'><?php 
            echo vtranslate('BTN_SHOW_ENTITYDATA', 'Workflow2');
            ?>
</a>
    <?php 
        }
        ?>
    <div id="startfieldsContainer" style="position:relative;"></div>
    <?php 
        $_smarty_tpl->tpl_vars['button'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['button']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['buttons']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['button']->key => $_smarty_tpl->tpl_vars['button']->value) {
            $_smarty_tpl->tpl_vars['button']->_loop = true;
            ?>
    <button type="button" data-crmid="<?php 
            echo $_smarty_tpl->tpl_vars['crmid']->value;
            ?>
" class="btn" onclick="var workflow = new Workflow();workflow.execute(<?php 
            echo $_smarty_tpl->tpl_vars['button']->value['workflow_id'];
            ?>
, <?php 
            echo $_smarty_tpl->tpl_vars['crmid']->value;
            ?>
);" alt="execute this workflow"  title="execute this workflow" style="text-shadow:none;color:<?php 
            echo $_smarty_tpl->tpl_vars['button']->value['textcolor'];
            ?>
; background-color: <?php 
            echo $_smarty_tpl->tpl_vars['button']->value['color'];
            ?>
;margin-top:2px;width:100%;"><?php 
            echo $_smarty_tpl->tpl_vars['button']->value['label'];
            ?>
</button><br/>
    <?php 
        }
        ?>

    <?php 
        if (count($_smarty_tpl->tpl_vars['waiting']->value) > 0) {
            ?>
        <p><strong><?php 
            echo vtranslate("running Workflows with this record", "Workflow2");
            ?>
:</strong></p>
        <table width='238' cellspacing=0  style="font-size:10px;">
            <?php 
            $_smarty_tpl->tpl_vars['workflow'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['workflow']->_loop = false;
            $_from = $_smarty_tpl->tpl_vars['waiting']->value;
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['workflow']->key => $_smarty_tpl->tpl_vars['workflow']->value) {
                $_smarty_tpl->tpl_vars['workflow']->_loop = true;
                ?>
                <tr>
                    <?php 
                if ($_smarty_tpl->tpl_vars['isAdmin']->value == true) {
                    ?>
                        <td style='border-top:1px solid #ccc;' colspan=2><a href='index.php?module=Workflow2&view=Config&parent=Settings&workflow=<?php 
                    echo $_smarty_tpl->tpl_vars['workflow']->value['workflow_id'];
                    ?>
'><?php 
                    echo $_smarty_tpl->tpl_vars['workflow']->value['title'];
                    ?>
</a></td>
                    <?php 
                } else {
                    ?>
                        <td style='border-top:1px solid #ccc;' colspan=2><?php 
                    echo $_smarty_tpl->tpl_vars['workflow']->value['title'];
                    ?>
</td>
                    <?php 
                }
                ?>
                </tr>
                <tr>
                    <td colspan=2><strong><?php 
                echo $_smarty_tpl->tpl_vars['workflow']->value['text'];
                ?>
</strong></td>
                </tr>
                <tr>
                    <td style='border-bottom:1px solid #ccc;'>
                        <a href='#' onclick='return stopWorkflow("<?php 
                echo $_smarty_tpl->tpl_vars['workflow']->value['execid'];
                ?>
","<?php 
                echo $_smarty_tpl->tpl_vars['workflow']->value['crmid'];
                ?>
","<?php 
                echo $_smarty_tpl->tpl_vars['workflow']->value['block_id'];
                ?>
");return false;'>del</a> |
                        <a href='#' onclick='return continueWorkflow("<?php 
                echo $_smarty_tpl->tpl_vars['workflow']->value['execid'];
                ?>
","<?php 
                echo $_smarty_tpl->tpl_vars['workflow']->value['crmid'];
                ?>
","<?php 
                echo $_smarty_tpl->tpl_vars['workflow']->value['block_id'];
                ?>
");return false;'>continue</a>
                    </td>
                    <td style='text-align:right;border-bottom:1px solid #ccc;'><?php 
                echo DateTimeField::convertToUserFormat(VtUtils::convertToUserTZ($_smarty_tpl->tpl_vars['workflow']->value['nextsteptime']));
                ?>
</td>
                </tr>
            <?php 
            }
            ?>
        </table>
    <?php 
        }
        ?>
</div>
<script type="text/javascript">var WorkflowRecordMessages = <?php 
        echo json_encode($_smarty_tpl->tpl_vars['messages']->value);
        ?>
; var WFUserIsAdmin = <?php 
        if ($_smarty_tpl->tpl_vars['isAdmin']->value == true) {
            ?>
true<?php 
        } else {
            ?>
false<?php 
        }
        ?>
;</script>
<script type="text/javascript">jQuery(window).trigger('workflow.detail.sidebar.ready');</script>
<?php 
    }
Exemple #13
0
 public static function getFieldsForModule($module_name, $references = false)
 {
     ${"GLOBALS"}["oukrqe"] = "references";
     return VtUtils::getFieldsWithBlocksForModule(${${"GLOBALS"}["nlmyndvn"]}, ${${"GLOBALS"}["oukrqe"]});
 }
Exemple #14
0
${"GLOBALS"}["lyiupor"] = "errors";
${"GLOBALS"}["hgxcxmxrb"] = "theme";
${"GLOBALS"}["zanpkuubb"] = "current_language";
${"GLOBALS"}["vrepvdlfosem"] = "app_strings";
${"GLOBALS"}["lvfvlsd"] = "result";
$jyqetpzizi = "smarty";
${"GLOBALS"}["zjdmtrdi"] = "workflowID";
$tlmeurdvn = "row";
${"GLOBALS"}["kcsrqqgkgw"] = "sql";
${"GLOBALS"}["nymnjtnulvk"] = "workflowID";
${"GLOBALS"}["dbvilhykkv"] = "sql";
require_once "autoload_wf.php";
${${"GLOBALS"}["nymnjtnulvk"]} = intval($_GET["workflow_id"]);
${${"GLOBALS"}["kcsrqqgkgw"]} = "SELECT * FROM vtiger_wf_errorlog WHERE workflow_id = " . ${${"GLOBALS"}["zjdmtrdi"]};
${${"GLOBALS"}["lvfvlsd"]} = $adb->query(${${"GLOBALS"}["dbvilhykkv"]});
require_once "Smarty_setup.php";
${$jyqetpzizi} = new vtigerCRM_Smarty();
$smarty->assign("APP", ${${"GLOBALS"}["vrepvdlfosem"]});
$smarty->assign("MOD", return_module_language(${${"GLOBALS"}["zanpkuubb"]}, "Workflow2"));
$smarty->assign("THEME", ${${"GLOBALS"}["hgxcxmxrb"]});
${"GLOBALS"}["boknedqy"] = "workflowID";
$smarty->assign("IMAGE_PATH", "themes/{$theme}/images/");
$smarty->assign("workflow_id", ${${"GLOBALS"}["boknedqy"]});
${${"GLOBALS"}["lyiupor"]} = array();
while (${$tlmeurdvn} = $adb->fetchByAssoc(${${"GLOBALS"}["lvfvlsd"]})) {
    $gvelerrodep = "row";
    ${${"GLOBALS"}["egkhjjkd"]}["datum_eintrag"] = VtUtils::formatUserDate(${$gvelerrodep}["datum_eintrag"]);
    ${${"GLOBALS"}["lyiupor"]}[] = ${${"GLOBALS"}["egkhjjkd"]};
}
$smarty->assign("errors", ${${"GLOBALS"}["lyiupor"]});
$smarty->display(vtlib_getModuleTemplate("Workflow2", "ErrorLog.tpl"));
 public function beforeGetTaskform($viewer)
 {
     global $adb, $current_language, $mod_strings;
     $viewer->assign("related_modules", VtUtils::getEntityModules(true));
     $search_module = $this->get("search_module");
     if (!empty($_POST["task"]["search_module"])) {
         $parts = explode("#~#", $_POST["task"]["search_module"]);
     } elseif (!empty($search_module)) {
         if ($search_module != -1) {
             $parts = explode("#~#", $search_module);
         }
     } else {
         return;
     }
     if (!empty($parts)) {
         $viewer->assign("search_module", $parts[0]);
         $viewer->assign("related_tabid", $parts[1]);
         $search_module_name = VtUtils::getModuleName($parts[1]);
         #$workflowSettings = $this->getWorkflow()->getSettings();
         $fields = VtUtils::getFieldsWithBlocksForModule($search_module_name);
         $viewer->assign("sort_fields", $fields);
     }
 }
 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 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") . "&nbsp;&nbsp;(" . 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"]) . "&nbsp;&nbsp;&nbsp;(" . 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 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"];
         $allFields = VtUtils::getFieldsForModule($_POST["task"]["new_module_setter"], true);
         $mandatoryFields = VtUtils::getMandatoryFields(getTabid($_POST["task"]["new_module_setter"]));
         $startFields = array();
         $counter = 1;
         $fromFields = $this->fieldSetter->getFromFields();
         $tmpFields = array();
         foreach ($mandatoryFields as $fields) {
             $tmpFields[$fields['fieldname']] = 1;
         }
         $mandatoryFields = $tmpFields;
         $tmpFields = array();
         foreach ($fromFields as $block) {
             foreach ($block as $field) {
                 $tmpFields[$field->name] = 1;
             }
         }
         foreach ($allFields as $field) {
             if ($field->name != 'crmid') {
                 if (isset($tmpFields[$field->name])) {
                     $startValue = '$' . $field->name;
                 } else {
                     $startValue = '';
                 }
                 if ($field->uitype != 4 && $field->uitype != 70 && $field->name != 'modifiedby' && $field->displaytype != 3 && $field->displaytype != 5 && $field->displaytype != 2) {
                     $startFields["" . $counter] = array("field" => $field->name, "mode" => "field", "value" => $startValue, 'fixed' => isset($mandatoryFields[$field->name]));
                     $counter++;
                 }
             }
         }
         if ($_POST["task"]["new_module_setter"] == "Calendar") {
             $startFields["" . $counter] = array("field" => "time_start", "mode" => "value", "value" => "");
         }
         $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);
     if ($this->_productchooser !== null) {
         $viewer->assign('productchooser', true);
     }
 }
Exemple #19
0
 public function beforeGetTaskform($viewer)
 {
     global $adb, $current_language, $mod_strings;
     if (!getTabid('PDFMaker') || !vtlib_isModuleActive('PDFMaker')) {
         $viewer->assign('disable', true);
         $this->addConfigHint(getTranslatedString('LBL_FOR_THIS_YOU_NEED_PDFMAKER', 'Settings:Workflow2'));
         return;
     }
     $copies = $this->get('copies');
     if ($copies === -1 || empty($copies)) {
         $this->set('copies', 1);
     }
     $viewer->assign("related_modules", VtUtils::getEntityModules(true));
     $search_module = $this->get("search_module");
     $parts = false;
     if (!empty($_POST["task"]["search_module"])) {
         $parts = explode("#~#", $_POST["task"]["search_module"]);
     } elseif (!empty($search_module)) {
         if ($search_module != -1) {
             $parts = explode("#~#", $search_module);
             $tabid = $parts[1];
         }
     }
     if (!empty($parts)) {
         $moduleName = $parts[0];
         $tabid = $parts[1];
     } else {
         $moduleName = $this->getModuleName();
         $tabid = getTabid($moduleName);
     }
     $viewer->assign("related_tabid", $tabid);
     $fields = VtUtils::getFieldsWithBlocksForModule($moduleName);
     $viewer->assign("sort_fields", $fields);
     require_once 'modules/PDFMaker/helpers/Version.php';
     $viewer->assign('PDFMAKER_VERSION', PDFMaker_Version_Helper::$version);
     $sql = "SELECT folderid, foldername FROM vtiger_attachmentsfolder ORDER BY sequence";
     $result = $adb->query($sql);
     $folders = array();
     while ($row = $adb->fetch_array($result)) {
         $folders[] = $row;
     }
     $viewer->assign("folders", $folders);
     $sql = "SELECT templateid, filename, description FROM vtiger_pdfmaker WHERE module = '" . $moduleName . "'";
     $result = $adb->query($sql);
     $templates = array();
     while ($row = $adb->fetch_array($result)) {
         $templates[] = $row;
     }
     $viewer->assign("templates", $templates);
     $workflows = \Workflow2::getWorkflowsForModule("Documents", 1);
     $viewer->assign("workflows", $workflows);
 }
 public function beforeGetTaskform($viewer)
 {
     global $adb, $current_language, $mod_strings;
     $viewer->assign("related_modules", VtUtils::getEntityModules(true));
     $search_module = $this->get("search_module");
     if (!empty($_POST["task"]["search_module"])) {
         $parts = explode("#~#", $_POST["task"]["search_module"]);
     } elseif (!empty($search_module)) {
         if ($search_module != -1) {
             $parts = explode("#~#", $search_module);
         }
     } else {
         return;
     }
     if (!empty($parts)) {
         $viewer->assign("related_tabid", $parts[1]);
         $search_module_name = VtUtils::getModuleName($parts[1]);
         #$workflowSettings = $this->getWorkflow()->getSettings();
         $workflows = $workflows = Workflow2::getWorkflowsForModule($search_module_name, 1);
         $viewer->assign("workflows", $workflows);
         $fields = VtUtils::getFieldsWithBlocksForModule($search_module_name);
         $viewer->assign("sort_fields", $fields);
         $moduleObj = \Vtiger_Module_Model::getInstance($search_module_name);
         $viewer->assign('productCache', array());
         if ($moduleObj instanceof \Inventory_Module_Model) {
             $viewer->assign('searchByProduct', true);
             $product = $this->get('products');
             if (!empty($product)) {
                 //$dataObj = \Vtiger_Record_Model::getInstanceById($product);
                 $productCache[$product] = array('label' => \Vtiger_Functions::getCRMRecordLabel($product));
                 $viewer->assign('productCache', $productCache);
             }
         }
         $views = array();
         $allviews = \CustomView_Record_Model::getAll($search_module_name);
         foreach ($allviews as $view) {
             $views[$view->get('cvid')] = $view->get('viewname');
         }
         $viewer->assign('customviews', $views);
     }
 }
 public function beforeGetTaskform($viewer)
 {
     $fields = VtUtils::getFieldsWithBlocksForModule('Emails');
     $viewer->assign("sort_fields", $fields);
     /* Insert here source code to create custom configurations pages */
 }
Exemple #22
0
 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);
 }
 public function beforeGetTaskform($viewer)
 {
     global $adb;
     $connected = $this->getConnectedObjects("Absender");
     if (count($connected) > 0) {
         $viewer->assign("from", array("from_mail" => $connected[0]->get("email1"), "from_name" => trim($connected[0]->get("first_name") . " " . $connected[0]->get("last_name")), "from_readonly" => true));
     }
     //        $smtpServer = \Workflow\ConnectionProvider::getAvailableConfigurations('smtp');
     //        var_dump($smtpServer);exit();
     $connected = $this->getConnectedObjects("BCC");
     $bccs = $connected->get("email1");
     $viewer->assign("bccs", $bccs);
     $from_email = $this->get("from_mail");
     if ($from_email === -1) {
         global $current_user;
         $from_email = $current_user->column_fields["email1"];
         $from_name = $current_user->column_fields["first_name"] . " " . $current_user->column_fields["last_name"];
         $this->set("from_mail", $from_email);
         $this->set("from_name", $from_name);
     }
     $availableSpecialAttachments = \Workflow\Attachment::getAvailableOptions($this->getModuleName());
     $attachmentHTML = array();
     $attachmentJAVASCRIPT = array();
     foreach ($availableSpecialAttachments as $item) {
         $attachmentHTML[] = '<div>' . $item['html'] . '</div>';
         $attachmentJAVASCRIPT[] = !empty($item['script']) ? $item['script'] : '';
     }
     // implode the array to one string
     $viewer->assign('attachmentsHTML', implode("\n", $attachmentHTML));
     // transmit array to create single script tags
     $viewer->assign('attachmentsJAVASCRIPT', $attachmentJAVASCRIPT);
     if (vtlib_isModuleActive('Emails')) {
         $availableAttachments = \Workflow\InterfaceFiles::getAvailableFiles($this->getModuleName());
     } else {
         throw new \Exception('To use this task, you need to activate the "Emails" module.');
     }
     $jsList = array();
     foreach ($availableAttachments as $title => $group) {
         foreach ($group as $index => $value) {
             $jsList[$index] = $value;
         }
     }
     $viewer->assign("jsAttachmentsList", $jsList);
     $viewer->assign("available_attachments", $availableAttachments);
     if ($this->get("attachments") == -1) {
         $this->set("attachments", '{}');
     }
     if ($this->get("attachments") == "") {
         $this->set("attachments", '{}');
     }
     $sql = "SELECT * FROM vtiger_emailtemplates WHERE deleted = 0";
     $result = $adb->query($sql);
     $mailtemplates = array();
     while ($row = $adb->fetchByAssoc($result)) {
         $mailtemplates['Email Templates'][$row["templateid"]] = $row["templatename"];
     }
     if (vtlib_isModuleActive('EMAILMaker') && class_exists('EMAILMaker_Module_Model')) {
         $emailmaker = new \EMAILMaker_Module_Model();
         if (method_exists($emailmaker, 'GetAvailableTemplates')) {
             $templates = $emailmaker->GetAvailableTemplates($this->getModuleName());
             foreach ($templates as $categoryTitle => $category) {
                 if (!is_array($category)) {
                     $mailtemplates['EMAILMaker']['s#emailmaker#' . $categoryTitle] = $category;
                 } else {
                     foreach ($category as $templateid => $template) {
                         $mailtemplates['EMAILMaker ' . $categoryTitle]['s#emailmaker#' . $templateid] = $template;
                     }
                 }
             }
         }
     }
     $viewer->assign("MAIL_TEMPLATES", $mailtemplates);
     $viewer->assign("fields", \VtUtils::getFieldsWithBlocksForModule($this->getModuleName(), true));
     if (defined("WF_DEMO_MODE") && constant("WF_DEMO_MODE") == true) {
         echo "<p style='text-align:center;margin:0;padding:5px 0;background-color:#fbcb09;font-weight:bold;'>The sendmail Task won't work on demo.stefanwarnat.de</p>";
     }
 }
 public function 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 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)
 {
     $fields = $this->get('fields');
     if (empty($fields) || $fields == -1) {
         $fields = array();
     }
     $viewer->assign("StaticFieldsField", 'fields');
     $viewer->assign("fields", $fields);
     $viewer->assign("fromFields", $this->getFromFields());
     $viewer->assign("related_modules", VtUtils::getEntityModules(true));
     $search_module = $this->get("search_module");
     if (!empty($_POST["task"]["search_module"])) {
         $parts = explode("#~#", $_POST["task"]["search_module"]);
     } elseif (!empty($search_module)) {
         if ($search_module != -1) {
             $parts = explode("#~#", $search_module);
         }
     } else {
         return;
     }
     $views = array();
     $allviews = \CustomView_Record_Model::getAll($parts[0]);
     foreach ($allviews as $view) {
         $views[$view->get('cvid')] = $view->get('viewname');
     }
     $viewer->assign('customviews', $views);
     if (!empty($parts)) {
         $viewer->assign("related_tabid", $parts[1]);
         $viewer->assign("target_module_name", $parts[0]);
     }
 }
 public static function register($url, $licenseCode = '', $name = '', $skipCheck = false, $nonce = '')
 {
     ${"GLOBALS"}["wrloeiy"] = "adb";
     ${"GLOBALS"}["xsycvc"] = "licenseCode";
     $obcwfec = "result";
     $hhifiq = "sql";
     ${${"GLOBALS"}["wrloeiy"]} = \PearDatabase::getInstance();
     ${"GLOBALS"}["jjqrbr"] = "url";
     ${${"GLOBALS"}["mzvwcfaulgey"]} = "SELECT * FROM vtiger_wf_repository WHERE url = ?";
     ${${"GLOBALS"}["svanukneqv"]} = $adb->pquery(${$hhifiq}, array(${${"GLOBALS"}["ihfsqxoqzzd"]}));
     ${"GLOBALS"}["lexawjarmo"] = "obj";
     if ($adb->num_rows(${$obcwfec}) > 0) {
         throw new \Exception("repository already added");
     }
     ${${"GLOBALS"}["rytusjqhjk"]} = VtUtils::getContentFromUrl(${${"GLOBALS"}["jjqrbr"]});
     var_dump(${${"GLOBALS"}["rytusjqhjk"]});
     ${"GLOBALS"}["jxhrzk"] = "skipCheck";
     $knwkhlcpnk = "url";
     ${"GLOBALS"}["ibiobtifeqzr"] = "repoId";
     if (${${"GLOBALS"}["jxhrzk"]} === false) {
         $snyuqxhjnbm = "nonce";
         $xlgweuebatn = "title";
         try {
             ${${"GLOBALS"}["hbvnhhjbposj"]} = new \SimpleXMLElement(${${"GLOBALS"}["rytusjqhjk"]});
         } catch (\Exception $exp) {
             throw new \Exception("no task repository");
         }
         ${"GLOBALS"}["lonyvcjyber"] = "title";
         if (empty($root->title)) {
             throw new \Exception("no task repository (title missing)");
         }
         ${"GLOBALS"}["mgvwtbxtx"] = "url";
         ${${"GLOBALS"}["lonyvcjyber"]} = (string) $root->title;
         if (${$snyuqxhjnbm} !== sha1(vglobal("site_URL") . ${${"GLOBALS"}["mgvwtbxtx"]} . "0s-f,mäp" . ${$xlgweuebatn})) {
             die("nothing");
         }
     } else {
         try {
             ${"GLOBALS"}["mwumnezdyo"] = "content";
             $gchifffcthk = "root";
             ${$gchifffcthk} = new \SimpleXMLElement(${${"GLOBALS"}["mwumnezdyo"]});
         } catch (\Exception $exp) {
         }
         if (!empty($name)) {
             ${${"GLOBALS"}["izuqshsie"]} = ${${"GLOBALS"}["wkeuqjj"]};
         } else {
             $ugbdguv = "title";
             ${$ugbdguv} = (string) $root->title;
         }
     }
     ${${"GLOBALS"}["mzvwcfaulgey"]} = "INSERT INTO vtiger_wf_repository SET title = ?, url = ?, licenseCode = ?, status = \"stable\"";
     $adb->pquery(${${"GLOBALS"}["mzvwcfaulgey"]}, array(${${"GLOBALS"}["izuqshsie"]}, ${$knwkhlcpnk}, md5(${${"GLOBALS"}["xsycvc"]})));
     ${${"GLOBALS"}["ibiobtifeqzr"]} = $adb->getLastInsertID();
     if (isset(${${"GLOBALS"}["hbvnhhjbposj"]})) {
         if (isset($root->publicKey)) {
             ${"GLOBALS"}["mxefcmrpk"] = "root_directory";
             $nurznzdldwvd = "root_directory";
             global $root_directory;
             @mkdir(${${"GLOBALS"}["wcvjbnt"]} . "/" . PATH_MODULE . "/publicKeys/");
             ${"GLOBALS"}["ubmkys"] = "repoId";
             ${${"GLOBALS"}["shogoyor"]} = VtUtils::getContentFromUrl("" . $root->publicKey);
             echo ${${"GLOBALS"}["mxefcmrpk"]} . "/" . PATH_MODULE . "/publicKeys/repo_" . ${${"GLOBALS"}["ubmkys"]} . ".pem";
             file_put_contents(${$nurznzdldwvd} . "/" . PATH_MODULE . "/publicKeys/repo_" . ${${"GLOBALS"}["cfbunwjgym"]} . ".pem", ${${"GLOBALS"}["shogoyor"]});
         }
     }
     ${${"GLOBALS"}["lexawjarmo"]} = new Repository(${${"GLOBALS"}["cfbunwjgym"]});
     $obj->update();
     return ${${"GLOBALS"}["cfbunwjgym"]};
 }