コード例 #1
0
ファイル: WfTaskRelcheck.php プロジェクト: cin-system/cinrepo
 /**
  * @param $context \Workflow\VTEntity
  * @return string
  */
 public function handleTask(&$context)
 {
     global $list_max_entries_per_page, $adb, $currentModule;
     $old_list_max_entries_per_page = $list_max_entries_per_page;
     if ($this->get("related_module") == -1) {
         return "no";
     }
     $currentModule = $this->getModuleName();
     $found_rows = $this->get("found_rows");
     if (empty($found_rows) || $found_rows == -1) {
         $found_rows = 1;
     }
     $parts = explode("#~#", $this->get("related_module"));
     $functionName = $parts[0];
     $relatedModuleName = \Workflow\VtUtils::getModuleName($parts[1]);
     //$relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName, $label);
     $parentRecordModel = Vtiger_Record_Model::getInstanceById($context->getId(), $context->getModuleName());
     /**
      * @var Vtiger_RelationListView_Model $relatedListView
      */
     $relationListView = Vtiger_RelationListView_Model::getInstance($parentRecordModel, $relatedModuleName);
     $query = $relationListView->getRelationQuery();
     $query = preg_replace('/SELECT(.+)FROM/imU', 'SELECT vtiger_crmentity.crmid FROM', $query);
     $logger = new \Workflow\ConditionLogger();
     $relModule = \Workflow\VtUtils::getModuleName($parts[1]);
     $objMySQL = new \Workflow\ConditionMysql($relModule, $context);
     $objMySQL->setLogger($logger);
     $main_module = \CRMEntity::getInstance($relModule);
     $sqlCondition = $objMySQL->parse($this->get("condition"));
     $sqlTables = $objMySQL->generateTables();
     $logs = $logger->getLogs();
     $this->setStat($logs);
     $idColumn = $main_module->table_name . "." . $main_module->table_index;
     $sqlQuery = "SELECT {$idColumn} " . $sqlTables . " WHERE {$idColumn} IN (" . $query . ")" . (strlen($sqlCondition) > 3 ? " AND " . $sqlCondition : "");
     $this->addStat("MySQL Query: " . $sqlQuery);
     $result = $adb->query($sqlQuery, true);
     $this->addStat("num Rows: " . $adb->num_rows($result));
     $this->addStat("have to at least x rows: " . $found_rows);
     if ($adb->num_rows($result) >= $found_rows) {
         return 'yes';
     }
     return "no";
 }
コード例 #2
0
ファイル: Config.php プロジェクト: cin-system/cinrepo
 public function preProcess($request)
 {
     ${"GLOBALS"}["rkgmoxvznlb"] = "request";
     ${${"GLOBALS"}["socqiptt"]} = $request->get("workflow");
     if (!empty(${${"GLOBALS"}["socqiptt"]})) {
         ${"GLOBALS"}["yreglrnv"] = "values";
         ${"GLOBALS"}["zvauiryc"] = "adb";
         ${${"GLOBALS"}["zvauiryc"]} = PearDatabase::getInstance();
         ${${"GLOBALS"}["yreglrnv"]} = array();
         if (isset(${${"GLOBALS"}["socqiptt"]}["mainmodule"])) {
             ${"GLOBALS"}["cocdvbaiflk"] = "workflow";
             ${${"GLOBALS"}["wounomveyrd"]} = $request->get("workflow");
             ${${"GLOBALS"}["rmbbwt"]}[] = VtUtils::getModuleName(${${"GLOBALS"}["cocdvbaiflk"]}["mainmodule"]);
             ${${"GLOBALS"}["fwjxwcmhme"]}[] = "`module_name` = ?";
         }
         if (count(${${"GLOBALS"}["fwjxwcmhme"]}) > 0) {
             ${"GLOBALS"}["bejhrqdh"] = "sql";
             ${${"GLOBALS"}["wounomveyrd"]} = $request->get("workflow");
             ${${"GLOBALS"}["bejhrqdh"]} = "UPDATE vtiger_wf_settings SET " . implode(",", ${${"GLOBALS"}["fwjxwcmhme"]}) . " WHERE id = " . intval(${${"GLOBALS"}["wounomveyrd"]}["id"]);
             $adb->pquery(${${"GLOBALS"}["npnwejaci"]}, array(${${"GLOBALS"}["rmbbwt"]}));
         }
     }
     parent::preProcess(${${"GLOBALS"}["rkgmoxvznlb"]});
 }