コード例 #1
0
ファイル: addRecurringSO.php プロジェクト: kduqi/corebos
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $modname = 'SalesOrder';
         $module = Vtiger_Module::getInstance($modname);
         $field = Vtiger_Field::getInstance('recurring_frequency', $module);
         if ($field) {
             $field->setPicklistValues(array('2years', '3years', '4years', '5years'));
             $this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=7 WHERE recurring_frequency='2years'");
             $this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=8 WHERE recurring_frequency='3years'");
             $this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=9 WHERE recurring_frequency='4years'");
             $this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=10 WHERE recurring_frequency='5years'");
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
コード例 #2
0
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $moduleInstance = Vtiger_Module::getInstance('Users');
         $block = Vtiger_Block::getInstance('LBL_MORE_INFORMATION', $moduleInstance);
         $field = Vtiger_Field::getInstance('send_email_to_sender', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $user_field = new Vtiger_Field();
             $user_field->name = 'send_email_to_sender';
             $user_field->label = 'LBL_SEND_EMAIL_TO_SENDER';
             $user_field->table = 'vtiger_users';
             $user_field->column = 'send_email_to_sender';
             $user_field->columntype = 'varchar(3)';
             $user_field->typeofdata = 'C~O';
             $user_field->uitype = '56';
             $user_field->masseditable = '0';
             $block->addField($user_field);
             $this->ExecuteQuery("update vtiger_users set send_email_to_sender='1'");
             RecalculateSharingRules();
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
コード例 #3
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type
  */
 function vtlib_handler($moduleName, $eventType)
 {
     $adb = PearDatabase::getInstance();
     if ($eventType == 'module.postinstall') {
         include_once 'vtlib/Vtiger/Module.php';
         $moduleInstance = CRMEntity::getInstance('HolidaysEntitlement');
         $moduleInstance->setModuleSeqNumber("configure", 'HolidaysEntitlement', 'HE', '1');
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array('HolidaysEntitlement'));
         $moduleInstance = Vtiger_Module::getInstance('HolidaysEntitlement');
         $targetModule = Vtiger_Module::getInstance('OSSEmployees');
         $targetModule->setRelatedList($moduleInstance, 'HolidaysEntitlement', array('ADD'), 'get_dependents_list');
     } 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.
                     }
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: AJAXChat.php プロジェクト: rcrrich/YetiForceCRM
 function vtlib_handler($modulename, $event_type)
 {
     if ($event_type == 'module.postinstall') {
     } else {
         if ($event_type == 'module.disabled') {
             $moduleInstance = Vtiger_Module::getInstance($modulename);
             $moduleInstance->deleteLink('HEADERSCRIPT', 'Chat', 'layouts/vlayout/modules/AJAXChat/Chat.js');
             // TODO Handle actions when this module is disabled.
             return;
         } else {
             if ($event_type == 'module.enabled') {
                 $moduleInstance = Vtiger_Module::getInstance($modulename);
                 $moduleInstance->addLink('HEADERSCRIPT', 'Chat', 'layouts/vlayout/modules/AJAXChat/Chat.js');
                 // TODO Handle actions when this module is enabled.
                 return;
             } else {
                 if ($event_type == 'module.preuninstall') {
                     // TODO Handle actions when this module is about to be deleted.
                     return;
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                         return;
                     } else {
                         if ($event_type == 'module.postupdate') {
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #5
0
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset assignto_mailscanner already applied!');
     } else {
         $mod_hd = Vtiger_Module::getInstance('HelpDesk');
         $block_hd = Vtiger_Block::getInstance('LBL_TICKET_INFORMATION', $mod_hd);
         $field1 = new Vtiger_Field();
         $field1->name = 'from_mailscanner';
         $field1->label = 'From mailscanner';
         $field1->column = 'from_mailscanner';
         $field1->columntype = 'VARCHAR(3)';
         $field1->sequence = 1;
         $field1->uitype = 56;
         $field1->typeofdata = 'C~O';
         $field1->displaytype = 3;
         $field1->presence = 0;
         $field1->readonly = 1;
         $block_hd->addField($field1);
         $this->ExecuteQuery('ALTER TABLE vtiger_mailscanner_rules ADD assign_to INT(11)');
         $this->sendMsg('Changeset assignto_mailscanner applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
コード例 #6
0
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $moduleInstance = Vtiger_Module::getInstance('Users');
         $block = Vtiger_Block::getInstance('LBL_USER_ADV_OPTIONS', $moduleInstance);
         $field = Vtiger_Field::getInstance('failed_login_attempts', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $user_field = new Vtiger_Field();
             $user_field->name = 'failed_login_attempts';
             $user_field->label = 'LBL_FAILED_LOGIN_ATTEMPTS';
             $user_field->table = 'vtiger_users';
             $user_field->column = 'failed_login_attempts';
             $user_field->columntype = 'int(11)';
             $user_field->typeofdata = 'I~O';
             $user_field->uitype = '7';
             $user_field->masseditable = '0';
             $block->addField($user_field);
             $this->ExecuteQuery('update vtiger_users set failed_login_attempts=0');
             RecalculateSharingRules();
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
コード例 #7
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $buttonsReturn = false;
     $mode = $request->get('mode');
     $formodule = $request->get('formodule');
     $recordModel = Vtiger_Module_Model::getCleanInstance('OSSPdf');
     if ($mode == 'create_buttons') {
         $recordModel->add_links($formodule);
         $buttonsReturn = true;
     }
     if ($mode == 'delete_buttons') {
         $modCommentsModule = Vtiger_Module::getInstance($formodule);
         $modCommentsModule->deleteLink('LISTVIEWSIDEBARWIDGET', 'Pdf');
         $modCommentsModule->deleteLink('DETAILVIEWSIDEBARWIDGET', 'Pdf');
         $modCommentsModule->deleteLink('DETAILVIEWBASIC', 'LBL_QUICK_GENERATE_MAIL');
         // do ewentualnej poprawy
         $modCommentsModule->deleteLink('DETAILVIEWBASIC', 'Generate default PDF');
         $buttonsReturn = true;
     }
     if ($buttonsReturn === false) {
         $result = array('success' => false, 'message' => vtranslate('Error', $moduleName));
     } else {
         $result = array('success' => true, 'message' => 'Ok');
     }
     $response = new Vtiger_Response();
     $response->setResult($result);
     $response->emit();
 }
コード例 #8
0
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $moduleInstance = Vtiger_Module::getInstance('GlobalVariable');
         // change uitype and label
         $field = Vtiger_Field::getInstance('module_list', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery("update vtiger_field set uitype=3313,fieldlabel='Module List' where fieldid=" . $field->id);
         }
         // convert all existing records to new format
         $gvrs = $adb->pquery('select globalvariableid,module_list from vtiger_globalvariable', array());
         $updsql = 'update vtiger_globalvariable set module_list=? where globalvariableid=?';
         while ($gv = $adb->fetch_array($gvrs)) {
             if (trim($gv['module_list']) != '') {
                 $ml = array_map('trim', explode(',', $gv['module_list']));
                 $ml = implode(' |##| ', $ml);
                 $this->ExecuteQuery($updsql, array($ml, $gv['globalvariableid']));
             }
         }
         // fix incorrect entiyidentifier
         $updsql = "UPDATE `vtiger_entityname` SET \n\t\t\t\t`fieldname`='globalno',\n\t\t\t\t`entityidfield`='globalvariableid',\n\t\t\t\t`entityidcolumn`='globalvariableid'\n\t\t\t\tWHERE `modulename`='GlobalVariable' and `tablename`='vtiger_globalvariable'";
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
コード例 #9
0
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $moduleInstance = Vtiger_Module::getInstance('Users');
         $block = Vtiger_Block::getInstance('LBL_CALENDAR_SETTINGS', $moduleInstance);
         if (!$block) {
             $block = new Vtiger_Block();
             $block->label = 'LBL_CALENDAR_SETTINGS';
             $block->sequence = 2;
             $moduleInstance->addBlock($block);
         }
         $this->ExecuteQuery("delete from vtiger_picklist where name='hour_format'");
         $this->ExecuteQuery("delete from vtiger_picklist where name='start_hour'");
         $field = Vtiger_Field::getInstance('hour_format', $moduleInstance);
         $this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $field->id);
         $field->setPicklistValues(array('am/pm', '12', '24'));
         $start_hour = Vtiger_Field::getInstance('start_hour', $moduleInstance);
         $this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $start_hour->id);
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
コード例 #10
0
 function undoChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         // undo your magic here
         $moduleInstance = Vtiger_Module::getInstance('Potentials');
         $field = Vtiger_Field::getInstance('forecast_amount', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=1 where fieldid=' . $field->id);
         }
         global $adb;
         $wfrs = $adb->query("SELECT workflow_id FROM com_vtiger_workflows WHERE summary='Calculate or Update forecast amount'");
         if ($wfrs and $adb->num_rows($wfrs) == 1) {
             $wfid = $adb->query_result($wfrs, 0, 0);
             $this->deleteWorkflow($wfid);
             $this->sendMsg('Workflow deleted!');
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' undone!');
         $this->markUndone();
     } else {
         $this->sendMsg('Changeset ' . get_class($this) . ' not applied!');
     }
     $this->finishExecution();
 }
コード例 #11
0
ファイル: Basic.php プロジェクト: cin-system/cinrepo
 public function updateUserModuleStep3(Vtiger_Request $request)
 {
     $importModuleName = $request->get('module_import_name');
     $uploadFile = $request->get('module_import_file');
     $uploadDir = Settings_ModuleManager_Extension_Model::getUploadDirectory();
     $uploadFileName = "{$uploadDir}/{$uploadFile}";
     checkFileAccess($uploadFileName);
     $importType = $request->get('module_import_type');
     if (strtolower($importType) == 'language') {
         $package = new Vtiger_Language();
     } else {
         $package = new Vtiger_Package();
     }
     if (strtolower($importType) == 'language') {
         $package->import($uploadFileName);
     } else {
         $package->update(Vtiger_Module::getInstance($importModuleName), $uploadFileName);
     }
     checkFileAccessForDeletion($uploadFileName);
     unlink($uploadFileName);
     $result = array('success' => true, 'importModuleName' => $importModuleName);
     $response = new Vtiger_Response();
     $response->setResult($result);
     $response->emit();
 }
コード例 #12
0
 function undoChange()
 {
     if ($this->isBlocked()) {
         return true;
     }
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isSystemUpdate()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' is a system update, it cannot be undone!');
     } else {
         if ($this->isApplied()) {
             // undo your magic here
             $modname = 'Vendors';
             $module = Vtiger_Module::getInstance($modname);
             $ctModule = Vtiger_Module::getInstance('Contacts');
             $module->unsetRelatedList($ctModule, $modname, 'get_vendors');
             $this->sendMsg('Changeset ' . get_class($this) . ' undone!');
             $this->markUndone();
         } else {
             $this->sendMsg('Changeset ' . get_class($this) . ' not applied!');
         }
     }
     $this->finishExecution();
 }
コード例 #13
0
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $moduleInstance = Vtiger_Module::getInstance('Products');
         $field = Vtiger_Field::getInstance('discontinued', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
         }
         $moduleInstance = Vtiger_Module::getInstance('Services');
         $field = Vtiger_Field::getInstance('discontinued', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
         }
         $moduleInstance = Vtiger_Module::getInstance('PriceBooks');
         $field = Vtiger_Field::getInstance('active', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
コード例 #14
0
 /**
  * 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, 'UO', '1');
         include_once 'vtlib/Vtiger/Module.php';
         $moduleInstance = Vtiger_Module::getInstance($modulename);
         $docelowy_Module = Vtiger_Module::getInstance('Accounts');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSOutsourcedServices', array('ADD'), 'get_dependents_list');
         $docelowy_Module = Vtiger_Module::getInstance('Leads');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSOutsourcedServices', array('ADD'), 'get_dependents_list');
         $docelowy_Module = Vtiger_Module::getInstance('Potentials');
         $docelowy_Module->setRelatedList($moduleInstance, 'OSSOutsourcedServices', array('ADD'), 'get_dependents_list');
     } 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') {
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #15
0
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $moduleInstance = Vtiger_Module::getInstance('Users');
         $block = Vtiger_Block::getInstance('LBL_CALENDAR_SETTINGS', $moduleInstance);
         if (!$block) {
             $block = new Vtiger_Block();
             $block->label = 'LBL_CALENDAR_SETTINGS';
             $block->sequence = 2;
             $moduleInstance->addBlock($block);
         }
         $this->ExecuteQuery('drop table if exists vtiger_hour_format');
         $this->ExecuteQuery('drop table if exists vtiger_start_hour');
         $field = Vtiger_Field::getInstance('hour_format', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'hour_format';
             $field->label = 'Calendar Hour Format';
             $field->table = 'vtiger_users';
             $field->column = 'hour_format';
             $field->columntype = 'varchar(4)';
             $field->typeofdata = 'V~O';
             $field->uitype = '16';
             $field->masseditable = '0';
             $block->addField($field);
         }
         $field->setPicklistValues(array('12', '24'));
         $start_hour = Vtiger_Field::getInstance('start_hour', $moduleInstance);
         if ($start_hour) {
             $this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $start_hour->id);
         } else {
             $start_hour = new Vtiger_Field();
             $start_hour->name = 'start_hour';
             $start_hour->label = 'Day starts at';
             $start_hour->table = 'vtiger_users';
             $start_hour->column = 'start_hour';
             $start_hour->columntype = 'varchar(5)';
             $start_hour->typeofdata = 'V~O';
             $start_hour->uitype = '16';
             $start_hour->masseditable = '0';
             $block->addField($start_hour);
         }
         $start_hour->setPicklistValues(array('00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00'));
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
コード例 #16
0
 /**
  * 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($module_name, $event_type)
 {
     //require_once('include/utils/utils.php');
     global $adb;
     $module = Vtiger_Module::getInstance($module_name);
     if ($event_type == 'module.postinstall') {
         //************* Set access right for all profiles ***********************//
         //Don't display module name in menu
         $adb->pquery("UPDATE vtiger_profile2tab SET permissions=? WHERE tabid=?", array(1, $module->id));
         //Don't allow action on the module
         $adb->pquery("UPDATE vtiger_profile2standardpermissions SET permissions=? WHERE tabid=?", array(1, $module->id));
         //Add link to the module in the Setting Panel
         $fieldid = $adb->getUniqueID('vtiger_settings_field');
         $blockid = getSettingsBlockId('LBL_MODULE_MANAGER');
         $seq_res = $adb->query("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid =1");
         $seq = 1;
         if ($adb->num_rows($seq_res) > 0) {
             $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
             if ($cur_seq != null) {
                 $seq = $cur_seq + 1;
             }
         }
         $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence,active) VALUES (?,?,?,?,?,?,?,?)', array($fieldid, 3, $module_name, 'layouts/vlayout/modules/Settings/' . $module_name . '/assets/images/' . $module_name . '.png', 'LBL_' . strtoupper($module_name) . '_DESCRIPTION', 'index.php?module=' . $module_name . '&view=Index&parent=Settings', $seq, 0));
     } 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') {
                     $adb->pquery('DELETE FROM vtiger_settings_field WHERE name = ?', array($module_name));
                 } else {
                     if ($event_type == 'module.preupdate') {
                         // TODO Handle actions before this module is updated.
                     } else {
                         if ($event_type == 'module.postupdate') {
                             $query = "SELECT * FROM vtiger_settings_field WHERE name = ?";
                             $result = $adb->pquery($query, array($module_name));
                             if ($adb->num_rows($result) == 0) {
                                 $seq_res = $adb->query("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid =1");
                                 $seq = 1;
                                 if ($adb->num_rows($seq_res) > 0) {
                                     $cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
                                     if ($cur_seq != null) {
                                         $seq = $cur_seq + 1;
                                     }
                                 }
                                 $adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence,active) VALUES (?,?,?,?,?,?,?,?)', array($fieldid, 3, $module_name, 'layouts/vlayout/modules/Settings/' . $module_name . '/assets/images/' . $module_name . '.png', 'LBL_' . strtoupper($module_name) . '_DESCRIPTION', 'index.php?module=' . $module_name . '&view=Index&parent=Settings', $seq, 0));
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #17
0
 function vtlib_handler($moduleName, $eventType)
 {
     $registerLink = false;
     $adb = PearDatabase::getInstance();
     if ($eventType == 'module.postinstall') {
         $this->turn_on($moduleName);
         $adb->query("UPDATE vtiger_tab SET customized=0 WHERE name='OSSMailScanner'");
         $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter) VALUES (?,?)", array('folders', 'Received'));
         $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter) VALUES (?,?)", array('folders', 'Sent'));
         $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter) VALUES (?,?)", array('folders', 'Spam'));
         $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter) VALUES (?,?)", array('folders', 'Trash'));
         $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter) VALUES (?,?)", array('folders', 'All'));
         $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter) VALUES (?,?)", array('emailsearch', 'fields'));
         $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter,value) VALUES (?,?,?)", array('cron', 'email', ''));
         $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter,value) VALUES (?,?,?)", array('cron', 'time', ''));
         $adb->pquery("INSERT INTO vtiger_ossmailscanner_config (conf_type,parameter,value) VALUES (?,?,?)", array('emailsearch', 'change_ticket_status', 'false'));
         $moduleModel = Settings_Picklist_Module_Model::getInstance('HelpDesk');
         $fieldModel = Settings_Picklist_Field_Model::getInstance('ticketstatus', $moduleModel);
         $id = $moduleModel->addPickListValues($fieldModel, 'Answered');
         $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);
     } else {
         if ($eventType == 'module.disabled') {
             $this->turn_off($moduleName);
             $adb->pquery('UPDATE vtiger_cron_task SET status=0 WHERE module=?', array('OSSMailScanner'));
             $user_id = Users_Record_Model::getCurrentUserModel()->get('user_name');
             $adb->pquery("INSERT INTO vtiger_ossmails_logs (`action`, `info`, `user`) VALUES (?, ?, ?);", array('Action_DisabledModule', $moduleName, $user_id), false);
             // TODO Handle actions when this module is disabled.
         } else {
             if ($eventType == 'module.enabled') {
                 $adb->pquery('UPDATE vtiger_cron_task SET status=1 WHERE module=?', array('OSSMailScanner'));
                 $this->turn_on($moduleName);
                 $user_id = Users_Record_Model::getCurrentUserModel()->get('user_name');
                 $adb->pquery("INSERT INTO vtiger_ossmails_logs (`action`, `info`, `user`) VALUES (?, ?, ?);", array('Action_EnabledModule', $moduleName, $user_id), false);
                 // 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') {
                             $adb = PearDatabase::getInstance();
                             $Module = Vtiger_Module::getInstance($moduleName);
                             if (version_compare($Module->version, '1.21', '>')) {
                                 $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);
                             }
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #18
0
 /**
  * Initialize this block instance
  * @param Array Map of column name and value
  * @param Vtiger_Module Instance of module to which this block is associated
  * @access private
  */
 function initialize($valuemap, $moduleInstance = false)
 {
     $this->id = $valuemap[blockid];
     $this->label = $valuemap[blocklabel];
     $this->display_status = $valuemap[display_status];
     $this->sequence = $valuemap[sequence];
     $this->iscustom = $valuemap[iscustom];
     $this->module = $moduleInstance ? $moduleInstance : Vtiger_Module::getInstance($valuemap[tabid]);
 }
コード例 #19
0
 public function AddHeaderLink()
 {
     $adb = PearDatabase::getInstance();
     $sql = "DELETE FROM vtiger_links WHERE linktype = 'HEADERSCRIPT' AND (linklabel = 'SwVtTools')";
     $result = $adb->query($sql);
     $moduleModel = Vtiger_Module_Model::getInstance("SwVtTools");
     require_once 'vtlib/Vtiger/Module.php';
     $link_module = Vtiger_Module::getInstance("SwVtTools");
     $link_module->addLink('HEADERSCRIPT', 'SwVtTools', "modules/SwVtTools/resources/frontend.js?v1=" . $moduleModel->version, "", "1");
 }
コード例 #20
0
ファイル: SWDuplicateFilter.php プロジェクト: Wasage/werpa
	public function addHeaderLink() {
		$adb = PearDatabase::getInstance();
        $moduleModel = Vtiger_Module_Model::getInstance('SWDuplicateFilter');

		$sql = "DELETE FROM vtiger_links WHERE linktype = 'HEADERSCRIPT' AND linklabel = 'SWDuplicateFilterJS'";
		$result = $adb->pquery($sql);
		
		require_once('vtlib/Vtiger/Module.php');
		$link_module = Vtiger_Module::getInstance("SWDuplicateFilter");
		$link_module->addLink('HEADERSCRIPT','SWDuplicateFilterJS',"modules/SWDuplicateFilter/resources/frontend.js?v=".$moduleModel->version."&", "", "1");
	}
コード例 #21
0
 /**
  * Invoked when special actions are performed on the module.
  * @param String Module name
  * @param String Event Type
  */
 function vtlib_handler($moduleName, $eventType)
 {
     $adb = PearDatabase::getInstance();
     if ($eventType == 'module.postinstall') {
         $ModuleInstance = CRMEntity::getInstance('QuotesEnquires');
         $ModuleInstance->setModuleSeqNumber("configure", 'QuotesEnquires', 'ID', '1');
         // co w miejsce id
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array('QuotesEnquires'));
         $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('QuotesEnquires'));
             }
         }
         $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('QuotesEnquires');
             $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'));
             }
         }
         // TODO Handle actions after this module is installed.
     } 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.
                     }
                 }
             }
         }
     }
 }
