示例#1
0
 public function SaveSequenceNumber(Vtiger_Request $request)
 {
     $updatedFieldsList = $request->get('updatedFields');
     //This will update the modules sequence
     Settings_Search_Module_Model::updateSequenceNumber($updatedFieldsList);
     $response = new Vtiger_Response();
     $response->setResult(array('success' => true));
     $response->emit();
 }
示例#2
0
 public function addSql()
 {
     global $log, $adb;
     $log->debug("Entering VT620_to_YT::addSql() method ...");
     $adb->query("insert  into `yetiforce_mail_config`(`type`,`name`,`value`) values ('mailIcon','showMailAccounts','false');");
     $adb->query("insert  into `yetiforce_mail_config`(`type`,`name`,`value`) values ('mailIcon','showNumberUnreadEmails','false');");
     $adb->query("insert  into `yetiforce_mail_config`(`type`,`name`,`value`) values ('mailIcon','showMailIcon','true');");
     $adb->pquery("insert  into `yetiforce_mail_config`(`type`,`name`,`value`) values ('mailIcon','timeCheckingMail',?);", array(30));
     $adb->pquery("insert  into `yetiforce_mail_config`(`type`,`name`,`value`) values ('autologin','autologinActive',?);", array('false'));
     $adb->query("insert  into `yetiforce_mail_config`(`type`,`name`,`value`) values ('signature','signature','');");
     $adb->query("insert  into `yetiforce_mail_config`(`type`,`name`,`value`) values ('signature','addSignature','false');");
     $adb->query("insert  into `yetiforce_proc_marketing`(`type`,`param`,`value`) values ('conversion','change_owner','false');");
     $adb->query("insert  into `yetiforce_proc_marketing`(`type`,`param`,`value`) values ('lead','groups','');");
     $adb->query("insert  into `yetiforce_proc_marketing`(`type`,`param`,`value`) values ('lead','status','');");
     $adb->query("insert  into `yetiforce_proc_marketing`(`type`,`param`,`value`) values ('lead','currentuser_status','false');");
     $adb->query("insert  into `yetiforce_proc_sales`(`type`,`param`,`value`) values ('popup','limit_product_service','false');");
     $adb->query("insert  into `yetiforce_proc_sales`(`type`,`param`,`value`) values ('popup','update_shared_permissions','false');");
     $adb->query("insert  into `yetiforce_proc_sales`(`type`,`param`,`value`) values ('calculation','calculationsstatus','');");
     $adb->query("insert  into `yetiforce_proc_sales`(`type`,`param`,`value`) values ('potential','salesstage','');");
     $adb->query("insert  into `yetiforce_proc_sales`(`type`,`param`,`value`) values ('asset','assetstatus','');");
     $adb->query("insert  into `yetiforce_proc_sales`(`type`,`param`,`value`) values ('potential','add_potential','false');");
     $adb->pquery('UPDATE vtiger_ws_fieldtype SET uitype = ? WHERE fieldtypeid = ?;', [67, 35]);
     $adb->pquery('DELETE FROM vtiger_ws_referencetype WHERE `fieldtypeid` = ? AND `type` = ?;', [34, 'Accounts']);
     $adb->pquery('DELETE FROM vtiger_ws_referencetype WHERE `fieldtypeid` = ? AND `type` = ?;', [34, 'Leads']);
     $adb->pquery('DELETE FROM vtiger_ws_referencetype WHERE `fieldtypeid` = ? AND `type` = ?;', [35, 'Users']);
     $adb->pquery("INSERT INTO vtiger_ws_referencetype (`fieldtypeid`, `type`) VALUES ('35', 'Accounts');");
     $adb->pquery("INSERT INTO vtiger_ws_referencetype (`fieldtypeid`, `type`) VALUES ('35', 'Contacts');");
     $adb->pquery("INSERT INTO vtiger_ws_referencetype (`fieldtypeid`, `type`) VALUES ('35', 'Leads');");
     $adb->pquery("INSERT INTO vtiger_ws_referencetype (`fieldtypeid`, `type`) VALUES ('35', 'OSSEmployees');");
     $adb->pquery("INSERT INTO vtiger_ws_referencetype (`fieldtypeid`, `type`) VALUES ('35', 'Vendors');");
     //changeCalendarRelationships
     $result = $adb->query("SHOW TABLES LIKE 'vtiger_cntactivityrel';");
     if ($adb->num_rows($result) > 0) {
         $result = $adb->query("SELECT * FROM vtiger_cntactivityrel;");
         for ($i = 0; $i < $adb->num_rows($result); $i++) {
             $contactid = $adb->query_result_raw($result, $i, 'contactid');
             $activityid = $adb->query_result_raw($result, $i, 'activityid');
             $adb->pquery('UPDATE vtiger_activity SET link = ? WHERE activityid = ?;', [$contactid, $activityid]);
         }
         $result = $adb->query("SELECT vtiger_seactivityrel.*, vtiger_crmentity.setype FROM vtiger_seactivityrel INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_seactivityrel.crmid;");
         for ($i = 0; $i < $adb->num_rows($result); $i++) {
             $crmid = $adb->query_result_raw($result, $i, 'crmid');
             $activityid = $adb->query_result_raw($result, $i, 'activityid');
             $setype = $adb->query_result_raw($result, $i, 'setype');
             if (in_array($setype, ['Accounts', 'Leads'])) {
                 $adb->pquery('UPDATE vtiger_activity SET link = ? WHERE activityid = ?;', [$crmid, $activityid]);
             }
             if (in_array($setype, ['Campaigns', 'HelpDesk', 'Potentials', 'Project', 'ServiceContracts'])) {
                 $adb->pquery('UPDATE vtiger_activity SET process = ? WHERE activityid = ?;', [$crmid, $activityid]);
             }
         }
         $adb->query('DROP TABLE vtiger_cntactivityrel;');
         $adb->query('DROP TABLE vtiger_seactivityrel;');
         $adb->query('DROP TABLE vtiger_seactivityrel_seq;');
     }
     $adb->pquery("UPDATE `vtiger_ossmailtemplates_type` SET `presence` = ? WHERE `ossmailtemplates_type` = ?;", array(0, 'PLL_MODULE'));
     $adb->pquery('UPDATE vtiger_homestuff SET `visible` = ? WHERE `stufftype` = ? ;', [1, 'Tag Cloud']);
     $adb->pquery('UPDATE vtiger_field SET typeofdata = ? WHERE tablename = ? AND columnname = ?;', ['D~M', 'vtiger_projectmilestone', 'projectmilestonedate']);
     $adb->query("insert  into `yetiforce_auth`(`type`,`param`,`value`) values ('ldap','active','false');");
     $adb->query("insert  into `yetiforce_auth`(`type`,`param`,`value`) values ('ldap','server','testlab.local');");
     $adb->query("insert  into `yetiforce_auth`(`type`,`param`,`value`) values ('ldap','port','389');");
     $adb->pquery("insert  into `yetiforce_auth`(`type`,`param`,`value`) values (?,?,?);", ['ldap', 'users', NULL]);
     $adb->pquery("insert  into `yetiforce_auth`(`type`,`param`,`value`) values (?,?,?);", ['ldap', 'domain', NULL]);
     $adb->pquery("INSERT INTO vtiger_realization_process(module_id, status_indicate_closing) VALUES(?,?)", array(getTabid('Project'), ''));
     $adb->query("insert  into `vtiger_support_processes`(`id`,`ticket_status_indicate_closing`) values (1,'');");
     $result = $adb->pquery('SELECT quickcreatesequence FROM `vtiger_field` WHERE tablename = ? AND columnname = ? AND tabid =?;', array('vtiger_seactivityrel', 'crmid', getTabid('Calendar')));
     $result2 = $adb->pquery('SELECT quickcreatesequence FROM `vtiger_field` WHERE tablename = ? AND columnname = ? AND tabid =?;', array('vtiger_seactivityrel', 'crmid', getTabid('Events')));
     if ($adb->num_rows($result) == 1) {
         $quickcreatesequence = $adb->query_result($result, 0, 'quickcreatesequence');
         $adb->pquery('UPDATE `vtiger_field` SET columnname=?,tablename=?,fieldname=?,fieldlabel=?, quickcreate=? WHERE tablename = ? AND columnname = ? ;', ['process', 'vtiger_activity', 'process', 'Process', '1', 'vtiger_seactivityrel', 'crmid']);
         $adb->pquery('UPDATE `vtiger_field` SET columnname=?,tablename=?,fieldname=?,fieldlabel=?, quickcreate=?, uitype=?, quickcreatesequence=?, summaryfield=? WHERE tablename = ? AND columnname = ? AND tabid = ?;', ['link', 'vtiger_activity', 'link', 'Relation', '2', '67', $quickcreatesequence, '1', 'vtiger_cntactivityrel', 'contactid', getTabid('Calendar')]);
         $quickcreatesequence = $adb->query_result($result2, 0, 'quickcreatesequence');
         $adb->pquery('UPDATE `vtiger_field` SET columnname=?,tablename=?,fieldname=?,fieldlabel=?, quickcreate=?, uitype=?, quickcreatesequence=?, summaryfield=? WHERE tablename = ? AND columnname = ? AND tabid = ?;', ['link', 'vtiger_activity', 'link', 'Relation', '2', '67', $quickcreatesequence, '1', 'vtiger_cntactivityrel', 'contactid', getTabid('Events')]);
     }
     // copy values from_portal in HelpDesk
     $result = $adb->query("SHOW COLUMNS FROM `vtiger_troubletickets` LIKE 'from_portal';");
     if ($adb->num_rows($result) == 0) {
         $adb->query("ALTER TABLE `vtiger_troubletickets` ADD COLUMN `from_portal` varchar(3) NULL after `ordertime` ;");
         $adb->query('UPDATE vtiger_troubletickets LEFT JOIN vtiger_ticketcf ON vtiger_troubletickets.ticketid = vtiger_ticketcf.ticketid SET vtiger_troubletickets.from_portal=vtiger_ticketcf.from_portal;');
         $adb->pquery('UPDATE `vtiger_field` SET tablename=? WHERE tablename = ? AND columnname = ? AND tabid = ?;', ['vtiger_troubletickets', 'vtiger_ticketcf', 'from_portal', getTabid('HelpDesk')]);
         $adb->pquery('alter table vtiger_ticketcf drop column from_portal');
     }
     $result = $adb->pquery('SELECT * FROM `roundcube_system` WHERE name = ?;', array('roundcube-version'));
     if ($adb->num_rows($result) == 1) {
         $adb->pquery('UPDATE `roundcube_system` SET `value` = ? WHERE `name` = ?;', ['2015030800', 'roundcube-version']);
     } else {
         $adb->pquery('INSERT INTO `roundcube_system`(`name`,`value`) values (?,?);', ['2015030800', 'roundcube-version']);
     }
     // improved global search
     $result = $adb->query('SELECT * FROM `vtiger_entityname`;');
     $num = $adb->num_rows($result);
     for ($i = 0; $i < $num; $i++) {
         $tabId = $adb->query_result_raw($result, $i, 'tabid');
         Settings_Search_Module_Model::UpdateLabels(['tabid' => $tabId]);
     }
     $log->debug("Exiting VT620_to_YT::addSql() method ...");
 }
