function postupdate() { global $log, $adb; if ($this->filesToDeleteNew) { foreach ($this->filesToDeleteNew as $path) { $this->recurseDelete($path); } } $result = true; self::recurseCopy('cache/updates/files_new', '', true); $this->recurseDelete('cache/updates'); Vtiger_Deprecated::createModuleMetaFile(); Vtiger_Access::syncSharingAccess(); $adb->query('SET FOREIGN_KEY_CHECKS = 1;'); $currentUser = Users_Record_Model::getCurrentUserModel(); $adb->query("INSERT INTO `yetiforce_updates` (`user`, `name`, `from_version`, `to_version`, `result`) VALUES ('" . $currentUser->get('user_name') . "', '" . $this->modulenode->label . "', '" . $this->modulenode->from_version . "', '" . $this->modulenode->to_version . "','" . $result . "');", true); if ($result) { $adb->query("UPDATE vtiger_version SET current_version = '" . $this->modulenode->to_version . "';"); } $dirName = 'cache/updates'; $this->recurseDelete($dirName . '/files'); $this->recurseDelete($dirName . '/init.php'); $this->recurseDelete('cache/templates_c'); header('Location: ' . vglobal('site_URL')); exit; return true; }
function postupdate() { global $adb; Vtiger_Deprecated::createModuleMetaFile(); Vtiger_Access::syncSharingAccess(); return true; }
function postupdate() { global $adb; $adb->query("UPDATE vtiger_version SET `current_version` = '" . $this->modulenode->to_version . "';"); Vtiger_Deprecated::createModuleMetaFile(); Vtiger_Access::syncSharingAccess(); return true; }
public function executeMigrationSchema($system, $userName, $source) { include_once $this->migration_schema . $system . '.php'; $migrationObject = new $system(); Vtiger_Access::syncSharingAccess(); $migrationObject->preProcess($userName, $source); $migrationObject->process(); $return = $migrationObject->postProcess(); Vtiger_Access::syncSharingAccess(); Vtiger_Deprecated::createModuleMetaFile(); return $return; }
public function actionMapping() { global $log, $adb; $log->debug("Entering VT620_to_YT::actionMapping() method ..."); $actions = ['CreateCustomFilter', 'DuplicateRecord', 'EditableComments']; $count = self::countRow('vtiger_actionmapping', 'actionid'); foreach ($actions as $action) { ++$count; $result = $adb->pquery('SELECT actionid FROM vtiger_actionmapping WHERE actionname=?;', [$action]); if ($adb->num_rows($result) == 0) { $adb->pquery("INSERT INTO `vtiger_actionmapping` (`actionid`, `actionname`, `securitycheck`) VALUES (?, ?,'0');", [$count, $action]); } $modules = [getTabid('Services'), getTabid('ServiceContracts'), getTabid('SalesOrder'), getTabid('Reservations'), getTabid('Quotes'), getTabid('PurchaseOrder'), getTabid('ProjectTask'), getTabid('ProjectMilestone'), getTabid('Project'), getTabid('Products'), getTabid('PriceBooks'), getTabid('Potentials'), getTabid('OutsourcedProducts'), getTabid('OSSTimeControl'), getTabid('OSSSoldServices'), getTabid('OSSPdf'), getTabid('OSSPasswords'), getTabid('OSSOutsourcedServices'), getTabid('OSSMailView'), getTabid('OSSMailTemplates'), getTabid('OSSEmployees'), getTabid('OSSCosts'), getTabid('Leads'), getTabid('Invoice'), getTabid('HelpDesk'), getTabid('Faq'), getTabid('Documents'), getTabid('Contacts'), getTabid('Campaigns'), getTabid('Calendar'), getTabid('Calculations'), getTabid('Assets'), getTabid('Accounts'), getTabid('Events')]; $resultP = $adb->query("SELECT profileid FROM vtiger_profile;"); for ($i = 0; $i < $adb->num_rows($resultP); $i++) { $profileId = $adb->query_result_raw($resultP, $i, 'profileid'); if ($action == 'EditableComments') { $tabid = getTabid('ModComments'); $resultC = $adb->pquery("SELECT activityid FROM vtiger_profile2utility WHERE profileid=? AND tabid=? AND activityid=? ;", [$profileId, $tabid, $count]); if ($adb->num_rows($resultC) == 0) { $adb->pquery("INSERT INTO vtiger_profile2utility (profileid, tabid, activityid, permission) VALUES (?, ?, ?, ?)", array($profileId, $tabid, $count, 0)); } continue; } for ($k = 0; $k < count($modules); $k++) { $tabid = $modules[$k]; if ($action != 'DuplicateRecord' && $tabid == getTabid('Events')) { continue; } $resultC = $adb->pquery("SELECT activityid FROM vtiger_profile2utility WHERE profileid=? AND tabid=? AND activityid=? ;", [$profileId, $tabid, $count]); if ($adb->num_rows($resultC) == 0) { $adb->pquery("INSERT INTO vtiger_profile2utility (profileid, tabid, activityid, permission) VALUES (?, ?, ?, ?)", array($profileId, $tabid, $count, 0)); } } } } $actions = [17 => 'MassEdit', 18 => 'MassDelete', 19 => 'MassAddComment', 20 => 'MassComposeEmail', 21 => 'MassSendSMS', 22 => 'MassTransferOwnership', 23 => 'MassMoveDocuments']; foreach ($actions as $key => $action) { ++$count; $result = $adb->pquery('SELECT actionid FROM vtiger_actionmapping WHERE actionname=?;', [$action]); if ($adb->num_rows($result) == 0) { $adb->pquery("INSERT INTO `vtiger_actionmapping` (`actionid`, `actionname`, `securitycheck`) VALUES (?, ?,'0');", [$count, $action]); } $sql = "SELECT tabid, name FROM `vtiger_tab` WHERE `isentitytype` = '1' AND name not in ('SMSNotifier','ModComments','PBXManager','Events','Emails','');"; $result = $adb->query($sql); $resultP = $adb->query("SELECT profileid FROM vtiger_profile;"); for ($i = 0; $i < $adb->num_rows($resultP); $i++) { $profileId = $adb->query_result_raw($resultP, $i, 'profileid'); for ($k = 0; $k < $adb->num_rows($result); $k++) { $insert = false; $row = $adb->query_result_rowdata($result, $k); $tabid = $row['tabid']; if ($action == 'MassMoveDocuments' && $row['name'] == 'Documents') { $insert = true; } if (($action == 'MassComposeEmail' || $action == 'MassSendSMS' || $action == 'MassTransferOwnership') && in_array($row['name'], ['Accounts', 'Contacts', 'Leads', 'Vendors'])) { $insert = true; } if (!($action == 'MassTransferOwnership' && $row['name'] == 'PriceBooks') && $action != 'MassMoveDocuments' && $action != 'MassComposeEmail' && $action != 'MassSendSMS') { $insert = true; } $resultC = $adb->pquery("SELECT activityid FROM vtiger_profile2utility WHERE profileid=? AND tabid=? AND activityid=? ;", [$profileId, $tabid, $count]); if ($insert && $adb->num_rows($resultC) == 0) { $adb->pquery("INSERT INTO vtiger_profile2utility (profileid, tabid, activityid, permission) VALUES (?, ?, ?, ?)", array($profileId, $tabid, $count, 0)); } } } } $actions = ['ReadRecord', 'WorkflowTrigger']; foreach ($actions as $key => $action) { ++$count; $result = $adb->pquery('SELECT actionid FROM vtiger_actionmapping WHERE actionname=?;', [$action]); if ($adb->num_rows($result) == 0) { $adb->pquery("INSERT INTO `vtiger_actionmapping` (`actionid`, `actionname`, `securitycheck`) VALUES (?, ?,'0');", [$count, $action]); } $sql = "SELECT tabid, name FROM `vtiger_tab` WHERE `isentitytype` = '1' AND name not in ('SMSNotifier','ModComments','PBXManager','Events','Emails','CallHistory','OSSMailView','');"; $result = $adb->query($sql); $resultP = $adb->query("SELECT profileid FROM vtiger_profile;"); for ($i = 0; $i < $adb->num_rows($resultP); $i++) { $profileId = $adb->query_result_raw($resultP, $i, 'profileid'); for ($k = 0; $k < $adb->num_rows($result); $k++) { $row = $adb->query_result_rowdata($result, $k); $tabid = $row['tabid']; $resultC = $adb->pquery("SELECT activityid FROM vtiger_profile2utility WHERE profileid=? AND tabid=? AND activityid=? ;", [$profileId, $tabid, $count]); if ($adb->num_rows($resultC) == 0) { $adb->pquery("INSERT INTO vtiger_profile2utility (profileid, tabid, activityid, permission) VALUES (?, ?, ?, ?)", array($profileId, $tabid, $count, 0)); } } } } Vtiger_Deprecated::createModuleMetaFile(); Vtiger_Access::syncSharingAccess(); $log->debug("Exiting VT620_to_YT::actionMapping() method ..."); }