Ejemplo n.º 1
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($module_name, $event_type)
 {
     //require_once('include/utils/utils.php');
     global $adb;
     $module = Vtiger_Module::getInstance($module_name);
     if ($event_type == 'module.postinstall') {
         //************* Set access right for all profiles ***********************//
         //Don't display module name in menu
         $adb->pquery("UPDATE vtiger_profile2tab SET permissions=? WHERE tabid=?", array(1, $module->id));
         //Don't allow action on the module
         $adb->pquery("UPDATE vtiger_profile2standardpermissions SET permissions=? WHERE tabid=?", array(1, $module->id));
         //Add link to the module in the Setting Panel
         $fieldid = $adb->getUniqueID('vtiger_settings_field');
         $blockid = getSettingsBlockId('LBL_MODULE_MANAGER');
         $seq_res = $adb->query("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid =1");
         $seq = 1;
         if ($adb->num_rows($seq_res) > 0) {
             $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
             if ($cur_seq != null) {
                 $seq = $cur_seq + 1;
             }
         }
         $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence,active) VALUES (?,?,?,?,?,?,?,?)', array($fieldid, 3, $module_name, 'layouts/vlayout/modules/Settings/' . $module_name . '/assets/images/' . $module_name . '.png', 'LBL_' . strtoupper($module_name) . '_DESCRIPTION', 'index.php?module=' . $module_name . '&view=Index&parent=Settings', $seq, 0));
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
             } else {
                 if ($event_type == 'module.preuninstall') {
                     $adb->pquery('DELETE FROM vtiger_settings_field WHERE name = ?', array($module_name));
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                             $query = "SELECT * FROM vtiger_settings_field WHERE name = ?";
                             $result = $adb->pquery($query, array($module_name));
                             if ($adb->num_rows($result) == 0) {
                                 $seq_res = $adb->query("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid =1");
                                 $seq = 1;
                                 if ($adb->num_rows($seq_res) > 0) {
                                     $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
                                     if ($cur_seq != null) {
                                         $seq = $cur_seq + 1;
                                     }
                                 }
                                 $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence,active) VALUES (?,?,?,?,?,?,?,?)', array($fieldid, 3, $module_name, 'layouts/vlayout/modules/Settings/' . $module_name . '/assets/images/' . $module_name . '.png', 'LBL_' . strtoupper($module_name) . '_DESCRIPTION', 'index.php?module=' . $module_name . '&view=Index&parent=Settings', $seq, 0));
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
    /**
     * Invoked when special actions are performed on the module.
     * @param String Module name
     * @param String Event Type
     */
    function vtlib_handler($moduleName, $eventType)
    {
        require_once 'include/utils/utils.php';
        global $adb, $mod_strings;
        if ($eventType == 'module.postinstall') {
            $portalModules = array("HelpDesk", "Faq", "Products", "Services", "Documents", "Contacts", "Accounts", "Project", "ProjectTask", "ProjectMilestone", "Assets");
            $query = "SELECT max(sequence) AS max_tabseq FROM vtiger_customerportal_tabs";
            $res = $adb->pquery($query, array());
            $tabseq = $adb->query_result($res, 0, 'max_tabseq');
            $i = ++$tabseq;
            foreach ($portalModules as $module) {
                $tabIdResult = $adb->pquery('SELECT tabid FROM vtiger_tab WHERE name=?', array($module));
                $tabId = $adb->query_result($tabIdResult, 0, 'tabid');
                if ($tabId) {
                    ++$i;
                    $adb->query("INSERT INTO vtiger_customerportal_tabs (tabid,visible,sequence) VALUES ({$tabId},1,{$i})");
                    $adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES ({$tabId},'showrelatedinfo',1)");
                }
            }
            $adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES (0,'userid',1)");
            $adb->query("INSERT INTO vtiger_customerportal_prefs(tabid,prefkey,prefvalue) VALUES (0,'defaultassignee',1)");
            // Mark the module as Standard module
            $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
            $fieldid = $adb->getUniqueID('vtiger_settings_field');
            $blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
            $seq_res = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
            if ($adb->num_rows($seq_res) > 0) {
                $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
                if ($cur_seq != null) {
                    $seq = $cur_seq + 1;
                }
            }
            $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)
				VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, 'LBL_CUSTOMER_PORTAL', 'portal_icon.png', 'PORTAL_EXTENSION_DESCRIPTION', 'index.php?module=CustomerPortal&action=index&parenttab=Settings', $seq));
        } else {
            if ($eventType == 'module.disabled') {
                // TODO Handle actions when this module is disabled.
            } else {
                if ($eventType == 'module.enabled') {
                    // TODO Handle actions when this module is enabled.
                } else {
                    if ($eventType == 'module.preuninstall') {
                        // TODO Handle actions when this module is about to be deleted.
                    } else {
                        if ($eventType == 'module.preupdate') {
                            // TODO Handle actions before this module is updated.
                        } else {
                            if ($eventType == 'module.postupdate') {
                                // TODO Handle actions after this module is updated.
                            }
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
    /**
     * Invoked when special actions are performed on the module.
     * @param String Module name
     * @param String Event Type
     */
    function vtlib_handler($moduleName, $eventType)
    {
        require_once 'include/utils/utils.php';
        global $adb;
        if ($eventType == 'module.postinstall') {
            $fieldid = $adb->getUniqueID('vtiger_settings_field');
            $blockid = getSettingsBlockId('LBL_MODULE_MANAGER');
            $seq_res = $adb->query("SELECT max(sequence) AS max_seq FROM vtiger_settings_field");
            $seq = 1;
            if ($adb->num_rows($seq_res) > 0) {
                $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
                if ($cur_seq != null) {
                    $seq = $cur_seq + 1;
                }
            }
            $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence) 
				VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, 'LBL_FIELDFORMULAS', 'modules/FieldFormulas/resources/FieldFormulas.png', 'LBL_FIELDFORMULAS_DESCRIPTION', 'index.php?module=FieldFormulas&action=index&parenttab=Settings', $seq));
            $tabid = getTabid('FieldFormulas');
            if (isset($tabid) && $tabid != '') {
                $adb->pquery('DELETE FROM vtiger_profile2tab WHERE tabid = ?', array($tabid));
            }
            // Mark the module as Standard module
            $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
        } else {
            if ($eventType == 'module.disabled') {
                $em = new VTEventsManager($adb);
                $em->setHandlerInActive('VTFieldFormulasEventHandler');
            } else {
                if ($eventType == 'module.enabled') {
                    $em = new VTEventsManager($adb);
                    $em->setHandlerActive('VTFieldFormulasEventHandler');
                } else {
                    if ($eventType == 'module.preuninstall') {
                        // TODO Handle actions when this module is about to be deleted.
                    } else {
                        if ($eventType == 'module.preupdate') {
                            // TODO Handle actions before this module is updated.
                        } else {
                            if ($eventType == 'module.postupdate') {
                                // TODO Handle actions after this module is updated.
                            }
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 4
0
    /**
     * Invoked when special actions are performed on the module.
     * @param String Module name
     * @param String Event Type
     */
    function vtlib_handler($moduleName, $eventType)
    {
        global $adb, $currentModule;
        $modtrackerModule = Vtiger_Module::getInstance($currentModule);
        $otherModuleNames = $this->getModTrackerEnabledModules();
        if ($eventType == 'module.postinstall') {
            $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
            $fieldid = $adb->getUniqueID('vtiger_settings_field');
            $blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
            $seq_res = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
            if ($adb->num_rows($seq_res) > 0) {
                $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
                if ($cur_seq != null) {
                    $seq = $cur_seq + 1;
                }
            }
            $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)
				VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, 'ModTracker', 'set-IcoLoginHistory.gif', 'LBL_MODTRACKER_DESCRIPTION', 'index.php?module=ModTracker&action=BasicSettings&parenttab=Settings&formodule=ModTracker', $seq));
        } else {
            if ($eventType == 'module.disabled') {
                $em = new VTEventsManager($adb);
                $em->setHandlerInActive('ModTrackerHandler');
                // De-register Common Javascript
                $modtrackerModule->deleteLink('HEADERSCRIPT', 'ModTrackerCommon_JS');
            } else {
                if ($eventType == 'module.enabled') {
                    $em = new VTEventsManager($adb);
                    $em->setHandlerActive('ModTrackerHandler');
                    // Register Common Javascript
                    $modtrackerModule->addLink('HEADERSCRIPT', 'ModTrackerCommon_JS', 'modules/ModTracker/ModTrackerCommon.js');
                } else {
                    if ($eventType == 'module.preuninstall') {
                        // TODO Handle actions when this module is about to be deleted.
                    } else {
                        if ($eventType == 'module.preupdate') {
                            // TODO Handle actions before this module is updated.
                        } else {
                            if ($eventType == 'module.postupdate') {
                                // TODO Handle actions after this module is updated.
                            }
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 5
0
    /**
     * Invoked when special actions are performed on the module.
     * @param String Module name
     * @param String Event Type
     */
    function vtlib_handler($moduleName, $eventType)
    {
        require_once 'include/utils/utils.php';
        global $adb, $mod_strings;
        if ($eventType == 'module.postinstall') {
            $fieldid = $adb->getUniqueID('vtiger_settings_field');
            $blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
            $seq_res = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
            if ($adb->num_rows($seq_res) > 0) {
                $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
                if ($cur_seq != null) {
                    $seq = $cur_seq + 1;
                }
            }
            $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence) 
				VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, 'Scheduler', 'Cron.png', 'Allows you to Configure Cron Task', 'index.php?module=CronTasks&action=ListCronJobs&parenttab=Settings', $seq));
        }
    }
Ejemplo n.º 6
0
    function updateSettings()
    {
        global $adb;
        $fieldid = $adb->getUniqueID('vtiger_settings_field');
        $blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
        $seq_res = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
        if ($adb->num_rows($seq_res) > 0) {
            $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
            if ($cur_seq != null) {
                $seq = $cur_seq + 1;
            }
        }
        $result = $adb->pquery('SELECT 1 FROM vtiger_settings_field WHERE name=?', array($this->LBL_WEBFORMS));
        if (!$adb->num_rows($result)) {
            $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)
					VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, $this->LBL_WEBFORMS, 'modules/Webforms/img/Webform.png', 'Allows you to manage Webforms', 'index.php?module=Webforms&action=index&parenttab=Settings', $seq));
        }
    }
Ejemplo n.º 7
0
 public function checkSettingsField()
 {
     global $adb;
     $sql = "SELECT * FROM vtiger_settings_field WHERE linkto = 'index.php?module=SwVtTools&view=Index&parent=Settings'";
     $result = $adb->query($sql);
     if ($adb->num_rows($result) == 0) {
         $fieldid = $adb->getUniqueID('vtiger_settings_field');
         $blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
         $seq_res = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
         if ($adb->num_rows($seq_res) > 0) {
             $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
             if ($cur_seq != null) {
                 $cur_seq = $cur_seq + 1;
             }
         }
         $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)
               VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, 'Vtiger Tools', '', 'Enhance your CRM', 'index.php?module=SwVtTools&view=Index&parent=Settings', $cur_seq));
     }
 }
Ejemplo n.º 8
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type
  */
 function vtlib_handler($moduleName, $eventType)
 {
     require_once 'include/utils/utils.php';
     require_once 'vtlib/Vtiger/Module.php';
     global $adb, $mod_strings;
     if ($eventType == 'module.postinstall') {
         // Mark the module as Standard module
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
         $name = 'LBL_TOOLTIP_MANAGEMENT';
         $blockname = 'LBL_MODULE_MANAGER';
         $icon = 'quickview.png';
         $description = 'LBL_TOOLTIP_MANAGEMENT_DESCRIPTION';
         $links = 'index.php?module=Tooltip&action=QuickView&parenttab=Settings';
         $adb->query("INSERT INTO vtiger_settings_field (fieldid, blockid, name, iconpath, description, linkto) \n\t\t\t\t\t\t\tVALUES (" . $adb->getUniqueID('vtiger_settings_field') . ", " . getSettingsBlockId($blockname) . ", '{$name}', '{$icon}', '{$description}', '{$links}')");
     } else {
         if ($eventType == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
             $moduleInstance = Vtiger_Module::getInstance('Tooltip');
             $moduleInstance->deleteLink('HEADERSCRIPT', 'ToolTip_HeaderScript', 'modules/Tooltip/TooltipHeaderScript.js');
         } else {
             if ($eventType == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
                 $moduleInstance = Vtiger_Module::getInstance('Tooltip');
                 $moduleInstance->addLink('HEADERSCRIPT', 'ToolTip_HeaderScript', 'modules/Tooltip/TooltipHeaderScript.js');
             } else {
                 if ($eventType == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($eventType == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($eventType == 'module.postupdate') {
                             // TODO Handle actions after this module is updated.
                         }
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 9
0
 function updateSettings()
 {
     $image = 'modules/ListViewColors/images/colored_listview.gif';
     $description = 'Edit your filter...';
     $linkto = 'index.php?module=ITS4YouAllFilter&parent=Settings&view=List';
     $result1 = $this->db->pquery('SELECT 1 FROM vtiger_settings_field WHERE name=?', array($this->LBL_MODULE_NAME_OLD));
     if ($this->db->num_rows($result1)) {
         $this->db->pquery('UPDATE vtiger_settings_field SET name=?, iconpath=?, description=?, linkto=? WHERE name=?', array($this->LBL_MODULE_NAME, $image, $description, $linkto, $this->LBL_MODULE_NAME_OLD));
     }
     $result2 = $this->db->pquery('SELECT 1 FROM vtiger_settings_field WHERE name=?', array($this->LBL_MODULE_NAME));
     if (!$this->db->num_rows($result2)) {
         $fieldid = $this->db->getUniqueID('vtiger_settings_field');
         $blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
         $seq_res = $this->db->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
         if ($this->db->num_rows($seq_res) > 0) {
             $cur_seq = $this->db->query_result($seq_res, 0, 'max_seq');
             if ($cur_seq != null) {
                 $seq = $cur_seq + 1;
             }
         }
         $this->db->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence) VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, $this->LBL_MODULE_NAME, $image, $description, $linkto, $seq));
     }
 }
Ejemplo n.º 10
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
  */
 function vtlib_handler($modulename, $event_type)
 {
     $db = PearDatabase::getInstance();
     if ($event_type == 'module.postinstall') {
         //nadanie numeracji w module
         $modfocus = CRMEntity::getInstance($modulename);
         $modfocus->setModuleSeqNumber('configure', $modulename, $req_str = '', $req_no = '1');
         $sql = "INSERT INTO vtiger_osspdf_config (`conf_id`,`name`,`value`) VALUES ('GENERALCONFIGURATION','ifsave','no'),('GENERALCONFIGURATION','ifattach','no')";
         $wykonaj = $db->query($sql, true);
         include_once 'vtlib/Vtiger/Module.php';
         $names = array('Emails', 'PBXManager', 'ModComments', 'SMSNotifier', 'OSSPdf');
         foreach ($names as $id) {
             $in .= "'" . $id . "',";
         }
         $in = trim($in, ',');
         $wynik = $db->query("select tabid,name from vtiger_tab where isentitytype='1' and presence<> '2' and name not in ( {$in} )", true);
         for ($i = 0; $i < $db->num_rows($wynik); $i++) {
             $name = $db->query_result($wynik, $i, "name");
             $sql = "INSERT INTO vtiger_osspdf_config (`conf_id`,`name`,`value`) VALUES ('GENERALCONFIGURATION','{$name}','default')";
             $wyn = $db->query($sql, true);
             if ($name != 'OSSPdf') {
                 $modCommentsModule = Vtiger_Module::getInstance($name);
                 $mod = '$MODULE$';
                 $cat = '$CATEGORY$';
                 $record = '$RECORD$';
                 $tekst = "PDFselectedRecords('{$mod}','{$cat}');";
                 $tekst = "javascript:QuickGenerate('{$mod}','{$cat}','{$record}');";
                 $modCommentsModule->addLink('DETAILVIEWBASIC', 'Generate default PDF', $tekst, 'Smarty/templates/modules/OSSPdf/gen_domysle_dok.png');
                 $tekst = "javascript:QuickGenerateMail('{$mod}','{$cat}','{$record}');";
                 $modCommentsModule->addLink('DETAILVIEWSIDEBARWIDGET', 'Pdf', 'module=OSSPdf&view=ExportPDFRecords&fromdetailview=true');
                 $modCommentsModule->addLink('LISTVIEWSIDEBARWIDGET', 'Pdf', 'module=OSSPdf&view=ListViewExportPDFRecords&usingmodule=' . $name);
             }
         }
         $fieldid = $db->getUniqueID('vtiger_settings_field');
         $blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
         $seq_res = $db->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid), true);
         if ($db->num_rows($seq_res) > 0) {
             $cur_seq = $db->query_result($seq_res, 0, 'max_seq');
             if ($cur_seq != null) {
                 $seq = $cur_seq + 1;
             }
         }
         $db->pquery("INSERT INTO vtiger_settings_field ( fieldid, blockid, name, iconpath, description, linkto, sequence )  VALUES ( ?,?,?,?,?,?,? )", array($fieldid, $blockid, 'PDF', 'Smarty/templates/modules/OSSValidation/currency_update_mini.png', "LBL_OSSPDF_INFO", "index.php?module=OSSPdf&view=Index&parent=Settings", $seq), true);
         $mods = Vtiger_Module::getInstance("OSSPdf");
         $mods->addLink('HEADERSCRIPT', 'PDFUtils', "layouts/vlayout/modules/{$modulename}/resources/PDFUtils.js");
         // block export of module
         $sql = "UPDATE vtiger_tab SET customized=0 WHERE name='{$modulename}' LIMIT 1;";
         $db->query($sql, true);
         // TODO Handle post installation actions
     } else {
         if ($event_type == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
             $mods = Vtiger_Module::getInstance("OSSPdf");
             $mods->deleteLink('HEADERSCRIPT', 'PDFUtils', "layouts/vlayout/modules/{$modulename}/resources/PDFUtils.js");
         } else {
             if ($event_type == 'module.enabled') {
                 // TODO Handle actions when this module is enabled.
                 $mods = Vtiger_Module::getInstance("OSSPdf");
                 $mods->addLink('HEADERSCRIPT', 'PDFUtils', "layouts/vlayout/modules/{$modulename}/resources/PDFUtils.js");
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                             // TODO Handle actions after this module is updated.
                             $db->query("UPDATE vtiger_field SET sequence = '16' WHERE columnname = 'osspdf_enable_numbering'");
                             $res = $db->query("SHOW FULL FIELDS FROM vtiger_osspdf_constraints WHERE FIELD = 'relid'");
                             if ($db->num_rows($res) == 0) {
                                 $db->query("DROP TABLE vtiger_osspdf_constraints");
                                 $db->query("DROP TABLE vtiger_osspdf_constraints_records");
                                 $db->query("CREATE TABLE `vtiger_osspdf_constraints` (\n\t\t\t\t\t\t\t  `id` int(19) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t  `relid` int(19) NOT NULL,\n\t\t\t\t\t\t\t  `fieldname` varchar(255) NOT NULL,\n\t\t\t\t\t\t\t  `comparator` varchar(255) NOT NULL,\n\t\t\t\t\t\t\t  `val` varchar(255) NOT NULL,\n\t\t\t\t\t\t\t  `required` tinyint(19) NOT NULL,\n\t\t\t\t\t\t\t  `field_type` varchar(100) NOT NULL,\n\t\t\t\t\t\t\t  PRIMARY KEY (`id`)\n\t\t\t\t\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8");
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 /**
  * this function adds the entries for settings page
  * it assumes entries as were present on 10-12-208
  */
 function addEntriesForSettings()
 {
     global $adb;
     //icons for all fields
     $icons = array("ico-users.gif", "ico-roles.gif", "ico-profile.gif", "ico-groups.gif", "shareaccess.gif", "orgshar.gif", "audit.gif", "set-IcoLoginHistory.gif", "vtlib_modmng.gif", "picklist.gif", "ViewTemplate.gif", "mailmarge.gif", "notification.gif", "inventory.gif", "company.gif", "ogmailserver.gif", "backupserver.gif", "assign.gif", "currency.gif", "taxConfiguration.gif", "system.gif", "proxy.gif", "announ.gif", "set-IcoTwoTabConfig.gif", "terms.gif", "settingsInvNumber.gif", "mailScanner.gif", "settingsWorkflow.png");
     //labels for blocks
     $blocks = array('LBL_MODULE_MANAGER', 'LBL_USER_MANAGEMENT', 'LBL_STUDIO', 'LBL_COMMUNICATION_TEMPLATES', 'LBL_OTHER_SETTINGS');
     //field names
     $names = array('LBL_USERS', 'LBL_ROLES', 'LBL_PROFILES', 'USERGROUPLIST', 'LBL_SHARING_ACCESS', 'LBL_FIELDS_ACCESS', 'LBL_AUDIT_TRAIL', 'LBL_LOGIN_HISTORY_DETAILS', 'VTLIB_LBL_MODULE_MANAGER', 'LBL_PICKLIST_EDITOR', 'EMAILTEMPLATES', 'LBL_MAIL_MERGE', 'NOTIFICATIONSCHEDULERS', 'INVENTORYNOTIFICATION', 'LBL_COMPANY_DETAILS', 'LBL_MAIL_SERVER_SETTINGS', 'LBL_BACKUP_SERVER_SETTINGS', 'LBL_ASSIGN_MODULE_OWNERS', 'LBL_CURRENCY_SETTINGS', 'LBL_TAX_SETTINGS', 'LBL_SYSTEM_INFO', 'LBL_PROXY_SETTINGS', 'LBL_ANNOUNCEMENT', 'LBL_DEFAULT_MODULE_VIEW', 'INVENTORYTERMSANDCONDITIONS', 'LBL_CUSTOMIZE_MODENT_NUMBER', 'LBL_MAIL_SCANNER', 'LBL_LIST_WORKFLOWS');
     $name_blocks = array('LBL_USERS' => 'LBL_USER_MANAGEMENT', 'LBL_ROLES' => 'LBL_USER_MANAGEMENT', 'LBL_PROFILES' => 'LBL_USER_MANAGEMENT', 'USERGROUPLIST' => 'LBL_USER_MANAGEMENT', 'LBL_SHARING_ACCESS' => 'LBL_USER_MANAGEMENT', 'LBL_FIELDS_ACCESS' => 'LBL_USER_MANAGEMENT', 'LBL_AUDIT_TRAIL' => 'LBL_USER_MANAGEMENT', 'LBL_LOGIN_HISTORY_DETAILS' => 'LBL_USER_MANAGEMENT', 'VTLIB_LBL_MODULE_MANAGER' => 'LBL_STUDIO', 'LBL_PICKLIST_EDITOR' => 'LBL_STUDIO', 'EMAILTEMPLATES' => 'LBL_COMMUNICATION_TEMPLATES', 'LBL_MAIL_MERGE' => 'LBL_COMMUNICATION_TEMPLATES', 'NOTIFICATIONSCHEDULERS' => 'LBL_COMMUNICATION_TEMPLATES', 'INVENTORYNOTIFICATION' => 'LBL_COMMUNICATION_TEMPLATES', 'LBL_COMPANY_DETAILS' => 'LBL_COMMUNICATION_TEMPLATES', 'LBL_MAIL_SERVER_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_BACKUP_SERVER_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_ASSIGN_MODULE_OWNERS' => 'LBL_OTHER_SETTINGS', 'LBL_CURRENCY_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_TAX_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_SYSTEM_INFO' => 'LBL_OTHER_SETTINGS', 'LBL_PROXY_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_ANNOUNCEMENT' => 'LBL_OTHER_SETTINGS', 'LBL_DEFAULT_MODULE_VIEW' => 'LBL_OTHER_SETTINGS', 'INVENTORYTERMSANDCONDITIONS' => 'LBL_OTHER_SETTINGS', 'LBL_CUSTOMIZE_MODENT_NUMBER' => 'LBL_OTHER_SETTINGS', 'LBL_MAIL_SCANNER' => 'LBL_OTHER_SETTINGS', 'LBL_LIST_WORKFLOWS' => 'LBL_OTHER_SETTINGS');
     //description for fields
     $description = array('LBL_USER_DESCRIPTION', 'LBL_ROLE_DESCRIPTION', 'LBL_PROFILE_DESCRIPTION', 'LBL_GROUP_DESCRIPTION', 'LBL_SHARING_ACCESS_DESCRIPTION', 'LBL_SHARING_FIELDS_DESCRIPTION', 'LBL_AUDIT_DESCRIPTION', 'LBL_LOGIN_HISTORY_DESCRIPTION', 'VTLIB_LBL_MODULE_MANAGER_DESCRIPTION', 'LBL_PICKLIST_DESCRIPTION', 'LBL_EMAIL_TEMPLATE_DESCRIPTION', 'LBL_MAIL_MERGE_DESCRIPTION', 'LBL_NOTIF_SCHED_DESCRIPTION', 'LBL_INV_NOTIF_DESCRIPTION', 'LBL_COMPANY_DESCRIPTION', 'LBL_MAIL_SERVER_DESCRIPTION', 'LBL_BACKUP_SERVER_DESCRIPTION', 'LBL_MODULE_OWNERS_DESCRIPTION', 'LBL_CURRENCY_DESCRIPTION', 'LBL_TAX_DESCRIPTION', 'LBL_SYSTEM_DESCRIPTION', 'LBL_PROXY_DESCRIPTION', 'LBL_ANNOUNCEMENT_DESCRIPTION', 'LBL_DEFAULT_MODULE_VIEW_DESC', 'LBL_INV_TANDC_DESCRIPTION', 'LBL_CUSTOMIZE_MODENT_NUMBER_DESCRIPTION', 'LBL_MAIL_SCANNER_DESCRIPTION', 'LBL_LIST_WORKFLOWS_DESCRIPTION');
     $links = array('index.php?module=Administration&action=index&parenttab=Settings', 'index.php?module=Settings&action=listroles&parenttab=Settings', 'index.php?module=Settings&action=ListProfiles&parenttab=Settings', 'index.php?module=Settings&action=listgroups&parenttab=Settings', 'index.php?module=Settings&action=OrgSharingDetailView&parenttab=Settings', 'index.php?module=Settings&action=DefaultFieldPermissions&parenttab=Settings', 'index.php?module=Settings&action=AuditTrailList&parenttab=Settings', 'index.php?module=Settings&action=ListLoginHistory&parenttab=Settings', 'index.php?module=Settings&action=ModuleManager&parenttab=Settings', 'index.php?module=PickList&action=PickList&parenttab=Settings', 'index.php?module=Settings&action=listemailtemplates&parenttab=Settings', 'index.php?module=Settings&action=listwordtemplates&parenttab=Settings', 'index.php?module=Settings&action=listnotificationschedulers&parenttab=Settings', 'index.php?module=Settings&action=listinventorynotifications&parenttab=Settings', 'index.php?module=Settings&action=OrganizationConfig&parenttab=Settings', 'index.php?module=Settings&action=EmailConfig&parenttab=Settings', 'index.php?module=Settings&action=BackupServerConfig&parenttab=Settings', 'index.php?module=Settings&action=ListModuleOwners&parenttab=Settings', 'index.php?module=Settings&action=CurrencyListView&parenttab=Settings', 'index.php?module=Settings&action=TaxConfig&parenttab=Settings', 'index.php?module=System&action=listsysconfig&parenttab=Settings', 'index.php?module=Settings&action=ProxyServerConfig&parenttab=Settings', 'index.php?module=Settings&action=Announcements&parenttab=Settings', 'index.php?module=Settings&action=DefModuleView&parenttab=Settings', 'index.php?module=Settings&action=OrganizationTermsandConditions&parenttab=Settings', 'index.php?module=Settings&action=CustomModEntityNo&parenttab=Settings', 'index.php?module=Settings&action=MailScanner&parenttab=Settings', 'index.php?module=com_vtiger_workflow&action=workflowlist&parenttab=Settings');
     //insert settings blocks
     $count = count($blocks);
     for ($i = 0; $i < $count; $i++) {
         $adb->query("insert into vtiger_settings_blocks values (" . $adb->getUniqueID('vtiger_settings_blocks') . ", '{$blocks[$i]}', {$i}+1)");
     }
     $count = count($icons);
     //insert settings fields
     for ($i = 0, $seq = 1; $i < $count; $i++, $seq++) {
         if ($i == 8 || $i == 12 || $i == 18) {
             $seq = 1;
         }
         $adb->query("insert into vtiger_settings_field (fieldid, blockid, name, iconpath, description, linkto, sequence) values (" . $adb->getUniqueID('vtiger_settings_field') . ", " . getSettingsBlockId($name_blocks[$names[$i]]) . ", '{$names[$i]}', '{$icons[$i]}', '{$description[$i]}', '{$links[$i]}', {$seq})");
     }
     // for Workflow in settings page of every module
     $module_manager_id = getSettingsBlockId('LBL_MODULE_MANAGER');
     $result = $adb->pquery("SELECT max(sequence) AS maxseq FROM vtiger_settings_field WHERE blockid = ?", array($module_manager_id));
     $maxseq = $adb->query_result($result, 0, 'maxseq');
     if ($maxseq < 0 || $maxseq == NULL) {
         $maxseq = 1;
     }
     $adb->pquery("INSERT INTO vtiger_settings_field (fieldid, blockid, name, iconpath, description, linkto, sequence) VALUES (?,?,?,?,?,?,?)", array($adb->getUniqueID('vtiger_settings_field'), $module_manager_id, 'LBL_WORKFLOW_LIST', 'settingsWorkflow.png', 'LBL_AVAILABLE_WORKLIST_LIST', 'index.php?module=com_vtiger_workflow&action=workflowlist', $maxseq));
     //hide the system details tab for now
     $adb->query("update vtiger_settings_field set active=1 where name='LBL_SYSTEM_INFO'");
 }
Ejemplo n.º 12
0
 public function checkSettingsField()
 {
     ${"GLOBALS"}["gievctbisul"] = "sql";
     global $adb;
     ${${"GLOBALS"}["gievctbisul"]} = "DELETE FROM vtiger_settings_field WHERE linkto = \"index.php?module=Workflow2&action=admin&parenttab=Settings\"";
     $adb->query(${${"GLOBALS"}["wpvlkaycsb"]});
     ${${"GLOBALS"}["wpvlkaycsb"]} = "SELECT * FROM vtiger_settings_field WHERE linkto = 'index.php?module=Workflow2&view=Index&parent=Settings'";
     ${"GLOBALS"}["cbiayvpw"] = "sql";
     ${${"GLOBALS"}["bcibcujqqmt"]} = $adb->query(${${"GLOBALS"}["cbiayvpw"]});
     if ($adb->num_rows(${${"GLOBALS"}["bcibcujqqmt"]}) == 0) {
         $btgrjv = "blockid";
         ${"GLOBALS"}["nnotsyhy"] = "blockid";
         ${${"GLOBALS"}["jlbeukitbbt"]} = $adb->getUniqueID("vtiger_settings_field");
         ${${"GLOBALS"}["stmfnngagn"]} = getSettingsBlockId("LBL_OTHER_SETTINGS");
         ${"GLOBALS"}["ufqcolrptz"] = "fieldid";
         $zglcajxlru = "seq_res";
         ${${"GLOBALS"}["rkvgkge"]} = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array(${${"GLOBALS"}["nnotsyhy"]}));
         if ($adb->num_rows(${$zglcajxlru}) > 0) {
             ${"GLOBALS"}["soeitd"] = "seq_res";
             $ufltelyb = "cur_seq";
             $rlxbnlux = "cur_seq";
             $bzvtcasyp = "cur_seq";
             ${$ufltelyb} = $adb->query_result(${${"GLOBALS"}["soeitd"]}, 0, "max_seq");
             if (${$bzvtcasyp} != null) {
                 ${$rlxbnlux} = ${${"GLOBALS"}["bohnerpymlw"]} + 1;
             }
         }
         $adb->pquery("INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)\n                    VALUES (?,?,?,?,?,?,?)", array(${${"GLOBALS"}["ufqcolrptz"]}, ${$btgrjv}, "Workflow Designer", "Smarty/templates/modules/Workflow2/settings.png", "Design your Workflows", "index.php?module=Workflow2&view=Index&parent=Settings", ${${"GLOBALS"}["bohnerpymlw"]}));
     }
 }
Ejemplo n.º 13
0
 public function addSettingsField()
 {
     $ropvgdj = "result";
     ${"GLOBALS"}["qkwreata"] = "fieldRows";
     ${"GLOBALS"}["wsmmcoikr"] = "result";
     $jjgngbfd = "adb";
     ${"GLOBALS"}["zfqgzb"] = "fieldRows";
     ${$jjgngbfd} = PearDatabase::getInstance();
     ${${"GLOBALS"}["ytonekkqj"]} = "SELECT * FROM vtiger_settings_field WHERE name = 'Colorizer'";
     ${${"GLOBALS"}["wsmmcoikr"]} = $adb->pquery(${${"GLOBALS"}["ytonekkqj"]});
     ${${"GLOBALS"}["zfqgzb"]} = $adb->num_rows(${$ropvgdj});
     if (${${"GLOBALS"}["fmufepx"]} > 1) {
         $ntyymwmpcf = "sql";
         $ueiotqwu = "sql";
         $uobrpqoqw = "fieldRows";
         ${$ntyymwmpcf} = "DELETE FROM vtiger_settings_field WHERE name = 'Colorizer'";
         $adb->pquery(${$ueiotqwu});
         ${$uobrpqoqw} = 0;
     }
     if (${${"GLOBALS"}["qkwreata"]} == 0) {
         ${"GLOBALS"}["vwdevuuu"] = "maxfieldidRST";
         ${"GLOBALS"}["srtehntof"] = "fieldid";
         ${"GLOBALS"}["vpersdd"] = "maxfieldidRST";
         ${"GLOBALS"}["ydegusyv"] = "seq_res";
         ${${"GLOBALS"}["srtehntof"]} = $adb->getUniqueID("vtiger_settings_field");
         ${"GLOBALS"}["gsamwsglse"] = "blockid";
         ${${"GLOBALS"}["vwdevuuu"]} = $adb->pquery("SELECT max(fieldid) AS fieldid FROM vtiger_settings_field");
         ${"GLOBALS"}["cdbnnrscoc"] = "maxFieldId";
         $sonjqf = "blockid";
         ${"GLOBALS"}["xlewwb"] = "fieldid";
         ${"GLOBALS"}["lxtdlbyiftt"] = "blockid";
         ${${"GLOBALS"}["ofdmgvgy"]} = $adb->query_result(${${"GLOBALS"}["vpersdd"]}, 0, "fieldid");
         if (${${"GLOBALS"}["xlewwb"]} < ${${"GLOBALS"}["cdbnnrscoc"]}) {
             ${"GLOBALS"}["emldgllbaoe"] = "fieldid";
             ${"GLOBALS"}["akhcywjrbbrc"] = "sql";
             ${${"GLOBALS"}["emldgllbaoe"]} = ${${"GLOBALS"}["ofdmgvgy"]} + 1;
             ${${"GLOBALS"}["akhcywjrbbrc"]} = "UPDATE vtiger_settings_field_seq SET id = " . ${${"GLOBALS"}["bqeusk"]};
             $adb->pquery(${${"GLOBALS"}["ytonekkqj"]});
         }
         ${$sonjqf} = getSettingsBlockId("LBL_OTHER_SETTINGS");
         ${${"GLOBALS"}["ydegusyv"]} = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array(${${"GLOBALS"}["lxtdlbyiftt"]}));
         if ($adb->num_rows(${${"GLOBALS"}["aktpogfnlslz"]}) > 0) {
             $hujyujt = "seq";
             ${"GLOBALS"}["nqsbwkewfny"] = "seq_res";
             ${"GLOBALS"}["fxnmpcoopwk"] = "cur_seq";
             ${${"GLOBALS"}["dkxraf"]} = $adb->query_result(${${"GLOBALS"}["nqsbwkewfny"]}, 0, "max_seq");
             if (${${"GLOBALS"}["fxnmpcoopwk"]} != null) {
                 ${$hujyujt} = ${${"GLOBALS"}["dkxraf"]} + 1;
             }
         }
         $adb->pquery("INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)\n                VALUES (?,?,?,?,?,?,?)", array(${${"GLOBALS"}["bqeusk"]}, ${${"GLOBALS"}["gsamwsglse"]}, "Colorizer", "Smarty/templates/modules/Colorizer/settings.png", "The module to colorize single fields", "index.php?module=Colorizer&view=Index&parent=Settings", ${${"GLOBALS"}["umennrtj"]}), true);
     }
 }
Ejemplo n.º 14
0
/**
 * this function returns the fields for the settings page
 */
function getSettingsFields()
{
    global $adb;
    $sql = "select * from vtiger_settings_field where blockid!=? and active=0 order by blockid,sequence";
    $result = $adb->pquery($sql, array(getSettingsBlockId('LBL_MODULE_MANAGER')));
    $count = $adb->num_rows($result);
    $fields = array();
    if ($count > 0) {
        for ($i = 0; $i < $count; $i++) {
            $blockid = $adb->query_result($result, $i, "blockid");
            $iconpath = $adb->query_result($result, $i, "iconpath");
            $description = $adb->query_result($result, $i, "description");
            $linkto = $adb->query_result($result, $i, "linkto");
            $action = getPropertiesFromURL($linkto, "action");
            $module = getPropertiesFromURL($linkto, "module");
            $name = $adb->query_result($result, $i, "name");
            $fields[$blockid][] = array("icon" => $iconpath, "description" => $description, "link" => $linkto, "name" => $name, "action" => $action, "module" => $module);
        }
        //add blanks for 4-column layout
        foreach ($fields as $blockid => &$field) {
            if (count($field) > 0 && count($field) < 4) {
                for ($i = count($field); $i < 4; $i++) {
                    $field[$i] = array();
                }
            }
        }
    }
    return $fields;
}
Ejemplo n.º 15
0
ExecuteQuery("update vtiger_tab set parent = 'Support' where name = 'Assets'");
ExecuteQuery("update vtiger_tab set tabsequence = -1 where name = 'Assets'");
ExecuteQuery("update vtiger_tab set parent = 'Tools' where name = 'ModComments'");
ExecuteQuery("update vtiger_tab set tabsequence = -1 where name = 'ModComments'");
ExecuteQuery("update vtiger_tab set parent = 'Support' where name = 'ProjectMilestone'");
ExecuteQuery("update vtiger_tab set tabsequence = -1 where name = 'ProjectMilestone'");
ExecuteQuery("update vtiger_tab set parent = 'Support' where name = 'ProjectTask'");
ExecuteQuery("update vtiger_tab set tabsequence = -1 where name = 'ProjectTask'");
ExecuteQuery("update vtiger_tab set parent = 'Support' where name = 'Project'");
ExecuteQuery("update vtiger_tab set tabsequence = -1 where name = 'Project'");
ExecuteQuery("update vtiger_tab set parent = 'Tools' where name = 'SMSNotifier'");
ExecuteQuery("update vtiger_tab set tabsequence = -1 where name = 'SMSNotifier'");
ExecuteQuery("update vtiger_tab set parent = 'Tools' where name = 'MailManager'");
ExecuteQuery("update vtiger_tab set tabsequence = -1 where name = 'MailManager'");
$fieldId = $adb->getUniqueId("vtiger_settings_field");
ExecuteQuery("insert into vtiger_settings_field (fieldid,blockid,name,iconpath,description,linkto,sequence,active)\r\n\t\t\t\t\tvalues ({$fieldId}," . getSettingsBlockId('LBL_STUDIO') . ",'LBL_MENU_EDITOR','menueditor.png','LBL_MENU_DESC',\r\n\t\t\t\t\t'index.php?module=Settings&action=MenuEditor&parenttab=Settings',4,0)");
$present_module = array();
$result = $adb->query('select tabid,name,tablabel,tabsequence,parent from vtiger_tab where parent is not null and parent!=" "');
for ($i = 0; $i < $adb->num_rows($result); $i++) {
    $modulename = $adb->query_result($result, $i, 'name');
    $modulelabel = $adb->query_result($result, $i, 'tablabel');
    array_push($present_module, $modulelabel);
}
$result = $adb->query("select name,tablabel,parenttab_label,vtiger_tab.tabid\r\n\t\t\t\t\t\t\tfrom vtiger_parenttabrel\r\n\t\t\t\t\t\t\tinner join vtiger_tab on vtiger_parenttabrel.tabid = vtiger_tab.tabid\r\n\t\t\t\t\t\t\tinner join vtiger_parenttab on vtiger_parenttabrel.parenttabid = vtiger_parenttab.parenttabid\r\n\t\t\t\t\t\t\t\t\tand vtiger_parenttab.parenttab_label is not null\r\n\t\t\t\t\t\t\t\t\tand vtiger_parenttab.parenttab_label != ' '");
$skipModules = array("Webmails", "Home");
for ($i = 0; $i < $adb->num_rows($result); $i++) {
    $modulename = $adb->query_result($result, $i, 'name');
    $modulelabel = $adb->query_result($result, $i, 'tablabel');
    $parent = $adb->query_result($result, $i, 'parenttab_label');
    if (!in_array($modulelabel, $present_module) && !in_array($modulelabel, $skipModules)) {
        if ($modulelabel == "MailManager") {
Migration_Index_View::ExecuteQuery('ALTER TABLE vtiger_sqltimelog MODIFY started DECIMAL(20,6)', array());
Migration_Index_View::ExecuteQuery('ALTER TABLE vtiger_sqltimelog MODIFY ended DECIMAL(20,6)', array());
//added Assests tab in contact
$assetsModuleInstance = Vtiger_Module::getInstance('Assets');
$contactModule = Vtiger_Module::getInstance('Contacts');
$contactModule->setRelatedList($assetsModuleInstance, '', false, 'get_dependents_list');
// End 2013.04.23
// Start 2013.04.30
Migration_Index_View::ExecuteQuery('ALTER TABLE vtiger_users MODIFY signature TEXT', array());
//Adding column to store the state of short cut settings fields
Migration_Index_View::ExecuteQuery('ALTER TABLE vtiger_settings_field ADD COLUMN pinned int(1) DEFAULT 0', array());
$defaultPinnedFields = array('LBL_USERS', 'LBL_LIST_WORKFLOWS', 'VTLIB_LBL_MODULE_MANAGER', 'LBL_PICKLIST_EDITOR');
$defaultPinnedSettingFieldQuery = 'UPDATE vtiger_settings_field SET pinned=1 WHERE name IN (' . generateQuestionMarks($defaultPinnedFields) . ')';
Migration_Index_View::ExecuteQuery($defaultPinnedSettingFieldQuery, $defaultPinnedFields);
Migration_Index_View::ExecuteQuery('ALTER TABLE vtiger_profile ADD COLUMN directly_related_to_role int(1) DEFAULT 0', array());
$blockId = getSettingsBlockId('LBL_STUDIO');
$result = $adb->pquery('SELECT max(sequence) as maxSequence FROM vtiger_settings_field WHERE blockid=?', array($blockId));
$sequence = 0;
if ($adb->num_rows($result) > 0) {
    $sequence = $adb->query_result($result, 0, 'maxSequence');
}
$fieldId = $adb->getUniqueID('vtiger_settings_field');
$query = "INSERT INTO vtiger_settings_field (fieldid, blockid, name, iconpath, description, " . "linkto, sequence) VALUES (?,?,?,?,?,?,?)";
$layoutEditoLink = 'index.php?module=LayoutEditor&parent=Settings&view=Index';
$params = array($fieldId, $blockId, 'LBL_EDIT_FIELDS', '', 'LBL_LAYOUT_EDITOR_DESCRIPTION', $layoutEditoLink, $sequence);
Migration_Index_View::ExecuteQuery($query, $params);
Migration_Index_View::ExecuteQuery('UPDATE vtiger_role SET rolename = ? WHERE rolename = ? AND depth = ?', array('Organization', 'Organisation', 0));
//Create a new table to support custom fields in Documents module
$adb->query("CREATE TABLE IF NOT EXISTS vtiger_notescf (notesid INT(19), FOREIGN KEY fk_1_vtiger_notescf(notesid) REFERENCES vtiger_notes(notesid) ON DELETE CASCADE);");
if (!defined('INSTALLATION_MODE')) {
    Migration_Index_View::ExecuteQuery('ALTER TABLE vtiger_salutationtype ADD COLUMN sortorderid INT(1)', array());
 /**
  * this function adds the entries for settings page
  * it assumes entries as were present on 10-12-208
  */
 function addEntriesForSettings()
 {
     global $adb;
     //icons for all fields
     $icons = array("ico-users.gif", "ico-roles.gif", "ico-profile.gif", "ico-groups.gif", "shareaccess.gif", "orgshar.gif", "set-IcoLoginHistory.gif", "vtlib_modmng.gif", "picklist.gif", "picklistdependency.gif", "menueditor.png", "notification.gif", "inventory.gif", "company.gif", "ogmailserver.gif", "currency.gif", "taxConfiguration.gif", "system.gif", "announ.gif", "set-IcoTwoTabConfig.gif", "terms.gif", "settingsInvNumber.gif", "mailScanner.gif", "settingsWorkflow.png", "migrate.gif", "Cron.png");
     //labels for blocks
     $blocks = array('LBL_USER_MANAGEMENT', 'LBL_STUDIO', 'LBL_COMMUNICATION_TEMPLATES', 'LBL_OTHER_SETTINGS');
     //field names
     $names = array('LBL_USERS', 'LBL_ROLES', 'LBL_PROFILES', 'USERGROUPLIST', 'LBL_SHARING_ACCESS', 'LBL_FIELDS_ACCESS', 'LBL_LOGIN_HISTORY_DETAILS', 'VTLIB_LBL_MODULE_MANAGER', 'LBL_PICKLIST_EDITOR', 'LBL_PICKLIST_DEPENDENCY_SETUP', 'LBL_MENU_EDITOR', 'NOTIFICATIONSCHEDULERS', 'INVENTORYNOTIFICATION', 'LBL_COMPANY_DETAILS', 'LBL_MAIL_SERVER_SETTINGS', 'LBL_CURRENCY_SETTINGS', 'LBL_TAX_SETTINGS', 'LBL_SYSTEM_INFO', 'LBL_ANNOUNCEMENT', 'LBL_DEFAULT_MODULE_VIEW', 'INVENTORYTERMSANDCONDITIONS', 'LBL_CUSTOMIZE_MODENT_NUMBER', 'LBL_MAIL_SCANNER', 'LBL_LIST_WORKFLOWS', 'LBL_CONFIG_EDITOR', 'Scheduler');
     $name_blocks = array('LBL_USERS' => 'LBL_USER_MANAGEMENT', 'LBL_ROLES' => 'LBL_USER_MANAGEMENT', 'LBL_PROFILES' => 'LBL_USER_MANAGEMENT', 'USERGROUPLIST' => 'LBL_USER_MANAGEMENT', 'LBL_SHARING_ACCESS' => 'LBL_USER_MANAGEMENT', 'LBL_FIELDS_ACCESS' => 'LBL_USER_MANAGEMENT', 'LBL_LOGIN_HISTORY_DETAILS' => 'LBL_USER_MANAGEMENT', 'VTLIB_LBL_MODULE_MANAGER' => 'LBL_STUDIO', 'LBL_PICKLIST_EDITOR' => 'LBL_STUDIO', 'LBL_PICKLIST_DEPENDENCY_SETUP' => 'LBL_STUDIO', 'LBL_MENU_EDITOR' => 'LBL_STUDIO', 'NOTIFICATIONSCHEDULERS' => 'LBL_COMMUNICATION_TEMPLATES', 'INVENTORYNOTIFICATION' => 'LBL_COMMUNICATION_TEMPLATES', 'LBL_COMPANY_DETAILS' => 'LBL_COMMUNICATION_TEMPLATES', 'LBL_MAIL_SERVER_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_CURRENCY_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_TAX_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_SYSTEM_INFO' => 'LBL_OTHER_SETTINGS', 'LBL_ANNOUNCEMENT' => 'LBL_OTHER_SETTINGS', 'LBL_DEFAULT_MODULE_VIEW' => 'LBL_OTHER_SETTINGS', 'INVENTORYTERMSANDCONDITIONS' => 'LBL_OTHER_SETTINGS', 'LBL_CUSTOMIZE_MODENT_NUMBER' => 'LBL_OTHER_SETTINGS', 'LBL_MAIL_SCANNER' => 'LBL_OTHER_SETTINGS', 'LBL_LIST_WORKFLOWS' => 'LBL_OTHER_SETTINGS', 'LBL_CONFIG_EDITOR' => 'LBL_OTHER_SETTINGS', 'Scheduler' => 'LBL_OTHER_SETTINGS');
     //description for fields
     $description = array('LBL_USER_DESCRIPTION', 'LBL_ROLE_DESCRIPTION', 'LBL_PROFILE_DESCRIPTION', 'LBL_GROUP_DESCRIPTION', 'LBL_SHARING_ACCESS_DESCRIPTION', 'LBL_SHARING_FIELDS_DESCRIPTION', 'LBL_LOGIN_HISTORY_DESCRIPTION', 'VTLIB_LBL_MODULE_MANAGER_DESCRIPTION', 'LBL_PICKLIST_DESCRIPTION', 'LBL_PICKLIST_DEPENDENCY_DESCRIPTION', 'LBL_MENU_DESC', 'LBL_NOTIF_SCHED_DESCRIPTION', 'LBL_INV_NOTIF_DESCRIPTION', 'LBL_COMPANY_DESCRIPTION', 'LBL_MAIL_SERVER_DESCRIPTION', 'LBL_CURRENCY_DESCRIPTION', 'LBL_TAX_DESCRIPTION', 'LBL_SYSTEM_DESCRIPTION', 'LBL_ANNOUNCEMENT_DESCRIPTION', 'LBL_DEFAULT_MODULE_VIEW_DESC', 'LBL_INV_TANDC_DESCRIPTION', 'LBL_CUSTOMIZE_MODENT_NUMBER_DESCRIPTION', 'LBL_MAIL_SCANNER_DESCRIPTION', 'LBL_LIST_WORKFLOWS_DESCRIPTION', 'LBL_CONFIG_EDITOR_DESCRIPTION', 'Allows you to Configure Cron Task');
     $links = array('index.php?module=Users&parent=Settings&view=List', 'index.php?module=Roles&parent=Settings&view=Index', 'index.php?module=Profiles&parent=Settings&view=List', 'index.php?module=Groups&parent=Settings&view=List', 'index.php?module=SharingAccess&parent=Settings&view=Index', 'index.php?module=FieldAccess&parent=Settings&view=Index', 'index.php?module=LoginHistory&parent=Settings&view=List', 'index.php?module=ModuleManager&parent=Settings&view=List', 'index.php?parent=Settings&module=Picklist&view=Index', 'index.php?parent=Settings&module=PickListDependency&view=List', 'index.php?module=MenuEditor&parent=Settings&view=Index', 'index.php?module=Settings&view=listnotificationschedulers&parenttab=Settings', 'index.php?module=Settings&view=listinventorynotifications&parenttab=Settings', 'index.php?parent=Settings&module=Vtiger&view=CompanyDetails', 'index.php?parent=Settings&module=Vtiger&view=OutgoingServerDetail', 'index.php?parent=Settings&module=Currency&view=List', 'index.php?module=Vtiger&parent=Settings&view=TaxIndex', 'index.php?module=Settings&submodule=Server&view=ProxyConfig', 'index.php?parent=Settings&module=Vtiger&view=AnnouncementEdit', 'index.php?module=Settings&action=DefModuleView&parenttab=Settings', 'index.php?parent=Settings&module=Vtiger&view=TermsAndConditionsEdit', 'index.php?module=Vtiger&parent=Settings&view=CustomRecordNumbering', 'index.php?parent=Settings&module=MailConverter&view=List', 'index.php?module=Workflows&parent=Settings&view=List', 'index.php?module=Vtiger&parent=Settings&view=ConfigEditorDetail', 'index.php?module=CronTasks&parent=Settings&view=List');
     //insert settings blocks
     $count = count($blocks);
     for ($i = 0; $i < $count; $i++) {
         $adb->query("insert into vtiger_settings_blocks values (" . $adb->getUniqueID('vtiger_settings_blocks') . ", '{$blocks[$i]}', {$i}+1)");
     }
     $count = count($icons);
     //insert settings fields
     for ($i = 0, $seq = 1; $i < $count; $i++, $seq++) {
         if ($i == 7 || $i == 11 || $i == 14) {
             $seq = 1;
         }
         $adb->query("insert into vtiger_settings_field (fieldid, blockid, name, iconpath, description, linkto, sequence) values (" . $adb->getUniqueID('vtiger_settings_field') . ", " . getSettingsBlockId($name_blocks[$names[$i]]) . ", '{$names[$i]}', '{$icons[$i]}', '{$description[$i]}', '{$links[$i]}', {$seq})");
     }
     //hide the system details tab for now
     $adb->query("update vtiger_settings_field set active=1 where name='LBL_SYSTEM_INFO'");
 }
Ejemplo n.º 18
0
function moveSettingsToDatabase($adb)
{
    $adb->query("drop table if exists vtiger_settings_blocks");
    $adb->query("drop table if exists vtiger_settings_field");
    $adb->query("CREATE TABLE IF NOT EXISTS vtiger_settings_blocks (blockid int(19), label varchar(250), sequence int(19), primary key pk_vtiger_settings_blocks (blockid)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    $adb->query("CREATE TABLE IF NOT EXISTS vtiger_settings_field (fieldid int(19), blockid int(19), name varchar(250), iconpath text, description text, linkto text, sequence int(19), active int(19) default 0,foreign key fk_vtiger_settings_fields (blockid) references vtiger_settings_blocks(blockid) on delete cascade) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    //icons for all fields
    $icons = array("ico-users.gif", "ico-roles.gif", "ico-profile.gif", "ico-groups.gif", "shareaccess.gif", "orgshar.gif", "audit.gif", "set-IcoLoginHistory.gif", "vtlib_modmng.gif", "picklist.gif", "ViewTemplate.gif", "mailmarge.gif", "notification.gif", "inventory.gif", "company.gif", "ogmailserver.gif", "backupserver.gif", "assign.gif", "currency.gif", "taxConfiguration.gif", "system.gif", "proxy.gif", "announ.gif", "set-IcoTwoTabConfig.gif", "terms.gif", "settingsInvNumber.gif", "mailScanner.gif", "settingsWorkflow.png");
    //labels for blocks
    $blocks = array('LBL_MODULE_MANAGER', 'LBL_USER_MANAGEMENT', 'LBL_STUDIO', 'LBL_COMMUNICATION_TEMPLATES', 'LBL_OTHER_SETTINGS');
    //field names
    $names = array('LBL_USERS', 'LBL_ROLES', 'LBL_PROFILES', 'USERGROUPLIST', 'LBL_SHARING_ACCESS', 'LBL_FIELDS_ACCESS', 'LBL_AUDIT_TRAIL', 'LBL_LOGIN_HISTORY_DETAILS', 'VTLIB_LBL_MODULE_MANAGER', 'LBL_PICKLIST_EDITOR', 'EMAILTEMPLATES', 'LBL_MAIL_MERGE', 'NOTIFICATIONSCHEDULERS', 'INVENTORYNOTIFICATION', 'LBL_COMPANY_DETAILS', 'LBL_MAIL_SERVER_SETTINGS', 'LBL_BACKUP_SERVER_SETTINGS', 'LBL_ASSIGN_MODULE_OWNERS', 'LBL_CURRENCY_SETTINGS', 'LBL_TAX_SETTINGS', 'LBL_SYSTEM_INFO', 'LBL_PROXY_SETTINGS', 'LBL_ANNOUNCEMENT', 'LBL_DEFAULT_MODULE_VIEW', 'INVENTORYTERMSANDCONDITIONS', 'LBL_CUSTOMIZE_MODENT_NUMBER', 'LBL_MAIL_SCANNER', 'LBL_LIST_WORKFLOWS');
    $name_blocks = array('LBL_USERS' => 'LBL_USER_MANAGEMENT', 'LBL_ROLES' => 'LBL_USER_MANAGEMENT', 'LBL_PROFILES' => 'LBL_USER_MANAGEMENT', 'USERGROUPLIST' => 'LBL_USER_MANAGEMENT', 'LBL_SHARING_ACCESS' => 'LBL_USER_MANAGEMENT', 'LBL_FIELDS_ACCESS' => 'LBL_USER_MANAGEMENT', 'LBL_AUDIT_TRAIL' => 'LBL_USER_MANAGEMENT', 'LBL_LOGIN_HISTORY_DETAILS' => 'LBL_USER_MANAGEMENT', 'VTLIB_LBL_MODULE_MANAGER' => 'LBL_STUDIO', 'LBL_PICKLIST_EDITOR' => 'LBL_STUDIO', 'EMAILTEMPLATES' => 'LBL_COMMUNICATION_TEMPLATES', 'LBL_MAIL_MERGE' => 'LBL_COMMUNICATION_TEMPLATES', 'NOTIFICATIONSCHEDULERS' => 'LBL_COMMUNICATION_TEMPLATES', 'INVENTORYNOTIFICATION' => 'LBL_COMMUNICATION_TEMPLATES', 'LBL_COMPANY_DETAILS' => 'LBL_COMMUNICATION_TEMPLATES', 'LBL_MAIL_SERVER_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_BACKUP_SERVER_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_ASSIGN_MODULE_OWNERS' => 'LBL_OTHER_SETTINGS', 'LBL_CURRENCY_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_TAX_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_SYSTEM_INFO' => 'LBL_OTHER_SETTINGS', 'LBL_PROXY_SETTINGS' => 'LBL_OTHER_SETTINGS', 'LBL_ANNOUNCEMENT' => 'LBL_OTHER_SETTINGS', 'LBL_DEFAULT_MODULE_VIEW' => 'LBL_OTHER_SETTINGS', 'INVENTORYTERMSANDCONDITIONS' => 'LBL_OTHER_SETTINGS', 'LBL_CUSTOMIZE_MODENT_NUMBER' => 'LBL_OTHER_SETTINGS', 'LBL_MAIL_SCANNER' => 'LBL_OTHER_SETTINGS', 'LBL_LIST_WORKFLOWS' => 'LBL_OTHER_SETTINGS');
    //description for fields
    $description = array('LBL_USER_DESCRIPTION', 'LBL_ROLE_DESCRIPTION', 'LBL_PROFILE_DESCRIPTION', 'LBL_GROUP_DESCRIPTION', 'LBL_SHARING_ACCESS_DESCRIPTION', 'LBL_SHARING_FIELDS_DESCRIPTION', 'LBL_AUDIT_DESCRIPTION', 'LBL_LOGIN_HISTORY_DESCRIPTION', 'VTLIB_LBL_MODULE_MANAGER_DESCRIPTION', 'LBL_PICKLIST_DESCRIPTION', 'LBL_EMAIL_TEMPLATE_DESCRIPTION', 'LBL_MAIL_MERGE_DESCRIPTION', 'LBL_NOTIF_SCHED_DESCRIPTION', 'LBL_INV_NOTIF_DESCRIPTION', 'LBL_COMPANY_DESCRIPTION', 'LBL_MAIL_SERVER_DESCRIPTION', 'LBL_BACKUP_SERVER_DESCRIPTION', 'LBL_MODULE_OWNERS_DESCRIPTION', 'LBL_CURRENCY_DESCRIPTION', 'LBL_TAX_DESCRIPTION', 'LBL_SYSTEM_DESCRIPTION', 'LBL_PROXY_DESCRIPTION', 'LBL_ANNOUNCEMENT_DESCRIPTION', 'LBL_DEFAULT_MODULE_VIEW_DESC', 'LBL_INV_TANDC_DESCRIPTION', 'LBL_CUSTOMIZE_MODENT_NUMBER_DESCRIPTION', 'LBL_MAIL_SCANNER_DESCRIPTION', 'LBL_LIST_WORKFLOWS_DESCRIPTION');
    $links = array('index.php?module=Administration&action=index&parenttab=Settings', 'index.php?module=Settings&action=listroles&parenttab=Settings', 'index.php?module=Settings&action=ListProfiles&parenttab=Settings', 'index.php?module=Settings&action=listgroups&parenttab=Settings', 'index.php?module=Settings&action=OrgSharingDetailView&parenttab=Settings', 'index.php?module=Settings&action=DefaultFieldPermissions&parenttab=Settings', 'index.php?module=Settings&action=AuditTrailList&parenttab=Settings', 'index.php?module=Settings&action=ListLoginHistory&parenttab=Settings', 'index.php?module=Settings&action=ModuleManager&parenttab=Settings', 'index.php?module=PickList&action=PickList&parenttab=Settings', 'index.php?module=Settings&action=listemailtemplates&parenttab=Settings', 'index.php?module=Settings&action=listwordtemplates&parenttab=Settings', 'index.php?module=Settings&action=listnotificationschedulers&parenttab=Settings', 'index.php?module=Settings&action=listinventorynotifications&parenttab=Settings', 'index.php?module=Settings&action=OrganizationConfig&parenttab=Settings', 'index.php?module=Settings&action=EmailConfig&parenttab=Settings', 'index.php?module=Settings&action=BackupServerConfig&parenttab=Settings', 'index.php?module=Settings&action=ListModuleOwners&parenttab=Settings', 'index.php?module=Settings&action=CurrencyListView&parenttab=Settings', 'index.php?module=Settings&action=TaxConfig&parenttab=Settings', 'index.php?module=System&action=listsysconfig&parenttab=Settings', 'index.php?module=Settings&action=ProxyServerConfig&parenttab=Settings', 'index.php?module=Settings&action=Announcements&parenttab=Settings', 'index.php?module=Settings&action=DefModuleView&parenttab=Settings', 'index.php?module=Settings&action=OrganizationTermsandConditions&parenttab=Settings', 'index.php?module=Settings&action=CustomModEntityNo&parenttab=Settings', 'index.php?module=Settings&action=MailScanner&parenttab=Settings', 'index.php?module=com_vtiger_workflow&action=workflowlist&parenttab=Settings');
    //insert settings blocks
    $count = count($blocks);
    for ($i = 0; $i < $count; $i++) {
        $adb->query("insert into vtiger_settings_blocks values (" . $adb->getUniqueID('vtiger_settings_blocks') . ", '{$blocks[$i]}', {$i}+1)");
    }
    $count = count($icons);
    //insert settings fields
    for ($i = 0, $seq = 1; $i < $count; $i++, $seq++) {
        if ($i == 8 || $i == 12 || $i == 18) {
            $seq = 1;
        }
        $adb->query("insert into vtiger_settings_field (fieldid, blockid, name, iconpath, description, linkto, sequence) values (" . $adb->getUniqueID('vtiger_settings_field') . ", " . getSettingsBlockId($name_blocks[$names[$i]]) . ", '{$names[$i]}', '{$icons[$i]}', '{$description[$i]}', '{$links[$i]}', {$seq})");
    }
    //hide the system details tab for now
    $adb->query("update vtiger_settings_field set active=1 where name='LBL_SYSTEM_INFO'");
}