public function addSharingToModules() { global $log, $adb; $log->debug("Entering VT620_to_YT::addSharingToModules() method ..."); $restrictedModules = array('Emails', 'Integration', 'Dashboard', 'ModComments', 'SMSNotifier', 'PBXManager', 'CallHistory', 'LettersIn', 'LettersOut', 'NewOrders', 'PaymentsIn', 'PaymentsOut', 'Services', 'Products'); $sql = 'SELECT * FROM vtiger_tab WHERE isentitytype = ? AND name NOT IN (' . generateQuestionMarks($restrictedModules) . ')'; $params = array(1, $restrictedModules); $tabresult = $adb->pquery($sql, $params, true); for ($i = 0; $i < $adb->num_rows($tabresult); $i++) { $tabId = $adb->query_result_raw($tabresult, $i, 'tabid'); $moduleName = $adb->query_result_raw($tabresult, $i, 'name'); if (!self::checkBlockExists($moduleName, array('blocklabel' => 'LBL_SHARING_INFORMATION'))) { $moduleInstance = Vtiger_Module::getInstance($moduleName); $blockInstance = new Vtiger_Block(); $blockInstance->label = 'LBL_SHARING_INFORMATION'; $blockInstance->showtitle = 0; $blockInstance->visible = 0; $blockInstance->increateview = 0; $blockInstance->ineditview = 0; $blockInstance->indetailview = 0; if (in_array($moduleName, array('Contacts', 'HelpDesk', 'Project', 'Potentials', 'Campaigns', 'Accounts'))) { $blockInstance->display_status = 0; } else { $blockInstance->display_status = 1; } $blockInstance->iscustom = 1; $blockInstance->__create($moduleInstance); } if (!self::checkFieldExists(array('name' => 'inheritsharing', 'table' => 'vtiger_crmentity'), $moduleName)) { $blockInstance = Vtiger_Block::getInstance('LBL_SHARING_INFORMATION', $moduleInstance); $fieldInstance = new Vtiger_Field(); $fieldInstance->name = 'inheritsharing'; $fieldInstance->table = 'vtiger_crmentity'; $fieldInstance->label = 'Copy permissions automatically'; $fieldInstance->column = 'inheritsharing'; $fieldInstance->columntype = 'tinyint(1) default 0'; $fieldInstance->uitype = 56; $fieldInstance->typeofdata = 'C~O'; $fieldInstance->displaytype = 1; $blockInstance->addField($fieldInstance); } if (!self::checkFieldExists(array('name' => 'shownerid', 'table' => 'vtiger_crmentity'), $moduleName)) { $blockInstance = Vtiger_Block::getInstance('LBL_SHARING_INFORMATION', $moduleInstance); $fieldInstance = new Vtiger_Field(); $fieldInstance->name = 'shownerid'; $fieldInstance->table = 'vtiger_crmentity'; $fieldInstance->label = 'Share with users'; $fieldInstance->column = 'shownerid'; $fieldInstance->columntype = "set('1')"; $fieldInstance->uitype = 120; $fieldInstance->typeofdata = 'V~O'; $fieldInstance->displaytype = 1; $blockInstance->addField($fieldInstance); } } $log->debug("Exiting VT620_to_YT::addSharingToModules() method ..."); }