Example #1
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.
                         }
                     }
                 }
             }
         }
     }
 }