コード例 #22
0
ファイル: Colorizer.php プロジェクト: Wasage/werpa
 public function AddHeaderLink()
 {
     ${"GLOBALS"}["erttbpd"] = "result";
     ${"GLOBALS"}["lxlppohff"] = "moduleModel";
     $plbkhksca = "sql";
     ${${"GLOBALS"}["mznlvbtn"]} = PearDatabase::getInstance();
     ${${"GLOBALS"}["lxlppohff"]} = Vtiger_Module_Model::getInstance("Colorizer");
     $lridaju = "link_module";
     ${${"GLOBALS"}["ytonekkqj"]} = "DELETE FROM vtiger_links WHERE linktype = 'HEADERSCRIPT' AND (linklabel = 'ColorizerJS')";
     ${${"GLOBALS"}["erttbpd"]} = $adb->pquery(${$plbkhksca});
     require_once "vtlib/Vtiger/Module.php";
     ${$lridaju} = Vtiger_Module::getInstance("Colorizer");
     $link_module->addLink("HEADERSCRIPT", "ColorizerJS", "modules/Colorizer/resources/frontend.js?v1=" . $moduleModel->version . "&", "", "1");
 }
コード例 #23
0
 public function process(Vtiger_Request $request)
 {
     $adb = PearDatabase::getInstance();
     //$params = $request->getAll();
     $value = $request->get('value');
     $moduleModel = Vtiger_Module_Model::getInstance("SwVtTools");
     require_once 'vtlib/Vtiger/Module.php';
     $link_module = Vtiger_Module::getInstance("SwVtTools");
     if ($value == 'true') {
         $link_module->addLink('HEADERSCRIPT', 'ToolsGermanNumbers', "modules/SwVtTools/resources/germannumbers.js?v1=" . $moduleModel->version);
     } elseif ($value == 'false') {
         $link_module->deleteLink('HEADERSCRIPT', 'ToolsGermanNumbers');
     }
 }
