Hooks system: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 29: Line 29:


<source lang="php">
<source lang="php">
/**
/**
* Function called when module is disabled.
* Function called when module is disabled.
*              Remove from database constants, boxes and permissions from Dolibarr database.
*              Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted.
* Data directories are not deleted.
*      @return    int            1 if OK, 0 if KO
*      @return    int            1 if OK, 0 if KO
*/
*/
function remove()
function remove()
{
{
$sql = array("DELETE FROM ".MAIN_DB_PREFIX."const WHERE name like '%_mymodulename' OR name like '%_mymodulename_%';");
$sql = array("DELETE FROM ".MAIN_DB_PREFIX."const WHERE name like '%_mymodulename' OR name like '%_mymodulename_%';");
 
return $this->_remove($sql);
return $this->_remove($sql);
}
}
</source>
</source>


Line 61: Line 60:
     *  @return      void  
     *  @return      void  
     */  
     */  
     function doActions($parameters, $object, $action) {  
     function doActions($parameters, $object, $action)  
    {  
         print_r($parameters);  
         print_r($parameters);  
         echo "action: ".$action;  
         echo "action: ".$action;  
         print_r($object);  
         print_r($object);  
   
   
         if ($parameters->context == 'somecontext') {  
         if ($parameters->context == 'somecontext')  
           // do something only for the context 'somecontext'}  
        {  
           // do something only for the context 'somecontext'
        }
    }
}  
</source>
</source>


Navigation menu