示例#3
0
    function databaseData()
    {
        global $log, $adb;
        $log->debug("Entering YetiForceUpdate::databaseData() method ...");
        $result = $adb->pquery("SELECT * FROM `vtiger_blocks` WHERE `blocklabel` = ? AND `tabid` = ?;", ['Oryginalna wiadomość', getTabid('OSSMailView')]);
        if ($adb->num_rows($result)) {
            $adb->pquery("UPDATE `vtiger_blocks` SET `blocklabel` = ? WHERE `blocklabel` = ? AND `tabid` = ?;", ['LBL_ORIGN_MESSAGE', 'Oryginalna wiadomość', getTabid('OSSMailView')]);
        }
        $result = $adb->query("SELECT * FROM `vtiger_field` WHERE `fieldlabel` = 'Treść' AND `columnname` = 'orginal_mail';");
        if ($adb->num_rows($result)) {
            $adb->pquery("UPDATE `vtiger_field` SET `fieldlabel` = ? WHERE `fieldlabel` = ? AND `columnname` = ?;", ['Content', 'Treść', 'orginal_mail']);
        }
        $this->relatedList();
        $result = $adb->query("SELECT * FROM `yetiforce_proc_marketing` WHERE `type` = 'lead' AND `param` = 'convert_status';");
        if (!$adb->num_rows($result)) {
            $adb->query("insert  into `yetiforce_proc_marketing`(`type`,`param`,`value`) values ('lead','convert_status','LBL_LEAD_ACQUIRED');");
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_settings_field` WHERE `name` = ? ", ['LBL_CUSTOM_FIELD_MAPPING']);
        if (!$adb->num_rows($result)) {
            $blockid = $adb->query_result($adb->pquery("SELECT blockid FROM vtiger_settings_blocks WHERE label='LBL_STUDIO'", []), 0, 'blockid');
            $sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", [$blockid]), 0, 'sequence') + 1;
            $fieldid = $adb->getUniqueId('vtiger_settings_field');
            $adb->pquery("INSERT INTO vtiger_settings_field (fieldid,blockid,sequence,name,iconpath,description,linkto)\n\t\t\tVALUES (?,?,?,?,?,?,?)", array($fieldid, $blockid, $sequence, 'LBL_CUSTOM_FIELD_MAPPING', '', 'LBL_CUSTOM_FIELD_MAPPING_DESCRIPTION', 'index.php?parent=Settings&module=Leads&view=MappingDetail'));
        }
        $mailTemplates = ['Notify Owner On Ticket Change', 'Notify Account On Ticket Change', 'Notify Contact On Ticket Closed', 'Notify Account On Ticket Closed', 'Notify Contact On Ticket Create', 'Notify Account On Ticket Create', 'Notify Contact On Ticket Change', 'Notify Owner On Ticket Closed', 'Notify Owner On Ticket Create'];
        $result = $adb->pquery("SELECT `content`,`name` FROM `vtiger_ossmailtemplates` WHERE `name` IN (" . generateQuestionMarks($mailTemplates) . ") AND `oss_module_list` = ?;", [$mailTemplates, 'HelpDesk']);
        while ($row = $adb->fetch_array($result)) {
            $content = str_replace('
	<li>#b#718#bEnd#: #a#718#aEnd#</li>', '', $row['content']);
            $adb->pquery("UPDATE `vtiger_ossmailtemplates` SET `content` = ? WHERE `name` = ? AND `oss_module_list` = ?;", [$content, $row['name'], 'HelpDesk']);
        }
        $result = $adb->query("SELECT * FROM `vtiger_entityname` WHERE `fieldname` = 'holidaysentitlement_year' AND `modulename` = 'HolidaysEntitlement';");
        if ($adb->num_rows($result)) {
            $adb->pquery("UPDATE `vtiger_entityname` SET `fieldname` = ?, `searchcolumn` = ? WHERE `modulename` = ?;", ['ossemployeesid,days', 'ossemployeesid', 'HolidaysEntitlement']);
            Settings_Search_Module_Model::UpdateLabels(['tabid' => getTabid('HolidaysEntitlement')]);
        }
        $result = $adb->query("SELECT * FROM `vtiger_links` WHERE `linklabel` = 'LBL_CREATED_BY_ME_BUT_NOT_MINE_ACTIVITIES' AND `linktype` = 'DASHBOARDWIDGET';");
        if (!$adb->num_rows($result)) {
            $linkModule = Vtiger_Module::getInstance('Home');
            $linkModule->addLink('DASHBOARDWIDGET', "LBL_CREATED_BY_ME_BUT_NOT_MINE_ACTIVITIES", 'index.php?module=Home&view=ShowWidget&name=CreatedNotMineActivities');
        }
        $result = $adb->query("SELECT * FROM `vtiger_cron_task` WHERE `module` = 'CurrencyUpdate';");
        if (!$adb->num_rows($result)) {
            $cron = ['LBL_CURRENCY_UPDATE', 'modules/Settings/CurrencyUpdate/cron/CurrencyUpdateCron.php', 86400, NULL, NULL, 1, 'CurrencyUpdate', 4, 'Recommended frequency for Currency Update is 24 hours'];
            Vtiger_Cron::register($cron[0], $cron[1], $cron[2], $cron[6], $cron[5], 0, $cron[8]);
        }
        $result = $adb->pquery("SELECT * FROM `vtiger_settings_field` WHERE `name` = ? ", ['LBL_CURRENCY_UPDATE']);
        if (!$adb->num_rows($result)) {
            $blockid = $adb->query_result($adb->pquery("SELECT blockid FROM vtiger_settings_blocks WHERE label='LBL_OTHER_SETTINGS'", []), 0, 'blockid');
            $sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", [$blockid]), 0, 'sequence') + 1;
            $fieldid = $adb->getUniqueId('vtiger_settings_field');
            $adb->pquery("INSERT INTO vtiger_settings_field (fieldid,blockid,sequence,name,iconpath,description,linkto)\n\t\t\tVALUES (?,?,?,?,?,?,?)", [$fieldid, $blockid, $sequence, 'LBL_CURRENCY_UPDATE', '', 'LBL_CURRENCY_UPDATE_DESCRIPTION', 'index.php?module=CurrencyUpdate&view=Index&parent=Settings']);
        }
        $result = $adb->query("SELECT * FROM `vtiger_ossmailscanner_config` WHERE `conf_type` = 'exceptions';");
        if (!$adb->num_rows($result)) {
            $adb->pquery('insert  into `vtiger_ossmailscanner_config`(`conf_type`,`parameter`,`value`) values (?,?,?);', ['exceptions', 'crating_mails', NULL]);
            $adb->pquery('insert  into `vtiger_ossmailscanner_config`(`conf_type`,`parameter`,`value`) values (?,?,?);', ['exceptions', 'crating_mails', NULL]);
        }
        $adb->pquery("UPDATE `vtiger_settings_field` SET `linkto` = ? WHERE `linkto` = ?;", ['index.php?module=OSSMailScanner&parent=Settings&view=Index', 'index.php?module=OSSMailScanner&parent=Settings&view=index']);
        $result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", ['parent_id', 'vtiger_troubletickets']);
        $result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", [$adb->query_result($result1, 0, 'fieldid'), 'Vendors']);
        if ($adb->num_rows($result2) == 0) {
            $adb->query("insert  into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`) values (" . $adb->query_result($result1, 0, 'fieldid') . ",'HelpDesk','Vendors');");
        }
        $result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", ['linktoaccountscontacts', 'vtiger_project']);
        $result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", [$adb->query_result($result1, 0, 'fieldid'), 'Vendors']);
        if ($adb->num_rows($result2) == 0) {
            $adb->query("insert  into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`) values (" . $adb->query_result($result1, 0, 'fieldid') . ",'Project','Vendors');");
        }
        $moduleInstance = Vtiger_Module::getInstance('HelpDesk');
        $target_Module = Vtiger_Module::getInstance('Vendors');
        $target_Module->setRelatedList($moduleInstance, 'HelpDesk', array('add'), 'get_dependents_list');
        $moduleInstance = Vtiger_Module::getInstance('Project');
        $target_Module = Vtiger_Module::getInstance('Vendors');
        $target_Module->setRelatedList($moduleInstance, 'Project', array('add'), 'get_dependents_list');
        $log->debug("Exiting YetiForceUpdate::databaseData() method ...");
    }