/** * Invoked when special actions are performed on the module. * @param String Module name * @param String Event Type */ function vtlib_handler($moduleName, $eventType) { global $adb; if ($eventType == 'module.postinstall') { include_once 'vtlib/Vtiger/Module.php'; $moduleInstance = CRMEntity::getInstance('RequirementCards'); $moduleInstance->setModuleSeqNumber("configure", 'RequirementCards', 'RC', '1'); $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array('RequirementCards')); $moduleInstance = Vtiger_Module::getInstance('RequirementCards'); $targetModule = Vtiger_Module::getInstance('Accounts'); $targetModule->setRelatedList($moduleInstance, 'RequirementCards', array('ADD'), 'get_dependents_list'); $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments'); if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) { include_once 'modules/ModComments/ModComments.php'; if (class_exists('ModComments')) { ModComments::addWidgetTo(array('RequirementCards')); } } $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker'); if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) { include_once 'vtlib/Vtiger/Module.php'; include_once 'modules/ModTracker/ModTracker.php'; $tabid = Vtiger_Functions::getModuleId('RequirementCards'); $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabid)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1)); $moduleModTrackerInstance->updateCache($tabid, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid)); $moduleModTrackerInstance->updateCache($tabid, 1); } if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) { $moduleInstance = Vtiger_Module::getInstance($tabid); $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted')); } } } else { if ($eventType == 'module.disabled') { // TODO Handle actions before this module is being uninstalled. } 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. } } } } } }
/** * 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) { $adb = PearDatabase::getInstance(); if ($event_type == 'module.postinstall') { $ModuleInstance = CRMEntity::getInstance($modulename); $ModuleInstance->setModuleSeqNumber("configure", $modulename, '', '1'); $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments'); if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) { include_once 'modules/ModComments/ModComments.php'; if (class_exists('ModComments')) { ModComments::addWidgetTo(array('Payments')); } } $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename)); $tabid = Vtiger_Functions::getModuleId($modulename); include_once 'modules/ModTracker/ModTracker.php'; $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabid)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1)); $moduleModTrackerInstance->updateCache($tabid, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid)); $moduleModTrackerInstance->updateCache($tabid, 1); } if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) { $moduleInstance = Vtiger_Module::getInstance($tabid); $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted')); } $this->addWorkflow($modulename); } 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') { // 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') { } } } } } } }
/** * 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') { include_once 'vtlib/Vtiger/Module.php'; $myCustomEntity = CRMEntity::getInstance($moduleName); $myCustomPrefix = "M_"; $sequenceStart = '1'; $myCustomEntity->setModuleSeqNumber("configure", $moduleName, $myCustomPrefix, $sequenceStart); $displayLabel = 'OSSMailView'; $adb->query("UPDATE vtiger_tab SET customized=0 WHERE name='{$displayLabel}'"); $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter,value) VALUES (?,?,?)", array('email_list', 'widget_limit', '10')); $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter,value) VALUES (?,?,?)", array('email_list', 'target', '_blank')); $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter,value) VALUES (?,?,?)", array('email_list', 'permissions', 'vtiger')); include_once 'modules/ModTracker/ModTracker.php'; $tabid = Vtiger_Functions::getModuleId($moduleName); $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabid)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1)); $moduleModTrackerInstance->updateCache($tabid, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid)); $moduleModTrackerInstance->updateCache($tabid, 1); } if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) { $moduleInstance = Vtiger_Module::getInstance($tabid); $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted')); } $this->add_relation(); $registerLink = true; $Module = Vtiger_Module::getInstance($moduleName); $user_id = Users_Record_Model::getCurrentUserModel()->get('user_name'); $adb->pquery("INSERT INTO vtiger_ossmails_logs (`action`, `info`, `user`) VALUES (?, ?, ?);", array('Action_InstallModule', $moduleName . ' ' . $Module->version, $user_id), false); $this->turn_on($moduleName); } else { if ($eventType == 'module.disabled') { $this->turn_off($moduleName); $registerLink = false; // TODO Handle actions when this module is disabled. } else { if ($eventType == 'module.enabled') { $this->turn_on($moduleName); $registerLink = true; $this->add_relation(); // 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') { $Module = Vtiger_Module::getInstance($moduleName); $user_id = Users_Record_Model::getCurrentUserModel()->get('user_name'); $adb->pquery("INSERT INTO vtiger_ossmails_logs (`action`, `info`, `user`) VALUES (?, ?, ?);", array('Action_UpdateModule', $moduleName . ' ' . $Module->version, $user_id), false); } } } } } } $displayLabel = 'Mail View'; if ($registerLink) { $blockid = $adb->query_result($adb->pquery("SELECT blockid FROM vtiger_settings_blocks WHERE label='LBL_MAIL'", array()), 0, 'blockid'); $sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", array($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\t\tVALUES (?,?,?,?,?,?,?)", array($fieldid, $blockid, $sequence, $displayLabel, '', 'LBL_MAIL_VIEW_DESCRIPTION', 'index.php?module=OSSMailView&parent=Settings&view=index')); } else { $adb->pquery("DELETE FROM vtiger_settings_field WHERE name=?", array($displayLabel)); } }
/** * 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) { $adb = PearDatabase::getInstance(); if ($event_type == 'module.postinstall') { $ModuleInstance = CRMEntity::getInstance($modulename); $ModuleInstance->setModuleSeqNumber("configure", $modulename, '', '1'); $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments'); if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) { include_once 'modules/ModComments/ModComments.php'; if (class_exists('ModComments')) { ModComments::addWidgetTo(array('Payments')); } } $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename)); $tabid = Vtiger_Functions::getModuleId($modulename); include_once 'modules/ModTracker/ModTracker.php'; $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabid)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1)); $moduleModTrackerInstance->updateCache($tabid, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid)); $moduleModTrackerInstance->updateCache($tabid, 1); } if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) { $moduleInstance = Vtiger_Module::getInstance($tabid); $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted')); } vimport('~~vtlib/Vtiger/Module.php'); $moduleInstance = Vtiger_Module::getInstance('Invoice'); $blockInstance = Vtiger_Block::getInstance('LBL_INVOICE_INFORMATION', $moduleInstance); $fieldInstance = new Vtiger_Field(); $fieldInstance->name = 'payment_balance'; $fieldInstance->table = 'vtiger_invoice'; $fieldInstance->label = 'Payment balance'; $fieldInstance->column = 'payment_balance'; $fieldInstance->columntype = 'decimal(25,8)'; $fieldInstance->uitype = 7; $fieldInstance->typeofdata = 'NN~O'; $fieldInstance->displaytype = 2; $blockInstance->addField($fieldInstance); $moduleInstance = Vtiger_Module::getInstance('Accounts'); $blockInstance = Vtiger_Block::getInstance('LBL_ACCOUNT_INFORMATION', $moduleInstance); $fieldInstance = new Vtiger_Field(); $fieldInstance->name = 'payment_balance'; $fieldInstance->table = 'vtiger_account'; $fieldInstance->label = 'Payment balance'; $fieldInstance->column = 'payment_balance'; $fieldInstance->columntype = 'decimal(25,8)'; $fieldInstance->uitype = 7; $fieldInstance->typeofdata = 'NN~O'; $fieldInstance->displaytype = 2; $blockInstance->addField($fieldInstance); $moduleInstance = Vtiger_Module::getInstance('Potentials'); $blockInstance = Vtiger_Block::getInstance('LBL_OPPORTUNITY_INFORMATION', $moduleInstance); $fieldInstance = new Vtiger_Field(); $fieldInstance->name = 'payment_balance'; $fieldInstance->table = 'vtiger_potential'; $fieldInstance->label = 'Payment balance'; $fieldInstance->column = 'payment_balance'; $fieldInstance->columntype = 'decimal(25,8)'; $fieldInstance->uitype = 7; $fieldInstance->typeofdata = 'NN~O'; $fieldInstance->displaytype = 2; $blockInstance->addField($fieldInstance); $this->addWorkflow($modulename); $this->addWorkflow('Invoice'); } 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') { // 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') { } } } } } } }
/** * 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'; $adb = PearDatabase::getInstance(); if ($eventType == 'module.postinstall') { include_once 'vtlib/Vtiger/Module.php'; $myCustomEntity = CRMEntity::getInstance($moduleName); $myCustomEntity->setModuleSeqNumber("configure", $moduleName, '', '1'); $adb->query("UPDATE vtiger_tab SET customized=0 WHERE name='{$moduleName}'"); $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker'); if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) { include_once 'vtlib/Vtiger/Module.php'; include_once 'modules/ModTracker/ModTracker.php'; $tabid = Vtiger_Functions::getModuleId($moduleName); $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabid)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1)); $moduleModTrackerInstance->updateCache($tabid, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid)); $moduleModTrackerInstance->updateCache($tabid, 1); } } } else { if ($eventType == 'module.readonly="readonly"') { // TODO Handle actions when this module is readonly="readonly". } 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') { } } } } } } }
/** * 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) { global $adb; if ($event_type == 'module.postinstall') { $ModuleInstance = CRMEntity::getInstance($modulename); $ModuleInstance->setModuleSeqNumber("configure", $modulename, 'LI', '1'); $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments'); if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) { include_once 'modules/ModComments/ModComments.php'; if (class_exists('ModComments')) { ModComments::addWidgetTo(array('LettersOut')); } } $Instance = Vtiger_Module::getInstance($modulename); $nModule = Vtiger_Module::getInstance('Accounts'); if ($nModule) { $nModule->setRelatedList($Instance, $modulename, array('add'), 'get_dependents_list'); } $nModule = Vtiger_Module::getInstance('Leads'); if ($nModule) { $nModule->setRelatedList($Instance, $modulename, array('add'), 'get_dependents_list'); } $nModule = Vtiger_Module::getInstance('OSSEmployees'); if ($nModule) { $nModule->setRelatedList($Instance, $modulename, array('add'), 'get_dependents_list'); } $nModule = Vtiger_Module::getInstance('Vendors'); if ($nModule) { $nModule->setRelatedList($Instance, $modulename, array('add'), 'get_dependents_list'); } $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker'); if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) { include_once 'vtlib/Vtiger/Module.php'; include_once 'modules/ModTracker/ModTracker.php'; $tabid = Vtiger_Functions::getModuleId($modulename); $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabid)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1)); $moduleModTrackerInstance->updateCache($tabid, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid)); $moduleModTrackerInstance->updateCache($tabid, 1); } if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) { $moduleInstance = Vtiger_Module::getInstance($tabid); $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted')); } } $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename)); $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersout', 'title')); $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersout', 'smownerid')); $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersout', 'lout_type_ship')); $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersout', 'lout_type_doc')); $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersout', 'date_adoption')); $adb->pquery('UPDATE vtiger_field SET summaryfield=1 WHERE tablename=? AND columnname=?', array('vtiger_lettersout', 'relatedid')); } 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') { // 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') { } } } } } } }
/** * 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 'include/events/include.inc'; $adb = PearDatabase::getInstance(); $registerLink = false; $addModTracker = false; $handlerClass = 'SECURE'; if ($eventType == 'module.postinstall') { } else { if ($eventType == 'module.disabled') { // TODO Handle actions when this module is disabled. $registerLink = false; $em = new VTEventsManager($adb); $em->setHandlerInActive($handlerClass); } else { if ($eventType == 'module.enabled') { // TODO Handle actions when this module is enabled. $registerLink = true; $em = new VTEventsManager($adb); $em->setHandlerActive($handlerClass); } else { if ($eventType == 'module.preuninstall') { // TODO Handle actions when this module is about to be deleted. $this->log->debug('Before starting uninstall script...'); require_once 'modules/Settings/' . $moduleName . '/views/uninstall.php'; $this->log->debug('After uninstall script.'); header('Location: index.php?module=Vtiger&parent=Settings&view=Index'); } else { if ($eventType == 'module.preupdate') { // TODO Handle actions before this module is updated. } else { if ($eventType == 'module.postupdate') { } } } } } } $displayLabel = 'OSSPassword Configuration'; if ($registerLink) { $blockid = $adb->query_result($adb->pquery("SELECT blockid FROM vtiger_settings_blocks WHERE label='LBL_OTHER_SETTINGS'", array()), 0, 'blockid'); $sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", array($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\t\tVALUES (?,?,?,?,?,?,?)", array($fieldid, $blockid, $sequence, $displayLabel, 'migrate.gif', 'LBL_OSSPASSWORD_CONFIGURATION_DESCRIPTION', 'index.php?module=OSSPasswords&view=ConfigurePass&parent=Settings')); } else { $adb->pquery("DELETE FROM vtiger_settings_field WHERE name=?", array($displayLabel)); } // register modtracker history updates if ($addModTracker) { $tabId = getTabid($moduleName); include_once 'modules/ModTracker/ModTracker.php'; $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabId)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabId, 1)); $moduleModTrackerInstance->updateCache($tabId, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabId)); $moduleModTrackerInstance->updateCache($tabId, 1); } if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabId)) { $moduleInstance = Vtiger_Module::getInstance($tabId); $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted')); } } }
/** * 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 'include/events/include.inc'; $adb = PearDatabase::getInstance(); $registerLink = false; $addModTracker = false; $handlerClass = 'SECURE'; if ($eventType == 'module.postinstall') { //Add OSSPasswords Module to Customer Portal require_once 'vtlib/Vtiger/Module.php'; // add default oss_passwords configuration $adb->pquery("INSERT INTO vtiger_passwords_config values(?,?,?,?)", array('10', '15', 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9', '0')); // adds record prefix $myCustomEntity = new CRMEntity(); $myCustomPrefix = "PASS"; // Your custom prefix string for the custom module $sequenceStart = 1; // The starting sequence number $myCustomEntity->setModuleSeqNumber("configure", $moduleName, $myCustomPrefix, $sequenceStart); $registerLink = true; $addModTracker = true; // handler for obscuring password data in "update history" $em = new VTEventsManager($adb); $em->registerHandler('vtiger.entity.aftersave.final', 'modules/OSSPasswords/handlers/secure.php', $handlerClass); // Module icon copy('modules/OSSPasswords/OSSPasswords.png', 'layouts/vlayout/skins/images/OSSPasswords.png'); // block export of module $sql = "UPDATE vtiger_tab SET customized=0 WHERE name='{$moduleName}' LIMIT 1;"; $adb->query($sql, true); } else { if ($eventType == 'module.disabled') { // TODO Handle actions when this module is disabled. $registerLink = false; $em = new VTEventsManager($adb); $em->setHandlerInActive($handlerClass); } else { if ($eventType == 'module.enabled') { // TODO Handle actions when this module is enabled. $registerLink = true; $em = new VTEventsManager($adb); $em->setHandlerActive($handlerClass); } else { if ($eventType == 'module.preuninstall') { // TODO Handle actions when this module is about to be deleted. $this->log->debug('Before starting uninstall script...'); require_once 'modules/Settings/' . $moduleName . '/views/uninstall.php'; $this->log->debug('After uninstall script.'); header('Location: index.php?module=Vtiger&parent=Settings&view=Index'); } else { if ($eventType == 'module.preupdate') { // TODO Handle actions before this module is updated. } else { if ($eventType == 'module.postupdate') { } } } } } } $displayLabel = 'OSSPassword Configuration'; if ($registerLink) { $blockid = $adb->query_result($adb->pquery("SELECT blockid FROM vtiger_settings_blocks WHERE label='LBL_OTHER_SETTINGS'", array()), 0, 'blockid'); $sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", array($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\t\tVALUES (?,?,?,?,?,?,?)", array($fieldid, $blockid, $sequence, $displayLabel, 'migrate.gif', 'LBL_OSSPASSWORD_CONFIGURATION_DESCRIPTION', 'index.php?module=OSSPasswords&view=ConfigurePass&parent=Settings')); } else { $adb->pquery("DELETE FROM vtiger_settings_field WHERE name=?", array($displayLabel)); } // register modtracker history updates if ($addModTracker) { $tabId = getTabid($moduleName); include_once 'modules/ModTracker/ModTracker.php'; $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabId)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabId, 1)); $moduleModTrackerInstance->updateCache($tabId, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabId)); $moduleModTrackerInstance->updateCache($tabId, 1); } if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabId)) { $moduleInstance = Vtiger_Module::getInstance($tabId); $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted')); } } }
public function databaseData() { global $log, $adb; $log->debug("Entering YetiForceUpdate::databaseData() method ..."); $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE linklabel = ?", array('LIST_OF_LAST_UPDATED_RECORD')); if ($adb->num_rows($result) == 0) { $instanceModule = Vtiger_Module::getInstance('Home'); $instanceModule->addLink('DASHBOARDWIDGET', 'LIST_OF_LAST_UPDATED_RECORD', 'index.php?module=Home&view=ShowWidget&name=ListUpdatedRecord'); } $result = $adb->query("SELECT MAX(blockid) AS id FROM vtiger_settings_blocks"); $adb->pquery("UPDATE vtiger_settings_blocks_seq SET `id` = ?", array($adb->query_result($result, 0, 'id'))); $result = $adb->pquery("SELECT * FROM `vtiger_settings_blocks` WHERE `label` = ? ", array('LBL_PROCESSES')); if ($adb->num_rows($result) == 0) { $blockid = $adb->getUniqueId("vtiger_settings_blocks"); $adb->pquery("insert into `vtiger_settings_blocks`(`blockid`,`label`,`sequence`) values (?,?,?);", array($blockid, 'LBL_PROCESSES', 9)); $result = $adb->query("SELECT MAX(blockid) AS id FROM vtiger_settings_blocks"); $result = $adb->pquery("UPDATE vtiger_settings_blocks_seq SET `id` = ?", array($adb->query_result($result, 0, 'id'))); } $adb->pquery("UPDATE `vtiger_modentity_num` SET `cur_id` = ? WHERE `semodule` = ? ;", array(1, 'Products')); $result = $adb->pquery("SELECT * FROM `vtiger_ossmailtemplates` WHERE name = ? AND oss_module_list = ? ", array('Customer Portal Login Details', 'Contacts')); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_ossmailtemplates` SET `content` = ? WHERE name = ? AND oss_module_list = ? ;", array('<p>#s#LogoImage#sEnd# </p><p>Dear #a#67#aEnd# #a#70#aEnd#</p><p>Created for your account in the customer portal, below sending data access.</p><p>Login: #a#80#aEnd#<br />Password: #s#ContactsPortalPass#sEnd#</p><p>Regards</p>', 'Customer Portal Login Details', 'Contacts')); } $result = $adb->pquery("SELECT * FROM `vtiger_ossmailtemplates` WHERE name = ? AND oss_module_list = ? ", array('Customer Portal - ForgotPassword', 'Contacts')); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_ossmailtemplates` SET `content` = ? WHERE name = ? AND oss_module_list = ? ;", array('Dear #a#67#aEnd# #a#70#aEnd#,<br /><br /> You recently requested a reminder of your access data for the YetiForce Portal.<br /><br /> You can login by entering the following data:<br /><br /> Your username: #a#80#aEnd#<br /> Your password: #s#ContactsPortalPass#sEnd#<br /><br /><br /> Regards,<br /> YetiForce CRM Support Team.', 'Customer Portal - ForgotPassword', 'Contacts')); } $adb->pquery("UPDATE `vtiger_ossmenumanager` SET `label` = ?, `langfield` = ? WHERE `label` = ? ;", array('Teamwork', 'en_us*Teamwork#pl_pl*Praca grupowa', 'Group Card')); $adb->pquery("UPDATE `vtiger_osspdf` SET `footer_content` = ? WHERE `title` = ? AND `moduleid` = ?;", array('<title></title> <table width="537px"> <tbody> <tr> <td colspan="6" rowspan="2"><img src="#special_function#siteUrl#end_special_function#storage/Logo/logo_yetiforce.png" style="width: 200px;" width="200" /></td> <td colspan="4"><span style="font-size:6px;">#company_organizationname# #company_address# #company_code# #company_city#. VAT:#company_vatid#</span></td> </tr> <tr> <td colspan="5"> <table border="1"> <tbody> <tr> <td> <table cellpadding="1"> <tbody> <tr> <td style="text-align: center;"><span style="font-size:9px;">Calculation confirmation: <strong>#calculations_no#</strong></span></td> </tr> </tbody> </table> </td> </tr> <tr> <td> <table cellpadding="1"> <tbody> <tr> <td style="text-align: center;"><span style="font-size:9px;">Date: #special_function#CreatedDateTime#end_special_function#</span></td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> <tr> <td colspan="7"> </td> <td colspan="5" rowspan="2"> <table border="1"> <tbody> <tr> <td> <table cellpadding="5"> <tbody> <tr> <td> <table cellpadding="0" style="font-size:8px;"> <tbody> <tr> <td colspan="2">Issued by:</td> <td colspan="3">#Users_first_name# #Users_last_name#</td> </tr> <tr> <td colspan="2">Email:</td> <td colspan="3">#Users_email1#</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> <tr> <td colspan="3"> <table> <tbody> <tr> <td><span style="font-size:10px;"> <span style="font-size:8px;">#Accounts_account_no#</span></span></td> </tr> <tr> <td> <table> <tbody> <tr> <td> <p><span style="font-size:10px;">#Accounts_accountname#<br /> <span style="font-size:8px;">#Accounts_addresslevel8b# #Accounts_buildingnumberb# #Accounts_localnumberb#<br /> #Accounts_addresslevel7b#, #Accounts_addresslevel5b#<br /> <span style="font-size:10px;">#Accounts_addresslevel1b#</span><br /> #Accounts_vat_id#<br /> #Contacts_email#</span></span></p> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> <td colspan="3"> </td> </tr> </tbody> </table> <table> <tbody> <tr> <td> </td> </tr> <tr> <td>#special_function#replaceProductTable#end_special_function#</td> </tr> </tbody> </table>', 'Calculation PDF', getTabid('Calculations'))); $this->addWorkflow(); $this->addRecords(); $this->settingsReplace(); $result = $adb->pquery("SELECT * FROM `vtiger_payment_duration` WHERE payment_duration = ?", array('payment:+0 days')); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_payment_duration` SET `payment_duration` = ? WHERE `payment_duration` = ? ;", array('payment:+0 day', 'payment:+0 days')); $adb->pquery("UPDATE `vtiger_invoice_recurring_info` SET `payment_duration` = ? WHERE `payment_duration` = ? ;", array('payment:+0 day', 'payment:+0 days')); } $this->picklists(); $adb->pquery("UPDATE `vtiger_blocks` SET `display_status` = ? WHERE `tabid` = ? AND `blocklabel` = ? ;", array(0, getTabid('OSSTimeControl'), 'LBL_BLOCK')); $adb->query("ALTER TABLE `vtiger_notes` CHANGE `title` `title` varchar(200) NOT NULL after `note_no` ;"); $adb->pquery("UPDATE `vtiger_field` SET `uitype` = ? WHERE `columnname` = ? AND `tablename` = ? ;", array(14, 'time_start', 'vtiger_osstimecontrol')); $adb->pquery("UPDATE `vtiger_field` SET `uitype` = ? WHERE `columnname` = ? AND `tablename` = ? ;", array(14, 'time_end', 'vtiger_osstimecontrol')); $result = $adb->pquery("SELECT * FROM `vtiger_salesprocesses_settings`; "); if ($adb->num_rows($result) == 0) { $adb->pquery('insert into `vtiger_salesprocesses_settings`(`id`,`products_rel_potentials`) values (1,1);'); } $adb->pquery("UPDATE `vtiger_field` SET `displaytype` = ? WHERE `columnname` = ? AND `tablename` = ? ;", array(1, 'product_id', 'vtiger_troubletickets')); $fieldsToDelete = array('OSSTimeControl' => array('payment', 'contactid'), 'Calculations' => array('parentid'), 'Assets' => array('contact'), 'OutsourcedProducts' => array('contact'), 'OSSOutsourcedServices' => array('contact'), 'OSSSoldServices' => array('contact'), 'Invoice' => array('contact_id'), 'PurchaseOrder' => array('contact_id'), 'SalesOrder' => array('contact_id'), 'Quotes' => array('contact_id'), 'HelpDesk' => array('contact_id'), 'PaymentsIn' => array('parentid')); self::deleteFields($fieldsToDelete); self::addFields(); $result = $adb->query("SHOW TABLES LIKE 'vtiger_calendar_config';"); if ($adb->num_rows($result) == 1) { $result = $adb->pquery("SELECT * FROM `vtiger_calendar_config` ;"); if ($adb->num_rows($result) == 0) { $adb->query("insert into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values ('colors','break','PLL_BREAK_TIME','#ffd000');"); $adb->query("insert into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values ('colors','holiday','PLL_HOLIDAY_TIME','#00d4f5');"); } } $adb->pquery("UPDATE `vtiger_entityname` SET `searchcolumn` = ? WHERE `modulename` IN (?,?,?);", array('subject', 'RequirementCards', 'QuotesEnquires', 'Ideas')); $adb->pquery("UPDATE `vtiger_entityname` SET `searchcolumn` = ?, fieldname = ? WHERE `modulename` = ?;", array('holidaysentitlement_year,ossemployeesid', 'holidaysentitlement_year', 'HolidaysEntitlement')); $result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('parentid', 'vtiger_contactdetails')); $result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", array($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') . ",'Contacts','Vendors');"); } $result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('potentialid', 'vtiger_quotesenquires')); $result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", array($adb->query_result($result1, 0, 'fieldid'), 'Potentials')); if ($adb->num_rows($result2) == 0) { $adb->query("insert into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`) values (" . $adb->query_result($result1, 0, 'fieldid') . ",'QuotesEnquires','Potentials');"); } $result = $adb->pquery("SELECT * FROM `vtiger_calendar_config` WHERE type = ? ;", array('reminder')); if ($adb->num_rows($result) == 0) { $adb->pquery("insert into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values (?,?,?,?);", array('reminder', 'update_event', 'LBL_UPDATE_EVENT', '0')); } $result = $adb->pquery("SELECT * FROM `vtiger_calendar_config` WHERE type = ? AND `name` = ?;", array('colors', 'work')); if ($adb->num_rows($result) == 0) { $adb->pquery("insert into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values (?,?,?,?);", array('colors', 'work', 'PLL_WORKING_TIME', '#FFD500')); } $result = $adb->pquery("SELECT * FROM `vtiger_calendar_config` WHERE type = ? AND `name` = ?;", array('colors', 'Task')); if ($adb->num_rows($result) == 0) { $adb->pquery("insert into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values (?,?,?,?);", array('colors', 'Task', 'Task', '#00d4f5')); } $result = $adb->pquery("SELECT * FROM `vtiger_calendar_config` WHERE type = ? AND `name` = ?;", array('colors', 'Meeting')); if ($adb->num_rows($result) == 0) { $adb->pquery("insert into `vtiger_calendar_config`(`type`,`name`,`label`,`value`) values (?,?,?,?);", array('colors', 'Meeting', 'Meeting', '#FFD500')); } // related list $adb->pquery("UPDATE `vtiger_relatedlists` SET label = ? WHERE related_tabid = ? AND name = ? AND label = ?;", array('Upcoming Activities', getTabid('Calendar'), 'get_activities', 'Activities')); $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Accounts'), getTabid('OSSMailView'), 'get_related_list', 'OSSMailView', 7)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(8, getTabid('Accounts'), getTabid('OSSMailView'), 'get_related_list', 'OSSMailView')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `actions` = ?;", array(getTabid('Accounts'), getTabid('Calendar'), 'get_history', 'Activity History', 'add')); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ?, `actions` = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(7, '', getTabid('Accounts'), getTabid('Calendar'), 'get_history', 'Activity History')); } // $adb->pquery("UPDATE `vtiger_relatedlists` SET actions = ? WHERE related_tabid = ? AND name = ? AND label = ?;", array('', getTabid('Calendar'), 'get_history', 'Activity History')); $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Contacts'), getTabid('OSSMailView'), 'get_related_list', 'OSSMailView', 3)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(9, getTabid('Contacts'), getTabid('OSSMailView'), 'get_related_list', 'OSSMailView')); } // $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Contacts'), getTabid('Calendar'), 'get_history', 'Activity History', 9)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(3, getTabid('Contacts'), getTabid('Calendar'), 'get_history', 'Activity History')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Potentials'), getTabid('Contacts'), 'get_contacts', 'Contacts', 2)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(8, getTabid('Potentials'), getTabid('Contacts'), 'get_contacts', 'Contacts')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Potentials'), getTabid('Calendar'), 'get_history', 'Activity History', 8)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(2, getTabid('Potentials'), getTabid('Calendar'), 'get_history', 'Activity History')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('HelpDesk'), getTabid('Documents'), 'get_attachments', 'Documents', 2)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(4, getTabid('HelpDesk'), getTabid('Documents'), 'get_attachments', 'Documents')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('HelpDesk'), getTabid('Calendar'), 'get_history', 'Activity History', 4)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(2, getTabid('HelpDesk'), getTabid('Calendar'), 'get_history', 'Activity History')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Quotes'), getTabid('Documents'), 'get_attachments', 'Documents', 3)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(4, getTabid('Quotes'), getTabid('Documents'), 'get_attachments', 'Documents')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Quotes'), getTabid('Calendar'), 'get_history', 'Activity History', 4)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(3, getTabid('Quotes'), getTabid('Calendar'), 'get_history', 'Activity History')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('PurchaseOrder'), getTabid('Documents'), 'get_attachments', 'Documents', 2)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(3, getTabid('PurchaseOrder'), getTabid('Documents'), 'get_attachments', 'Documents')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('PurchaseOrder'), getTabid('Calendar'), 'get_history', 'Activity History', 3)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(2, getTabid('PurchaseOrder'), getTabid('Calendar'), 'get_history', 'Activity History')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('SalesOrder'), getTabid('Documents'), 'get_attachments', 'Documents', 2)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(4, getTabid('SalesOrder'), getTabid('Documents'), 'get_attachments', 'Documents')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('SalesOrder'), getTabid('Calendar'), 'get_history', 'Activity History', 4)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(2, getTabid('SalesOrder'), getTabid('Calendar'), 'get_history', 'Activity History')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Invoice'), getTabid('Documents'), 'get_attachments', 'Documents', 2)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(3, getTabid('Invoice'), getTabid('Documents'), 'get_attachments', 'Documents')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Invoice'), getTabid('Calendar'), 'get_history', 'Activity History', 3)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(2, getTabid('Invoice'), getTabid('Calendar'), 'get_history', 'Activity History')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Campaigns'), getTabid('Accounts'), 'get_accounts', 'Accounts', 5)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(6, getTabid('Campaigns'), getTabid('Accounts'), 'get_accounts', 'Accounts')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('ServiceContracts'), getTabid('HelpDesk'), 'get_dependents_list', 'HelpDesk', 2)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(4, getTabid('ServiceContracts'), getTabid('HelpDesk'), 'get_dependents_list', 'HelpDesk')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Project'), getTabid('HelpDesk'), 'get_dependents_list', 'HelpDesk', 6)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(5, getTabid('Project'), getTabid('HelpDesk'), 'get_dependents_list', 'HelpDesk')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Project'), 0, 'get_gantt_chart', 'Charts', 5)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(1, getTabid('Project'), 0, 'get_gantt_chart', 'Charts')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ? AND `sequence` = ?;", array(getTabid('Project'), getTabid('Calendar'), 'get_activities', 'Upcoming Activities', 1)); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(6, getTabid('Project'), getTabid('Calendar'), 'get_activities', 'Upcoming Activities')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('Campaigns'), getTabid('Calendar'), 'get_history', 'Activity History')); if ($adb->num_rows($result) == 0) { $targetModule = Vtiger_Module::getInstance('Campaigns'); $moduleInstance = Vtiger_Module::getInstance('Calendar'); $targetModule->setRelatedList($moduleInstance, 'Activity History', array(), 'get_history'); $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(5, getTabid('Campaigns'), getTabid('Calendar'), 'get_history', 'Activity History')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('Project'), getTabid('Calendar'), 'get_history', 'Activity History')); if ($adb->num_rows($result) == 0) { $targetModule = Vtiger_Module::getInstance('Project'); $moduleInstance = Vtiger_Module::getInstance('Calendar'); $targetModule->setRelatedList($moduleInstance, 'Activity History', array(), 'get_history'); $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(7, getTabid('Project'), getTabid('Calendar'), 'get_history', 'Activity History')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('ServiceContracts'), getTabid('Calendar'), 'get_history', 'Activity History')); if ($adb->num_rows($result) == 0) { $targetModule = Vtiger_Module::getInstance('ServiceContracts'); $moduleInstance = Vtiger_Module::getInstance('Calendar'); $targetModule->setRelatedList($moduleInstance, 'Activity History', array(), 'get_history'); $adb->pquery("UPDATE `vtiger_relatedlists` SET sequence = ? WHERE tabid = ? AND related_tabid = ? AND `name` = ? AND label = ?;", array(2, getTabid('ServiceContracts'), getTabid('Calendar'), 'get_history', 'Activity History')); } $result = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('RequirementCards', 'Quotes')); if ($adb->num_rows($result) == 1) { $adb->pquery("DELETE FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('RequirementCards', 'Quotes')); } $result = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('Calculations', 'Quotes')); if ($adb->num_rows($result) == 1) { $adb->pquery("DELETE FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('Calculations', 'Quotes')); } $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND `name` = ?", array(getTabid('Quotes'), getTabid('Calculations'), 'get_dependents_list')); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_relatedlists` SET `name` = ? WHERE `tabid` = ? AND `related_tabid` = ? AND `name` = ?;", array('get_related_list', getTabid('Quotes'), getTabid('Calculations'), 'get_dependents_list')); } /*$result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('OSSEmployees'),getTabid('HolidaysEntitlement'),'get_dependents_list','HolidaysEntitlement')); if($adb->num_rows($result) == 0){ $targetModule = Vtiger_Module::getInstance('OSSEmployees'); $moduleInstance = Vtiger_Module::getInstance('HolidaysEntitlement'); $targetModule->setRelatedList($moduleInstance, 'HolidaysEntitlement', array('ADD'),'get_dependents_list'); }*/ /*$result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ? AND label = ?;", array(getTabid('Accounts'),getTabid('RequirementCards'),'get_dependents_list','RequirementCards')); if($adb->num_rows($result) == 0){ $targetModule = Vtiger_Module::getInstance('Accounts'); $moduleInstance = Vtiger_Module::getInstance('RequirementCards'); $targetModule->setRelatedList($moduleInstance, 'RequirementCards', array('ADD'),'get_dependents_list'); }*/ $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('Calculations'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget')); if ($adb->num_rows($result) == 0) { $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments'); if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) { include_once 'modules/ModComments/ModComments.php'; if (class_exists('ModComments')) { ModComments::addWidgetTo(array('Calculations')); } } } $modulename = 'Calculations'; $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker'); if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) { include_once 'vtlib/Vtiger/Module.php'; include_once 'modules/ModTracker/ModTracker.php'; $tabid = Vtiger_Functions::getModuleId($modulename); $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabid)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1)); $moduleModTrackerInstance->updateCache($tabid, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid)); $moduleModTrackerInstance->updateCache($tabid, 1); } if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) { $moduleInstance = Vtiger_Module::getInstance($tabid); $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted')); } } $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('Quotes'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget')); if ($adb->num_rows($result) == 0) { $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments'); if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) { include_once 'modules/ModComments/ModComments.php'; if (class_exists('ModComments')) { ModComments::addWidgetTo(array('Quotes')); } } } $modulename = 'Quotes'; $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker'); if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) { include_once 'vtlib/Vtiger/Module.php'; include_once 'modules/ModTracker/ModTracker.php'; $tabid = Vtiger_Functions::getModuleId($modulename); $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabid)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1)); $moduleModTrackerInstance->updateCache($tabid, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid)); $moduleModTrackerInstance->updateCache($tabid, 1); } if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) { $moduleInstance = Vtiger_Module::getInstance($tabid); $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted')); } } $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('SalesOrder'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget')); if ($adb->num_rows($result) == 0) { $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments'); if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) { include_once 'modules/ModComments/ModComments.php'; if (class_exists('ModComments')) { ModComments::addWidgetTo(array('SalesOrder')); } } } $modulename = 'SalesOrder'; $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker'); if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) { include_once 'vtlib/Vtiger/Module.php'; include_once 'modules/ModTracker/ModTracker.php'; $tabid = Vtiger_Functions::getModuleId($modulename); $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabid)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1)); $moduleModTrackerInstance->updateCache($tabid, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid)); $moduleModTrackerInstance->updateCache($tabid, 1); } /*if(!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)){ $moduleInstance=Vtiger_Module::getInstance($tabid); $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')",'','', array('path'=>'modules/ModTracker/ModTracker.php','class'=>'ModTracker','method'=>'isViewPermitted')); }*/ } $result = $adb->pquery("SELECT * FROM `vtiger_cron_task` WHERE name = ? ;", array('CardDav')); if ($adb->num_rows($result) == 0) { $addCrons = array(); $addCrons[] = array('CardDav', 'modules/API/cron/CardDav.php', 300, NULL, NULL, 1, 'Contacts', 12, NULL); foreach ($addCrons as $cron) { Vtiger_Cron::register($cron[0], $cron[1], $cron[2], $cron[6], $cron[5], 0, $cron[8]); } } $result = $adb->pquery("SELECT * FROM `vtiger_eventhandlers` WHERE event_name = ? AND handler_class = ?;", array('vtiger.entity.aftersave.final', 'API_CardDAV_Handler')); if ($adb->num_rows($result) == 0) { $addHandler[] = array('vtiger.entity.aftersave.final', 'modules/API/handlers/CardDAV.php', 'API_CardDAV_Handler', '', 1, '[]'); $em = new VTEventsManager($adb); foreach ($addHandler as $handler) { $em->registerHandler($handler[0], $handler[1], $handler[2], $handler[3], $handler[5]); } } /*$modules = array('RequirementCards','QuotesEnquires'); foreach($modules as $module){ $moduleInstance = Vtiger_Module::getInstance($module); $refInstance = Vtiger_Module::getInstance('OSSMailView'); if($moduleInstance && $refInstance){ $moduleInstance->unsetRelatedList($refInstance,"OSSMailView",'get_related_list'); } }*/ $result = $adb->pquery("SELECT * FROM `vtiger_dataaccess` WHERE summary = ?;", array('Date vatidation')); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_dataaccess` SET `summary` = ? WHERE `summary` = ? ;", array('Date validation', 'Date vatidation')); } $result = $adb->pquery("SELECT * FROM `vtiger_dataaccess` WHERE summary = ?;", array('Checking whether all mandatory fields in quick edit are filled in')); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_dataaccess` SET `summary` = ? WHERE `summary` = ? ;", array('Check whether all mandatory fields in quick edit are filled in', 'Checking whether all mandatory fields in quick edit are filled in')); } $result = $adb->pquery("SELECT * FROM `vtiger_cron_task` WHERE name = ? ;", array('CalDav')); if ($adb->num_rows($result) == 0) { $addCrons = array(); $addCrons[] = array('CalDav', 'modules/API/cron/CalDav.php', 300, NULL, NULL, 1, 'Calendar', 13, NULL); foreach ($addCrons as $cron) { Vtiger_Cron::register($cron[0], $cron[1], $cron[2], $cron[6], $cron[5], 0, $cron[8]); } } $result = $adb->pquery("SELECT * FROM `vtiger_eventhandlers` WHERE event_name = ? AND handler_class = ?;", array('vtiger.entity.aftersave.final', 'API_CalDAV_Handler')); if ($adb->num_rows($result) == 0) { $addHandler[] = array('vtiger.entity.aftersave.final', 'modules/API/handlers/CalDAV.php', 'API_CalDAV_Handler', NULL, 1, '[]'); $em = new VTEventsManager($adb); foreach ($addHandler as $handler) { $em->registerHandler($handler[0], $handler[1], $handler[2], $handler[3], $handler[5]); } } $adb->pquery("UPDATE `vtiger_field` SET `defaultvalue` = '' WHERE `columnname` = ? AND `defaultvalue` = ?;", array('eventstatus', 'Planned')); $result = $adb->pquery("SELECT * FROM `vtiger_taskstatus` WHERE taskstatus = ?;", array('Planned')); if ($adb->num_rows($result) == 1) { $adb->pquery("UPDATE `vtiger_taskstatus` SET `taskstatus` = ? WHERE `taskstatus` = ?;", array('Cancelled', 'Planned')); //$adb->pquery("UPDATE `vtiger_activity` SET `status` = ? WHERE `status` = ?;", array('Cancelled', 'Planned')); } $adb->pquery("UPDATE `vtiger_users` SET `defaulteventstatus` = ? WHERE `defaulteventstatus` = ?;", array('Not Held', 'Planned')); // change relations $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('OSSPasswords', 'Leads'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Leads'), getTabid('OSSPasswords'), 'OSSPasswords'), true); $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('PBXManager', 'Leads'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Leads'), getTabid('PBXManager'), 'PBXManager'), true); $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('PaymentsIn', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('PaymentsIn'), 'PaymentsIn'), true); $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('PaymentsOut', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('PaymentsOut'), 'PaymentsOut'), true); $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('OSSCosts', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('OSSCosts'), 'OSSCosts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('Calculations'), 'Calculations'), true); $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('OSSPasswords', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('OSSPasswords'), 'OSSPasswords'), true); // Related Products of contact $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('Products'), 'Products'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Products'), getTabid('Contacts'), 'Contacts'), true); ////// Related Assets of contact $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('Assets', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('Assets'), 'Assets'), true); ////// Related OutsourcedProducts of contact $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('OutsourcedProducts', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('OutsourcedProducts'), 'OutsourcedProducts'), true); ////// Related Services of contact $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('Services'), 'Services'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Services'), getTabid('Contacts'), 'Contacts'), true); ////// Related OSSOutsourcedServices of contact $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('OSSOutsourcedServices', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('OSSOutsourcedServices'), 'OSSOutsourcedServices'), true); ////// Related OSSSoldServices of contact $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('OSSSoldServices', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('OSSSoldServices'), 'OSSSoldServices'), true); ////// Related Vendors of contact $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('Vendors'), 'Vendors'), true); ////// Related OSSTimeControl of contact $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('OSSSoldServices', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('OSSTimeControl'), 'OSSTimeControl'), true); ////// Related Projects of contact $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('Project', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('Project'), 'Projects'), true); ////// Related ServiceContracts of contact $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('ServiceContracts', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('ServiceContracts'), 'Service Contracts'), true); ////// Related PBXManager of contact $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('PBXManager', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('PBXManager'), 'PBXManager'), true); ////// Related Invoices of contact $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('Invoice'), 'Invoice'), true); ////// Related Contacts of Campaigns ect. $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('Campaigns'), 'Campaigns'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Campaigns'), getTabid('Contacts'), 'Contacts'), true); ////// Related PurchaseOrder of contact $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('PurchaseOrder'), 'Purchase Order'), true); ////// Related SalesOrder of contact $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('SalesOrder'), 'Sales Order'), true); ////// Related Quotes of contact $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('Quotes'), 'Quotes'), true); ////// Related HelpDesk of contact $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('HelpDesk', 'Contacts'), true); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Contacts'), getTabid('HelpDesk'), 'HelpDesk'), true); $adb->pquery("UPDATE `vtiger_field` SET `uitype` = ? WHERE `uitype` = ? AND columnname = ? AND tablename = ?;", array(1, '16', 'name', 'vtiger_osstimecontrol')); $result = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('ModComments', 'Reservations')); if ($adb->num_rows($result) == 0) { $result = $adb->pquery("SELECT * FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('related_to', 'vtiger_modcomments')); $fieldId = $adb->query_result($result, 0, 'fieldid'); $adb->pquery("INSERT INTO vtiger_fieldmodulerel(fieldid, module, relmodule) VALUES(?,?,?)", array($fieldId, 'ModComments', 'Reservations')); } $result = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = ? AND relmodule = ?", array('ModComments', 'SalesOrder')); if ($adb->num_rows($result) == 0) { $result = $adb->pquery("SELECT * FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('related_to', 'vtiger_modcomments')); $fieldId = $adb->query_result($result, 0, 'fieldid'); $adb->pquery("INSERT INTO vtiger_fieldmodulerel(fieldid, module, relmodule) VALUES(?,?,?)", array($fieldId, 'ModComments', 'SalesOrder')); } $result = $adb->pquery("SELECT * FROM `vtiger_trees_templates` WHERE name = ?;", array('Reservations')); if ($adb->num_rows($result) == 0) { $sql = 'INSERT INTO vtiger_trees_templates(`name`, `module`, `access`) VALUES (?,?,?)'; $params = array('Reservations', getTabid('Reservations'), 0); $adb->pquery($sql, $params); $templateId = $adb->getLastInsertID(); $recordModel = new Settings_TreesManager_Record_Model(); $recordModel->set('name', 'Reservations'); $recordModel->set('module', getTabid('Reservations')); $recordModel->set('templateid', $templateId); $recordModel->set('tree', array(array('data' => 'LBL_MEETING_ROOMS', 'attr' => array('id' => 3), 'state' => NULL), array('data' => 'LBL_EQUIPMENT', 'attr' => array('id' => 2), 'state' => NULL), array('data' => 'LBL_CARS', 'attr' => array('id' => 1), 'state' => NULL))); $recordModel->save(); $adb->pquery("UPDATE `vtiger_field` SET `fieldparams` = ? WHERE `columnname` = ? AND `tablename` = ?;", array($templateId, 'type', 'vtiger_reservations')); } $result = $adb->pquery("SELECT * FROM `vtiger_widgets` WHERE tabid = ? AND `type` = ? ;", array(getTabid('Reservations'), 'Summary')); if ($adb->num_rows($result) == 0) { $widget = array('Reservations', 'Summary', NULL, '1', '0', NULL, '[]'); $sql = "INSERT INTO vtiger_widgets (tabid, type, label, wcol, sequence, nomargin, data) VALUES (?, ?, ?, ?, ?, ?, ?);"; $adb->pquery($sql, array(getTabid($widget[0]), $widget[1], $widget[2], $widget[3], $widget[4], $widget[5], $widget[6])); } $result = $adb->pquery("SELECT * FROM `vtiger_widgets` WHERE tabid = ? AND `type` = ? ;", array(getTabid('Reservations'), 'Comments')); if ($adb->num_rows($result) == 0) { $widget = array('Reservations', 'Comments', '', '2', '1', NULL, '{"relatedmodule":"ModComments","limit":"10"}'); $sql = "INSERT INTO vtiger_widgets (tabid, type, label, wcol, sequence, nomargin, data) VALUES (?, ?, ?, ?, ?, ?, ?);"; $adb->pquery($sql, array(getTabid($widget[0]), $widget[1], $widget[2], $widget[3], $widget[4], $widget[5], $widget[6])); } $picklist_names = array('servicecategory', 'pscategory'); foreach ($picklist_names as $picklist_name) { $select = $adb->query("select picklistid from vtiger_picklist where name = '{$picklist_name}'"); if ($adb->num_rows($select) == 1) { $picklistid = $adb->query_result($select, 0, "picklistid"); $delete_from = $adb->query("delete from vtiger_role2picklist where picklistid = '{$picklistid}'"); $delete_from = $adb->query("delete from vtiger_picklist where name = '{$picklist_name}'"); } } $result = $adb->query("SELECT vtiger_def_org_field.tabid,vtiger_def_org_field.fieldid FROM `vtiger_def_org_field` WHERE fieldid NOT IN (SELECT fieldid FROM `vtiger_field`)"); $num = $adb->num_rows($result); $deleteField = array(); for ($i = 0; $i < $num; $i++) { $deleteField[] = $adb->query_result($result, $i, "fieldid"); } $adb->pquery("delete from vtiger_def_org_field where fieldid in (" . generateQuestionMarks($deleteField) . ")", array($deleteField)); $result = $adb->query("SELECT vtiger_profile2field.tabid,vtiger_profile2field.fieldid FROM `vtiger_profile2field` WHERE fieldid NOT IN (SELECT fieldid FROM `vtiger_field`)"); $num = $adb->num_rows($result); $deleteField = array(); for ($i = 0; $i < $num; $i++) { $deleteField[] = $adb->query_result($result, $i, "fieldid"); } $adb->pquery("delete from vtiger_profile2field where fieldid in (" . generateQuestionMarks($deleteField) . ")", array($deleteField)); $result = $adb->query("SELECT vtiger_fieldmodulerel.fieldid FROM `vtiger_fieldmodulerel` WHERE vtiger_fieldmodulerel.fieldid NOT IN (SELECT fieldid FROM `vtiger_field`)"); $num = $adb->num_rows($result); $deleteField = array(); for ($i = 0; $i < $num; $i++) { $deleteField[] = $adb->query_result($result, $i, "fieldid"); } $adb->pquery("delete from vtiger_fieldmodulerel where fieldid in (" . generateQuestionMarks($deleteField) . ")", $deleteField); $adb->query("UPDATE vtiger_field set helpinfo = '' "); $result = $adb->pquery("SELECT vtiger_field.fieldid FROM `vtiger_field` WHERE tabid = ? AND columnname = ? ", array(getTabid('OSSMailTemplates'), 'oss_module_list')); $num = $adb->num_rows($result); if ($num == 1) { $fieldId = $adb->query_result($result, 0, "fieldid"); $result = $adb->pquery("SELECT * FROM `vtiger_def_org_field` WHERE fieldid = ? ", array($fieldId)); $num = $adb->num_rows($result); if ($num == 0) { $insertQuery = 'INSERT INTO vtiger_def_org_field VALUES(?,?,?,?)'; $adb->pquery($insertQuery, array(getTabid('OSSMailTemplates'), $fieldId, 0, 0)); } $result = $adb->pquery("SELECT * FROM `vtiger_profile2field` WHERE fieldid = ? ", array($fieldId)); $num = $adb->num_rows($result); if ($num == 0) { $result = $adb->pquery("SELECT profileid FROM `vtiger_profile` "); $num = $adb->num_rows($result); for ($i = 0; $i < $num; $i++) { $profileId = $adb->query_result($result, $i, "profileid"); $sql = 'INSERT INTO vtiger_profile2field(profileid, tabid, fieldid, visible, readonly) VALUES (?,?,?,?,?)'; $params = array($profileId, getTabid('OSSMailTemplates'), $fieldId, 0, 0); $adb->pquery($sql, $params); } } } $adb->query("delete from vtiger_role2picklist where roleid = 'H1'"); $adb->pquery("UPDATE vtiger_profile2utility set permission = ? WHERE tabid = ? ", array(1, getTabid('PaymentsOut'))); // menu $result = $adb->pquery("SELECT * FROM `vtiger_ossmenumanager` WHERE label = ? ", array('AddressLevel1')); $num = $adb->num_rows($result); if ($num == 1) { $id = $adb->query_result($result, 0, "id"); $recordModel = Vtiger_Record_Model::getCleanInstance('OSSMenuManager'); $recordModel->deleteMenu($id); } $modules = array(getTabid('QuotesEnquires'), getTabid('LettersOut'), getTabid('LettersIn'), getTabid('PaymentsOut'), getTabid('OSSPasswords'), getTabid('RequirementCards'), getTabid('Quotes'), getTabid('OSSMailView')); $adb->pquery("UPDATE `vtiger_links` set handler_path = 'modules/ModTracker/ModTracker.php', handler_class = 'ModTracker', handler = 'isViewPermitted' WHERE linklabel = 'View History' AND tabid IN (" . generateQuestionMarks($modules) . ") ", $modules); $log->debug("Exiting YetiForceUpdate::databaseData() method ..."); $adb->query('ALTER TABLE roundcube_identities CHANGE `signature` `signature` LONGTEXT NULL;'); $adb->pquery("INSERT INTO roundcube_system (name, value) VALUES ('roundcube-version', '2014042900');"); }
public function updateRecords() { global $log, $adb, $YetiForce_current_version; $log->debug("Entering VT620_to_YT::updateRecords() method ..."); $changes = array(); $changes[] = array('where' => array('columnname' => array('calendarsharedtype')), 'setColumn' => array('displaytype'), 'setValue' => array(1)); $changes[] = array('where' => array('columnname' => array('description'), 'tabid' => array(getTabid('Accounts'), getTabid('Leads'), getTabid('Assets'), getTabid('Vendors'), getTabid('Quotes'), getTabid('Contacts'), getTabid('Potentials'), getTabid('PurchaseOrder'), getTabid('Project'), getTabid('HelpDesk'), getTabid('SalesOrder'), getTabid('Invoice'))), 'setColumn' => array('uitype'), 'setValue' => array(300)); $changes[] = array('where' => array('columnname' => array('createdtime', 'modifiedtime')), 'setColumn' => array('typeofdata'), 'setValue' => array('DT~O')); $changes[] = array('where' => array('columnname' => array('donotcall'), 'tabid' => array(getTabid('Contacts'))), 'setColumn' => array('fieldlabel'), 'setValue' => array('Approval for phone calls')); $changes[] = array('where' => array('columnname' => array('emailoptout'), 'tabid' => array(getTabid('Contacts'), getTabid('Accounts'))), 'setColumn' => array('fieldlabel'), 'setValue' => array('Approval for email')); $changes[] = array('where' => array('columnname' => array('end_hour'), 'tabid' => array(getTabid('Users'))), 'setColumn' => array('uitype'), 'setValue' => array(16)); $changes[] = array('where' => array('columnname' => array('invoiceid'), 'tabid' => array(getTabid('Assets'))), 'setColumn' => array('typeofdata'), 'setValue' => array('V~M')); $changes[] = array('where' => array('columnname' => array('lastname'), 'tabid' => array(getTabid('Leads'))), 'setColumn' => array('fieldlabel'), 'setValue' => array('Short name')); $changes[] = array('where' => array('columnname' => array('notecontent '), 'tabid' => array(getTabid('Documents'))), 'setColumn' => array('uitype'), 'setValue' => array(300)); $changes[] = array('where' => array('columnname' => array('parent_id'), 'tabid' => array(getTabid('HelpDesk'))), 'setColumn' => array('typeofdata'), 'setValue' => array('I~M')); $changes[] = array('where' => array('columnname' => array('priority', 'projectpriority', 'projecttaskpriority')), 'setColumn' => array('defaultvalue'), 'setValue' => array('Low')); $changes[] = array('where' => array('columnname' => array('quotestage')), 'setColumn' => array('defaultvalue'), 'setValue' => array('Created')); $changes[] = array('where' => array('columnname' => array('sales_stage')), 'setColumn' => array('defaultvalue'), 'setValue' => array('Accepted for processing')); $changes[] = array('where' => array('columnname' => array('projecttaskstatus')), 'setColumn' => array('defaultvalue', 'typeofdata'), 'setValue' => array('Open', 'V~M')); $changes[] = array('where' => array('columnname' => array('solution')), 'setColumn' => array('uitype'), 'setValue' => array(300)); $changes[] = array('where' => array('columnname' => array('start_hour')), 'setColumn' => array('defaultvalue'), 'setValue' => array('08:00')); $changes[] = array('where' => array('columnname' => array('status'), 'tabid' => array('HelpDesk')), 'setColumn' => array('defaultvalue'), 'setValue' => array('Open')); $changes[] = array('where' => array('columnname' => array('status'), 'tabid' => array('Calendar')), 'setColumn' => array('defaultvalue'), 'setValue' => array('Not Started')); $changes[] = array('where' => array('columnname' => array('totalduration'), 'tabid' => array('PBXManager')), 'setColumn' => array('uitype'), 'setValue' => array(1)); $changes[] = array('where' => array('columnname' => array('campaignrelstatus')), 'setColumn' => array('fieldlabel'), 'setValue' => array('Campaign status')); $changes[] = array('where' => array('columnname' => array('user_name'), 'tablename' => array('vtiger_users')), 'setColumn' => array('displaytype'), 'setValue' => array(4)); $changes[] = array('where' => array('columnname' => array('product_id'), 'tablename' => array('vtiger_troubletickets')), 'setColumn' => array('displaytype', 'uitype'), 'setValue' => array(1, 10)); $changes[] = array('where' => array('columnname' => array('startdate'), 'tablename' => array('vtiger_projecttask')), 'setColumn' => array('typeofdata', 'quickcreate'), 'setValue' => array('D~M', 2)); $changes[] = array('where' => array('columnname' => array('targetenddate'), 'tablename' => array('vtiger_projecttask')), 'setColumn' => array('typeofdata', 'quickcreate'), 'setValue' => array('D~M', 2)); $changes[] = array('where' => array('columnname' => array('folderid'), 'tablename' => array('vtiger_notes')), 'setColumn' => array('uitype', 'defaultvalue'), 'setValue' => array(302, 'T1')); foreach ($changes as $update) { $setColumn = implode(' = ?, ', $update['setColumn']) . ' = ? '; $params = $update['setValue']; $i = 0; $where = ''; foreach ($update['where'] as $whereColumn => $whereValue) { $where .= $whereColumn . ' IN (' . generateQuestionMarks($whereValue) . ') '; $i++; if ($i != count($update['where'])) { $where .= ' AND '; } $params = array_merge($params, $whereValue); } $query = "UPDATE vtiger_field SET " . $setColumn . " WHERE " . $where . " ; "; $adb->pquery($query, $params); } $adb->query("DELETE FROM `vtiger_module_dashboard_widgets` "); //delete value? $adb->query("UPDATE vtiger_inventory_tandc SET tandc = '';"); // delete all language $adb->query("DELETE FROM `vtiger_language` "); // add lang from yeti $lang[] = array('English', 'en_us', 'US English', '2014-07-16 11:20:12', NULL, '1', '1'); $lang[] = array('Język Polski', 'pl_pl', 'Język Polski', '2014-07-16 11:20:40', NULL, '0', '1'); $lang[] = array('Deutsch', 'de_de', 'DE Deutsch', '2014-11-21 11:20:40', NULL, '0', '1'); $lang[] = array('Portuguese', 'pt_br', 'Brazilian Portuguese', '2014-12-11 11:12:39', NULL, '0', '1'); $lang[] = array('Russian', 'ru_ru', 'Russian', '2015-01-13 15:12:39', NULL, '0', '1'); foreach ($lang as $params) { $adb->pquery("insert into `vtiger_language`(`name`,`prefix`,`label`,`lastupdated`,`sequence`,`isdefault`,`active`) values (?,?,?,?,?,?,?);", $params); } $adb->query("UPDATE vtiger_language_seq SET `id` = (SELECT count(*) FROM `vtiger_language`);"); $adb->pquery("UPDATE vtiger_version SET `current_version` = ? ;", [$YetiForce_current_version]); //update tax in inventoryproductrel $adb->query(" UPDATE `vtiger_inventoryproductrel` SET tax = \n\t\t\t CASE\n\t\t\t\tWHEN `tax1` IS NOT NULL \n\t\t\t\tOR\n\t\t\t\t`tax2` IS NOT NULL \n\t\t\t\tOR \n\t\t\t\t`tax3` IS NOT NULL \n\t\t\t\tTHEN 'tax1' \n\t\t\t END,\n\t\t\t tax1 = IFNULL(tax1, 0) + IFNULL(tax2, 0) + IFNULL(tax3, 0) ;"); $adb->pquery("UPDATE vtiger_calendar_default_activitytypes SET fieldname = ? WHERE `module` = ? AND fieldname = ? ;", array('End of support for contact', 'Contacts', 'support_end_date')); $adb->pquery("UPDATE vtiger_calendar_default_activitytypes SET fieldname = ? WHERE `module` = ? AND fieldname = ? ;", array('Birthdays of contacts', 'Contacts', 'birthday')); $adb->pquery("UPDATE vtiger_calendar_default_activitytypes SET `active` = ? ;", array(1)); // links $instanceModule = Vtiger_Module::getInstance('Potentials'); $instanceModule->addLink('DASHBOARDWIDGET', 'KPI', 'index.php?module=Potentials&view=ShowWidget&name=Kpi'); $instanceModule = Vtiger_Module::getInstance('Home'); $instanceModule->addLink('DASHBOARDWIDGET', 'Employees Time Control', 'index.php?module=OSSTimeControl&view=ShowWidget&name=TimeControl'); $instanceModule->addLink('DASHBOARDWIDGET', 'Delagated Events/To Dos', 'index.php?module=Home&view=ShowWidget&name=AssignedUpcomingCalendarTasks'); $instanceModule->addLink('DASHBOARDWIDGET', 'Delegated (overdue) Events/ToDos', 'index.php?module=Home&view=ShowWidget&name=AssignedOverdueCalendarTasks'); $instanceModule->addLink('DASHBOARDWIDGET', 'Delegated (overdue) project tasks', 'index.php?module=Home&view=ShowWidget&name=AssignedOverdueProjectsTasks'); $instanceModule->addLink('DASHBOARDWIDGET', 'Delegated project tasks', 'index.php?module=Home&view=ShowWidget&name=AssignedUpcomingProjectsTasks'); $instanceModule->addLink('DASHBOARDWIDGET', 'Leads by Status Converted', 'index.php?module=Leads&view=ShowWidget&name=LeadsByStatusConverted'); $instanceModule->addLink('DASHBOARDWIDGET', 'Calculations', 'index.php?module=Calculations&view=ShowWidget&name=Calculations'); $instanceModule->addLink('DASHBOARDWIDGET', 'PotentialsList', 'index.php?module=Potentials&view=ShowWidget&name=PotentialsList'); $instanceModule->addLink('DASHBOARDWIDGET', 'Mails List', 'index.php?module=Home&view=ShowWidget&name=MailsList'); $instanceModule->addLink('DASHBOARDWIDGET', 'Calendar', 'index.php?module=Home&view=ShowWidget&name=Calendar'); $instanceModule = Vtiger_Module::getInstance('Leads'); $instanceModule->addLink('DASHBOARDWIDGET', 'Leads by Status Converted', 'index.php?module=Leads&view=ShowWidget&name=LeadsByStatusConverted'); $adb->pquery("UPDATE `vtiger_links` SET `handler_path` = NULL, `handler` = '', `handler_class` = '', `linkicon` = 'icon-file' WHERE `linklabel` = ?;", array('Add Note')); $adb->pquery("UPDATE `vtiger_links` SET `handler_path` = NULL, `handler` = '', `handler_class` = '', `linkicon` = 'icon-tasks' WHERE `linklabel` = ?;", array('Add Project Task')); $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('SalesOrder'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget')); if ($adb->num_rows($result) == 0) { $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments'); if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) { include_once 'modules/ModComments/ModComments.php'; if (class_exists('ModComments')) { ModComments::addWidgetTo(array('SalesOrder')); } } } $result = $adb->query("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = 'HelpDesk' AND relmodule = 'Products'"); if ($adb->num_rows($result) == 0) { $adb->query("insert into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`,`status`,`sequence`) values ((SELECT fieldid FROM `vtiger_field` WHERE `columnname` = 'product_id' AND `tablename` = 'vtiger_troubletickets'),'HelpDesk','Products',NULL,1);"); } $result = $adb->query("SELECT * FROM `vtiger_fieldmodulerel` WHERE module = 'HelpDesk' AND relmodule = 'Services'"); if ($adb->num_rows($result) == 0) { $adb->query("insert into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`,`status`,`sequence`) values ((SELECT fieldid FROM `vtiger_field` WHERE `columnname` = 'product_id' AND `tablename` = 'vtiger_troubletickets'),'HelpDesk','Services',NULL,2);"); } $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE linklabel = ?", array('LIST_OF_LAST_UPDATED_RECORD')); if ($adb->num_rows($result) == 0) { $instanceModule = Vtiger_Module::getInstance('Home'); $instanceModule->addLink('DASHBOARDWIDGET', 'LIST_OF_LAST_UPDATED_RECORD', 'index.php?module=Home&view=ShowWidget&name=ListUpdatedRecord'); } $result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('parentid', 'vtiger_contactdetails')); $result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", array($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') . ",'Contacts','Vendors');"); } $adb->pquery("UPDATE `vtiger_entityname` SET `searchcolumn` = ? WHERE `modulename` IN (?,?);", array('subject', 'RequirementCards', 'QuotesEnquires')); $adb->pquery("UPDATE `vtiger_entityname` SET `searchcolumn` = ?, fieldname = ? WHERE `modulename` = ?;", array('holidaysentitlement_year,ossemployeesid', 'holidaysentitlement_year', 'HolidaysEntitlement')); $adb->pquery("UPDATE `vtiger_entityname` SET fieldname = ? WHERE `modulename` = ?;", array('lastname', 'Leads')); $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE tabid = ? AND linktype = ? AND linklabel = ?;", array(getTabid('Quotes'), 'DETAILVIEWWIDGET', 'DetailViewBlockCommentWidget')); if ($adb->num_rows($result) == 0) { $modcommentsModuleInstance = Vtiger_Module::getInstance('ModComments'); if ($modcommentsModuleInstance && file_exists('modules/ModComments/ModComments.php')) { include_once 'modules/ModComments/ModComments.php'; if (class_exists('ModComments')) { ModComments::addWidgetTo(array('Quotes')); } } } $modulename = 'Quotes'; $modcommentsModuleInstance = Vtiger_Module::getInstance('ModTracker'); if ($modcommentsModuleInstance && file_exists('modules/ModTracker/ModTracker.php')) { include_once 'vtlib/Vtiger/Module.php'; include_once 'modules/ModTracker/ModTracker.php'; $tabid = Vtiger_Functions::getModuleId($modulename); $moduleModTrackerInstance = new ModTracker(); if (!$moduleModTrackerInstance->isModulePresent($tabid)) { $res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabid, 1)); $moduleModTrackerInstance->updateCache($tabid, 1); } else { $updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabid)); $moduleModTrackerInstance->updateCache($tabid, 1); } if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabid)) { $moduleInstance = Vtiger_Module::getInstance($tabid); $moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted')); } } $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('Potentials', 'Contacts')); $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('Assets', 'Accounts')); $query = "DELETE FROM vtiger_fieldmodulerel WHERE module = ? AND relmodule = ? ;"; $adb->pquery($query, array('PBXManager', 'Leads')); $query = "DELETE FROM `vtiger_relatedlists` WHERE `tabid` = ? AND `related_tabid` = ? AND `label` = ?;"; $adb->pquery($query, array(getTabid('Leads'), getTabid('PBXManager'), 'PBXManager'), true); $adb->pquery("UPDATE `vtiger_calendar_user_activitytypes` SET `visible` = ? WHERE `id` > ? ;", array(0, 2)); $result = $adb->pquery("SELECT * FROM `vtiger_links` WHERE linklabel = ? AND linkicon = ? ; ", array('LBL_SHOW_ACCOUNT_HIERARCHY', 'icon-align-justify')); if ($adb->num_rows($result) == 0) { $adb->pquery("UPDATE `vtiger_links` SET `linkicon` = ? WHERE `linklabel`= ? ;", array('icon-align-justify', 'LBL_SHOW_ACCOUNT_HIERARCHY')); $adb->pquery("UPDATE `vtiger_links` SET `linkicon` = ? WHERE `linklabel`= ? ;", array('icon-file', 'LBL_ADD_NOTE')); } $result1 = $adb->pquery("SELECT fieldid FROM `vtiger_field` WHERE columnname = ? AND tablename = ?", array('parent_id', 'vtiger_assets')); $result2 = $adb->pquery("SELECT * FROM `vtiger_fieldmodulerel` WHERE fieldid = ? AND relmodule = ?", array($adb->query_result($result1, 0, 'fieldid'), 'Accounts')); if ($adb->num_rows($result2) == 0) { $adb->query("insert into `vtiger_fieldmodulerel`(`fieldid`,`module`,`relmodule`) values (" . $adb->query_result($result1, 0, 'fieldid') . ",'Assets','Accounts');"); } $log->debug("Exiting VT620_to_YT::updateRecords() method ..."); }