function updateCustomLinks($addlinks = true) { global $adb, $mod_strings, $currentModule, $vtiger_current_version; getRelativeModules($module, $search, $enabled); if ($currentModule == 'Accounting') { $mod_strings_aux = $mod_strings; } else { $mod_strings_aux = return_module_language($_SESSION["authenticated_user_language"], 'Accounting'); } $sendfax_label = $mod_strings_aux['_LBL_ACC_SELECT_ACC'] == "" ? "Send ACC" : $mod_strings_aux['_LBL_ACC_SELECT_ACC']; $config = Accounting::loadConfigParams(); $bFixCustomLinksBug = isset($config["fixcustomlinksbug"]) && $config["fixcustomlinksbug"] == "true" ? true : false; preg_match_all('/([\\d.]+)/', $vtiger_current_version, $match); $vtiger_current_version = implode("", $match[0]); if (version_compare($vtiger_current_version, '5.2.0', '>=')) { $bFixCustomLinksBug = true; Accounting::updateConfigParam("fixcustomlinksbug", "true"); } $adb->pquery('DELETE FROM vtiger_links WHERE linktype=? AND linkurl=?', array('HEADERSCRIPT', 'modules/Accounting/LinkToACC.js.php?module=$MODULE$')); $adb->pquery('DELETE FROM vtiger_links WHERE linktype=? AND linkurl=?', array('HEADERSCRIPT', 'modules/Accounting/LinkToACC.js')); $adb->pquery('DELETE FROM vtiger_links WHERE linktype=? AND linkurl=?', array('LISTVIEWBASIC', 'return _onFaxSendShowQuickDivFix(\'$MODULE$\',this)')); $adb->pquery('DELETE FROM vtiger_links WHERE linktype=? AND linkurl=?', array('LISTVIEWBASIC', 'return _onFaxSendShowQuickDiv(\'$MODULE$\',this)')); $adb->pquery('DELETE FROM vtiger_links WHERE linktype=? AND linkurl=?', array('DETAILVIEWBASIC', 'index.php?module=Accounting&action=EditView&return_module=$MODULE$&return_action=DetailView&return_id=$RECORD$&parent_id=$RECORD$&linkAction=true')); if ($addlinks == false) { return; } $mods = Accounting::loadModsButtons(); include_once 'vtlib/Vtiger/Module.php'; foreach ($mods as $mod) { $mod[1] = $mod[1] == 1 ? "true" : "false"; $mod[2] = $mod[2] == 1 ? "true" : "false"; $module = Vtiger_Module::getInstance($mod[0]); if ($mod[2] == "true") { $checkres = $adb->pquery('SELECT linkid FROM vtiger_links WHERE tabid=? AND linktype=? AND linkurl=? AND linkicon=?', array($module->id, 'DETAILVIEWBASIC', 'index.php?module=Accounting&action=EditView&return_module=$MODULE$&return_action=DetailView&return_id=$RECORD$&parent_id=$RECORD$&linkAction=true', 'modules/Accounting/images/ACC_Send.gif')); if (!$adb->num_rows($checkres)) { $adb->pquery('INSERT INTO vtiger_links (linkid,tabid,linktype,linklabel,linkurl,linkicon,sequence) VALUES(?,?,?,?,?,?,?)', array($adb->getUniqueID('vtiger_links'), $module->id, 'DETAILVIEWBASIC', $sendfax_label, 'index.php?module=Accounting&action=EditView&return_module=$MODULE$&return_action=DetailView&return_id=$RECORD$&parent_id=$RECORD$&linkAction=true', 'modules/Accounting/images/ACC_Send.gif', 0)); } } if ($mod[1] == "true") { if ($bFixCustomLinksBug == false) { $type = 'HEADERSCRIPT'; $url = 'modules/Accounting/LinkToACC.js.php?module=$MODULE$'; } else { $type = 'LISTVIEWBASIC'; $url = 'return _onFaxSendShowQuickDivFix(\'$MODULE$\',this)'; } $checkres = $adb->pquery('SELECT linkid FROM vtiger_links WHERE tabid=? AND linktype=? AND linkurl=?', array($module->id, $type, $url)); if (!$adb->num_rows($checkres)) { $adb->pquery('INSERT INTO vtiger_links (linkid,tabid,linktype,linklabel,linkurl,sequence) VALUES(?,?,?,?,?,?)', array($adb->getUniqueID('vtiger_links'), $module->id, $type, $sendfax_label, $url, 0)); } $checkres = $adb->pquery('SELECT linkid FROM vtiger_links WHERE tabid=? AND linktype=? AND linkurl=?', array($module->id, 'HEADERSCRIPT', 'modules/Accounting/LinkToACC.js')); if (!$adb->num_rows($checkres)) { $adb->pquery('INSERT INTO vtiger_links (linkid,tabid,linktype,linklabel,linkurl,sequence) VALUES(?,?,?,?,?,?)', array($adb->getUniqueID('vtiger_links'), $module->id, 'HEADERSCRIPT', $sendfax_label, 'modules/Accounting/LinkToACC.js', 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) { if ($event_type == 'module.postinstall') { global $adb; // Configure module seq number $entity_tmp = new CRMEntity(); Accounting::checkConfig(0); $entity_tmp->setModuleSeqNumber("configure", "Accounting", "PAY", 1); // Configure workflow Accounting::configure_workflows(); Accounting::updateConfigParam('customlinks', 'true'); Accounting::updateCustomLinks(array("Leads", "Contacts", "Vendors", "Accounts", "Invoice", "PurchaseOrder", "SalesOrder", "Invoice"), 'true'); Accounting::setRelatedModules('false'); Accounting::setRelatedModules('true'); } else { if ($event_type == 'module.disabled') { Accounting::setRelatedModules('false'); // TODO Handle actions when this module is disabled. } else { if ($event_type == 'module.enabled') { Accounting::setRelatedModules('true'); // 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. Accounting::setRelatedModules('false'); } else { if ($event_type == 'module.preupdate') { // TODO Handle actions before this module is updated. } else { if ($event_type == 'module.postupdate') { Accounting::updateDateFields(); Accounting::checkConfig(1); Accounting::setRelatedModules('false'); Accounting::setRelatedModules('true'); Accounting::configure_workflows(); // TODO Handle actions after this module is updated. } } } } } } }
Accounting::updateConfigParam('paymentwfpaid', $_REQUEST["paidPayment"]); Accounting::updateConfigParam('paymentwfpending', $_REQUEST["pendingPayment"]); Accounting::updateConfigParam('paymentwf', $_REQUEST["wfstatuspayment"]); Accounting::updateConfigParam('createpaymentwf', $_REQUEST["wfstatuscreatepayment"]); Accounting::updateConfigParam('wf_nopayments', $_REQUEST["createPayNo"]); Accounting::updateConfigParam('wf_frecuency', $_REQUEST["createPayFrec"]); Accounting::updateConfigParam('wf_firstpaymentdate', $_REQUEST["createPayDate"]); Accounting::updateConfigParam('wf_firstpaymentamount', $_REQUEST["createPayAmount"]); Accounting::updateConfigParam('associnvoice', $_REQUEST["associnvoice"]); Accounting::updateConfigParam('customlinks', $_REQUEST["addcustomlink"]); Accounting::updateCustomLinks(array("Project", "Potentials", "Leads", "Contacts", "Vendors", "Accounts", "Invoice", "PurchaseOrder", "SalesOrder", "Invoice"), $_REQUEST["addcustomlink"]); Accounting::updateTransactionMethods($_REQUEST['methodslist']); Accounting::updateConfigParam('showvat', $_REQUEST["showvat"]); Accounting::updateConfigParam('hidepopup', $_REQUEST["hidepopup"]); Accounting::updateConfigParam('defaultcurrency', $_REQUEST["defaultcurrency"]); Accounting::updateConfigParam('populateamount', $_REQUEST["populateamount"]); } } } } } } } } } } } } } } }