Exemplo n.º 1
0
 /**
  * Get all the fields of the module or block
  * @param Vtiger_Block Instance of block to use to get fields, false to get all the block fields
  */
 function getFields($blockInstance = false)
 {
     $fields = false;
     if ($blockInstance) {
         $fields = Vtiger_Field::getAllForBlock($blockInstance, $this);
     } else {
         $fields = Vtiger_Field::getAllForModule($this);
     }
     return $fields;
 }
 /**
  * Delete block instance
  * @param Boolean True to delete associated fields, False to avoid it
  */
 function delete($recursive = true)
 {
     if ($recursive) {
         $fields = Vtiger_Field::getAllForBlock($this);
         foreach ($fields as $fieldInstance) {
             $fieldInstance->delete($recursive);
         }
     }
     $this->__delete();
 }
Exemplo n.º 3
0
 public static function getFieldsWithBlocksForModule($module_name, $references = false, $refTemplate = "([source]: ([module]) [destination])")
 {
     $wmdpupqmkw = "modLang";
     global $current_language, $adb, $app_strings;
     $jyoclduhijw = "instance";
     if (empty(${${"GLOBALS"}["dtigqiycyl"]}) && ${${"GLOBALS"}["uoikifoisc"]} == true) {
         $hepidzbf = "refTemplate";
         ${$hepidzbf} = "([source]: ([module]) [destination])";
     }
     ${"GLOBALS"}["qdchdj"] = "module";
     ${"GLOBALS"}["dlxjxqbp"] = "current_language";
     $kquvbsysfcu = "moduleFields";
     include_once "vtlib/Vtiger/Module.php";
     ${${"GLOBALS"}["qdchdj"]} = ${${"GLOBALS"}["kgrlqorxi"]};
     ${${"GLOBALS"}["visvlqiwmar"]} = Vtiger_Module::getInstance(${${"GLOBALS"}["fmewvndt"]});
     ${"GLOBALS"}["gkjcbzii"] = "blocks";
     ${${"GLOBALS"}["tuyqii"]} = Vtiger_Block::getAllForModule(${$jyoclduhijw});
     ${"GLOBALS"}["otfgztbcykam"] = "module";
     ${"GLOBALS"}["dwkjhu"] = "addReferences";
     if (${${"GLOBALS"}["otfgztbcykam"]} != "Events") {
         ${"GLOBALS"}["isokwmqve"] = "langModule";
         ${${"GLOBALS"}["isokwmqve"]} = ${${"GLOBALS"}["fmewvndt"]};
     } else {
         $oivtxenk = "langModule";
         ${$oivtxenk} = "Calendar";
     }
     ${$wmdpupqmkw} = return_module_language(${${"GLOBALS"}["dlxjxqbp"]}, ${${"GLOBALS"}["pdnqbcq"]});
     ${$kquvbsysfcu} = array();
     ${${"GLOBALS"}["sereklx"]} = array();
     ${"GLOBALS"}["qpvmpezinov"] = "moduleFields";
     if (is_array(${${"GLOBALS"}["gkjcbzii"]})) {
         ${"GLOBALS"}["twqgybnkx"] = "block";
         $wmhyxeckigh = "blocks";
         foreach (${$wmhyxeckigh} as ${${"GLOBALS"}["twqgybnkx"]}) {
             $vsrjrtsyjwuy = "block";
             $jtvjnrg = "fields";
             ${"GLOBALS"}["fybcdi"] = "fields";
             $jiroosdtbga = "instance";
             ${"GLOBALS"}["wzbaaqfp"] = "fields";
             ${${"GLOBALS"}["wzbaaqfp"]} = Vtiger_Field::getAllForBlock(${$vsrjrtsyjwuy}, ${$jiroosdtbga});
             ${"GLOBALS"}["qindbfrv"] = "fields";
             if (empty(${${"GLOBALS"}["fybcdi"]}) || !is_array(${${"GLOBALS"}["qindbfrv"]})) {
                 continue;
             }
             foreach (${$jtvjnrg} as ${${"GLOBALS"}["iswxctbj"]}) {
                 ${"GLOBALS"}["gpvotsermfo"] = "module";
                 ${"GLOBALS"}["ltyuthgs"] = "references";
                 $field->label = getTranslatedString($field->label, ${${"GLOBALS"}["gpvotsermfo"]});
                 if (${${"GLOBALS"}["ltyuthgs"]} !== false) {
                     ${"GLOBALS"}["txxkntyfk"] = "addReferences";
                     $dcbsrjwyigh = "addReferences";
                     $qqmucyy = "field";
                     $svmyfptxpk = "field";
                     $msdeydhan = "addReferences";
                     ${"GLOBALS"}["kwkccfh"] = "field";
                     $amiqkcrlotrq = "result";
                     ${"GLOBALS"}["duvygkbpexkh"] = "addReferences";
                     $kxrugplfiqo = "result";
                     $bjhinyeqy = "addReferences";
                     $yiujkrbxum = "field";
                     ${"GLOBALS"}["ltyirzpnpba"] = "field";
                     $qynnew = "field";
                     $jrfetwc = "field";
                     ${"GLOBALS"}["roilmn"] = "addReferences";
                     switch ($field->uitype) {
                         case "51":
                             ${${"GLOBALS"}["sereklx"]}[] = array(${${"GLOBALS"}["iswxctbj"]}, "Accounts");
                             break;
                         case "52":
                             ${${"GLOBALS"}["txxkntyfk"]}[] = array(${${"GLOBALS"}["iswxctbj"]}, "Users");
                             break;
                         case "53":
                             ${${"GLOBALS"}["roilmn"]}[] = array(${${"GLOBALS"}["iswxctbj"]}, "Users");
                             break;
                         case "57":
                             ${${"GLOBALS"}["duvygkbpexkh"]}[] = array(${${"GLOBALS"}["iswxctbj"]}, "Contacts");
                             break;
                         case "58":
                             ${${"GLOBALS"}["sereklx"]}[] = array(${${"GLOBALS"}["kwkccfh"]}, "Campaigns");
                             break;
                         case "59":
                             ${${"GLOBALS"}["sereklx"]}[] = array(${${"GLOBALS"}["ltyirzpnpba"]}, "Products");
                             break;
                         case "73":
                             ${$bjhinyeqy}[] = array(${${"GLOBALS"}["iswxctbj"]}, "Accounts");
                             break;
                         case "75":
                             ${${"GLOBALS"}["sereklx"]}[] = array(${$svmyfptxpk}, "Vendors");
                             break;
                         case "81":
                             ${$dcbsrjwyigh}[] = array(${$qynnew}, "Vendors");
                             break;
                         case "76":
                             ${${"GLOBALS"}["sereklx"]}[] = array(${${"GLOBALS"}["iswxctbj"]}, "Potentials");
                             break;
                         case "78":
                             ${${"GLOBALS"}["sereklx"]}[] = array(${$qqmucyy}, "Quotes");
                             break;
                         case "80":
                             ${${"GLOBALS"}["sereklx"]}[] = array(${$yiujkrbxum}, "SalesOrder");
                             break;
                         case "68":
                             ${$msdeydhan}[] = array(${$jrfetwc}, "Accounts");
                             ${${"GLOBALS"}["sereklx"]}[] = array(${${"GLOBALS"}["iswxctbj"]}, "Contacts");
                             break;
                         case "10":
                             ${$amiqkcrlotrq} = $adb->pquery("SELECT relmodule FROM `vtiger_fieldmodulerel` WHERE fieldid = ?", array($field->id));
                             while (${${"GLOBALS"}["omdiav"]} = $adb->fetch_array(${$kxrugplfiqo})) {
                                 ${"GLOBALS"}["rgsshwz"] = "addReferences";
                                 ${${"GLOBALS"}["rgsshwz"]}[] = array(${${"GLOBALS"}["iswxctbj"]}, ${${"GLOBALS"}["omdiav"]}["relmodule"]);
                             }
                             break;
                     }
                 }
                 ${${"GLOBALS"}["iewpnk"]}[getTranslatedString($block->label, ${${"GLOBALS"}["pdnqbcq"]})][] = ${${"GLOBALS"}["iswxctbj"]};
             }
         }
     }
     ${${"GLOBALS"}["vpjrpbb"]} = array("assigned_user_id" => "smownerid");
     if (${${"GLOBALS"}["uoikifoisc"]} !== false) {
         $rndvtlgy = "addReferences";
         ${${"GLOBALS"}["iswxctbj"]} = new StdClass();
         $field->name = "current_user";
         $field->label = getTranslatedString("LBL_CURRENT_USER", "Workflow2");
         ${$rndvtlgy}[] = array(${${"GLOBALS"}["iswxctbj"]}, "Users");
     }
     if (is_array(${${"GLOBALS"}["dwkjhu"]})) {
         ${"GLOBALS"}["fkzheawwtu"] = "refField";
         foreach (${${"GLOBALS"}["sereklx"]} as ${${"GLOBALS"}["fkzheawwtu"]}) {
             $yomtemg = "refField";
             $ibdrafmbgfb = "fields";
             ${"GLOBALS"}["etscfhrvmxy"] = "fields";
             ${${"GLOBALS"}["etscfhrvmxy"]} = self::getFieldsForModule(${$yomtemg}[1]);
             foreach (${$ibdrafmbgfb} as ${${"GLOBALS"}["iswxctbj"]}) {
                 ${"GLOBALS"}["oxjphormw"] = "refTemplate";
                 ${"GLOBALS"}["krkdwlrntjd"] = "refField";
                 $cbsqpgxe = "app_strings";
                 ${"GLOBALS"}["jqkudkkmpy"] = "refField";
                 ${"GLOBALS"}["mjtljotq"] = "rewriteFields";
                 $itkvhkri = "refField";
                 $field->label = "(" . (isset(${$cbsqpgxe}[${${"GLOBALS"}["lontvhvwcnep"]}[1]]) ? ${${"GLOBALS"}["wmngovs"]}[${${"GLOBALS"}["krkdwlrntjd"]}[1]] : ${$itkvhkri}[1]) . ") " . $field->label;
                 $akssqrew = "name";
                 $ccucleufm = "name";
                 if (!empty(${${"GLOBALS"}["mjtljotq"]}[${${"GLOBALS"}["lontvhvwcnep"]}[0]->name])) {
                     ${"GLOBALS"}["qnjuhnzf"] = "refField";
                     ${${"GLOBALS"}["qnjuhnzf"]}[0]->name = ${${"GLOBALS"}["vpjrpbb"]}[${${"GLOBALS"}["lontvhvwcnep"]}[0]->name];
                 }
                 ${$ccucleufm} = str_replace(array("[source]", "[module]", "[destination]"), array(${${"GLOBALS"}["lontvhvwcnep"]}[0]->name, ${${"GLOBALS"}["jqkudkkmpy"]}[1], $field->name), ${${"GLOBALS"}["oxjphormw"]});
                 $field->name = ${$akssqrew};
                 ${${"GLOBALS"}["iewpnk"]}["References (" . ${${"GLOBALS"}["lontvhvwcnep"]}[0]->label . ")"][] = ${${"GLOBALS"}["iswxctbj"]};
             }
         }
     }
     return ${${"GLOBALS"}["qpvmpezinov"]};
 }