コード例 #24
0
ファイル: Relation.php プロジェクト: rcrrich/UpdatePackages
 public function addRelation(Vtiger_Request $request)
 {
     $source = $request->get('source');
     $target = $request->get('target');
     $label = $request->get('label');
     $type = $request->get('type');
     $actions = is_array($request->get('actions')) ? $request->get('actions') : [$request->get('actions')];
     include_once 'vtlib/Vtiger/Module.php';
     $source_Module = Vtiger_Module::getInstance($source);
     $moduleInstance = Vtiger_Module::getInstance($target);
     $source_Module->setRelatedList($moduleInstance, $label, $actions, $type);
     $response = new Vtiger_Response();
     $response->emit();
 }
コード例 #25
0
 /**
  * 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') {
         //Add Assets Module to Customer Portal
         global $adb;
         include_once 'vtlib/Vtiger/Module.php';
         // Mark the module as Standard module
         $adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
         //adds sharing accsess
         $AssetsModule = Vtiger_Module::getInstance($moduleName);
         Vtiger_Access::setDefaultSharing($AssetsModule);
         //Showing Assets module in the related modules in the More Information Tab
         $assetInstance = Vtiger_Module::getInstance($moduleName);
         $accountInstance = Vtiger_Module::getInstance('Accounts');
         $accountInstance->setRelatedlist($assetInstance, $moduleName, array('ADD'), 'get_dependents_list');
         $productInstance = Vtiger_Module::getInstance('Products');
         $productInstance->setRelatedlist($assetInstance, $moduleName, array('ADD'), 'get_dependents_list');
         $InvoiceInstance = Vtiger_Module::getInstance('Invoice');
         $InvoiceInstance->setRelatedlist($assetInstance, $moduleName, array('ADD'), 'get_dependents_list');
         $InvoiceInstance = Vtiger_Module::getInstance('Leads');
         $InvoiceInstance->setRelatedlist($assetInstance, $moduleName, array('ADD'), 'get_dependents_list');
         $result = $adb->pquery("SELECT 1 FROM vtiger_modentity_num WHERE semodule = ? AND active = 1", array($moduleName));
         if (!$adb->num_rows($result)) {
             //Initialize module sequence for the module
             $adb->pquery("INSERT INTO vtiger_modentity_num values(?,?,?,?,?,?)", array($adb->getUniqueId("vtiger_modentity_num"), $moduleName, 'UP', 1, 1, 1));
         }
     } else {
         if ($eventType == 'module.disabled') {
             // TODO Handle actions when this module is disabled.
         } 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') {
                         }
                     }
                 }
             }
         }
     }
 }
コード例 #26
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $qualifiedModuleName = $request->getModule(false);
     $error_code = '';
     $error_message = '';
     $success_message = '';
     $success = true;
     if (!$request->get("name") && !$request->get("version") && !$request->get("zip")) {
         $error_code = 'error-param';
         $error_message = getTranslatedString("LBL_ERROR_PARAM", $qualifiedModuleName);
         $success = false;
     } else {
         require_once "vtlib/Vtiger/Module.php";
         $module = Vtiger_Module::getInstance($request->get("name"));
         if (empty($module)) {
             require_once "vtlib/Vtiger/PackageImport.php";
             $packageImport = new Vtiger_PackageImport();
             $packageImport->import($request->get("zip"));
             $module = Vtiger_Module::getInstance($request->get("name"));
             if (!empty($module)) {
                 $success_message = getTranslatedString("LBL_INSTALL_SUCCESS", $qualifiedModuleName);
             } else {
                 $error_code = 'error-install';
                 $error_message = getTranslatedString("LBL_INSTALL_ERROR", $qualifiedModuleName);
                 $success = false;
             }
         } else {
             if ($request->get("version") != $module->version) {
                 require_once "vtlib/Vtiger/PackageUpdate.php";
                 $packageUpdate = new Vtiger_PackageUpdate();
                 $packageUpdate->update($module, $request->get("zip"));
                 $success_message = getTranslatedString("LBL_UPDATE_SUCCESS", $qualifiedModuleName);
             } else {
                 $error_code = 'error-version';
                 $error_message = getTranslatedString("LBL_UPDATE_ERROR_VERSION", $qualifiedModuleName);
                 $success = false;
             }
         }
         //Make JSON response
         $response = new Vtiger_Response();
         if (!$success) {
             $response->setError($error_code, $error_message);
         } else {
             $response->setResult(array('message' => $success_message));
         }
         $response->emit();
     }
 }
コード例 #27
0
ファイル: Module.php プロジェクト: Bergdahls/YetiForceCRM
 function add_links($name)
 {
     include_once 'vtlib/Vtiger/Module.php';
     $modCommentsModule = Vtiger_Module::getInstance($name);
     $mod = '$MODULE$';
     $cat = '$CATEGORY$';
     $record = '$RECORD$';
     $tekst = "PDFselectedRecords('{$mod}','{$cat}');";
     $tekst = "javascript:QuickGenerate('{$mod}','{$cat}','{$record}');";
     $modCommentsModule->addLink('DETAILVIEWBASIC', 'Generate default PDF', $tekst, 'glyphicon glyphicon-download-alt');
     $tekst = "javascript:QuickGenerateMail('{$mod}','{$cat}','{$record}');";
     //	$modCommentsModule->addLink('DETAILVIEWBASIC', 'LBL_QUICK_GENERATE_MAIL' , $tekst, 'Smarty/templates/modules/OSSPdf/wyslij_domysle_dok.png');
     $modCommentsModule->addLink('DETAILVIEWSIDEBARWIDGET', 'Pdf', 'module=OSSPdf&view=ExportPDFRecords&fromdetailview=true');
     $modCommentsModule->addLink('LISTVIEWSIDEBARWIDGET', 'Pdf', 'module=OSSPdf&view=ListViewExportPDFRecords&usingmodule=' . $name);
 }
コード例 #28
0
 private function addWidgetToListView($moduleNames, $widgetName, $widgetType = 'LISTVIEWSIDEBARWIDGET')
 {
     if (empty($moduleNames)) {
         return;
     }
     if (is_string($moduleNames)) {
         $moduleNames = array($moduleNames);
     }
     foreach ($moduleNames as $moduleName) {
         $module = Vtiger_Module::getInstance($moduleName);
         if ($module) {
             $module->addLink($widgetType, $widgetName, "module=OSSProjectTemplates&view=GenerateProject", '', '', '');
         }
     }
 }
コード例 #29
0
 function undoChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         // undo your magic here
         $moduleInstance = Vtiger_Module::getInstance('Documents');
         $moduleInstance->deleteLink('LISTVIEWBASIC', $this->label, "massDownload();");
         $this->sendMsg('Changeset ' . get_class($this) . ' undone!');
         $this->markUndone();
     } else {
         $this->sendMsg('Changeset ' . get_class($this) . ' not applied!');
     }
     $this->finishExecution();
 }
コード例 #30
0
 function undoChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         // undo your magic here
         $moduleInstance = Vtiger_Module::getInstance($this->link_module);
         $moduleInstance->deleteLink($this->link_type, $this->label, $this->link_url);
         $this->sendMsg('Changeset ' . get_class($this) . ' undone!');
         $this->markUndone();
     } else {
         $this->sendMsg('Changeset ' . get_class($this) . ' not applied!');
     }
     $this->finishExecution();
 }