/** * Function to check whether it is compatible with vtiger or not * @return <boolean> true/false */ public function isVtigerCompatible() { vimport('~~/vtlib/Vtiger/Version.php'); $vtigerVersion = $this->get('vtigerVersion'); $vtigerMaxVersion = $this->get('vtigerMaxVersion'); if (Vtiger_Version::check($vtigerVersion, '>=') && $vtigerMaxVersion && Vtiger_Version::check($vtigerMaxVersion, '<') || Vtiger_Version::check($vtigerVersion, '=')) { return true; } return false; }
/** * Initialize table required for the module * @param String Base table name (default modulename in lowercase) * @param String Base table column (default modulenameid in lowercase) * * Creates basetable, customtable, grouptable <br> * customtable name is basetable + 'cf'<br> * grouptable name is basetable + 'grouprel'<br> */ function initTables($basetable = false, $basetableid = false) { $this->basetable = $basetable; $this->basetableid = $basetableid; // Initialize tablename and index column names $lcasemodname = strtolower($this->name); if (!$this->basetable) { $this->basetable = "vtiger_{$lcasemodname}"; } if (!$this->basetableid) { $this->basetableid = $lcasemodname . "id"; } if (!$this->customtable) { $this->customtable = $this->basetable . "cf"; } if (!$this->grouptable) { $this->grouptable = $this->basetable . "grouprel"; } Vtiger_Utils::CreateTable($this->basetable, "({$this->basetableid} INT)", true); Vtiger_Utils::CreateTable($this->customtable, "({$this->basetableid} INT PRIMARY KEY)", true); if (Vtiger_Version::check('5.0.4', '<=')) { Vtiger_Utils::CreateTable($this->grouptable, "({$this->basetableid} INT PRIMARY KEY, groupname varchar(100))", true); } }
function getFromEmailAddress() { global $adb, $current_user; $fromEmail = false; if (Vtiger_Version::check('5.2.0', '>=')) { $smtpFromResult = $adb->pquery('SELECT from_email_field FROM vtiger_systems WHERE server_type=?', array('email')); if ($adb->num_rows($smtpFromResult)) { $fromEmail = decode_html($adb->query_result($smtpFromResult, 0, 'from_email_field')); } } if (empty($fromEmail)) { $fromEmail = $current_user->column_fields['email1']; } return $fromEmail; }
/** * * @param String $packagepath - path to the package file. * @return Array */ static function getOptionalModuleDetails($package, $optionalModulesInfo) { global $optionalModuleStrings; $moduleUpdateVersion = $package->getVersion(); $moduleForVtigerVersion = $package->getDependentVtigerVersion(); $moduleMaxVtigerVersion = $package->getDependentMaxVtigerVersion(); if ($package->isLanguageType()) { $type = 'language'; } else { $type = 'module'; } $moduleDetails = null; $moduleName = $package->getModuleName(); if ($moduleName != null) { $moduleDetails = array(); $moduleDetails['description'] = $optionalModuleStrings[$moduleName . '_description']; if (Vtiger_Version::check($moduleForVtigerVersion, '>=') && Vtiger_Version::check($moduleMaxVtigerVersion, '<')) { $moduleDetails['selected'] = true; $moduleDetails['enabled'] = true; } else { $moduleDetails['selected'] = false; $moduleDetails['enabled'] = false; } $migrationAction = 'install'; if (!$package->isLanguageType()) { $moduleInstance = null; if (Vtiger_Utils::checkTable('vtiger_tab')) { $moduleInstance = Vtiger_Module::getInstance($moduleName); } if ($moduleInstance) { $migrationAction = 'update'; if (version_compare($moduleUpdateVersion, $moduleInstance->version, '>=')) { $moduleDetails['enabled'] = false; } } } else { if (Vtiger_Utils::CheckTable(Vtiger_Language::TABLENAME)) { $languageList = array_keys(Vtiger_Language::getAll()); $prefix = $package->getPrefix(); if (in_array($prefix, $languageList)) { $migrationAction = 'update'; } } } $optionalModulesInfo[$migrationAction][$type][$moduleName] = $moduleDetails; } return $optionalModulesInfo; }
public function getFromEmailAddress() { $db = PearDatabase::getInstance(); $currentUserModel = Users_Record_Model::getCurrentUserModel(); $fromEmail = false; if (Vtiger_Version::check('5.2.0', '>=')) { $smtpFromResult = $db->pquery('SELECT from_email_field FROM vtiger_systems WHERE server_type=?', array('email')); if ($db->num_rows($smtpFromResult)) { $fromEmail = decode_html($db->query_result($smtpFromResult, 0, 'from_email_field')); } } if (empty($fromEmail)) { $fromEmail = $currentUserModel->get('email1'); } return $fromEmail; }