2019-05-19 10:44:09 +02:00
< ? php
2019-05-21 09:55:41 +02:00
/* Copyright ( C ) 2003 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
* Copyright ( C ) 2004 - 2012 Laurent Destailleur < eldy @ users . sourceforge . net >
* Copyright ( C ) 2005 - 2012 Regis Houssin < regis . houssin @ capnetworks . com >
* Copyright ( C ) 2019 Open - DSI < support @ open - dsi . fr >
2019-05-19 10:44:09 +02:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2022-09-07 20:21:01 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2019-05-19 10:44:09 +02:00
*/
/**
* \file htdocs / core / modules / modIntracommreport . class . php
* \ingroup Intracomm report
2021-03-20 13:55:43 +01:00
* \brief Description and activation file for the module intracomm report
2019-05-19 10:44:09 +02:00
*/
2020-10-31 14:32:18 +01:00
include_once DOL_DOCUMENT_ROOT . '/core/modules/DolibarrModules.class.php' ;
2019-05-19 10:44:09 +02:00
/**
* Description and activation class for module intracommreport
*/
class modIntracommreport extends DolibarrModules
{
/**
* Constructor . Define names , constants , directories , boxes , permissions
*
* @ param DoliDB $db Database handler
*/
2020-07-06 04:47:27 +02:00
public function __construct ( $db )
2019-05-19 10:44:09 +02:00
{
2020-10-31 14:32:18 +01:00
global $conf , $langs ;
2019-05-19 10:44:09 +02:00
2020-10-31 14:32:18 +01:00
$this -> db = $db ;
$this -> numero = 68000 ;
2019-05-19 10:44:09 +02:00
2020-10-31 14:32:18 +01:00
$this -> family = " financial " ;
2021-03-25 11:24:46 +01:00
$this -> module_position = '60' ;
2020-10-31 14:32:18 +01:00
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this -> name = preg_replace ( '/^mod/i' , '' , get_class ( $this ));
$this -> description = " Intracomm report management (Support for French DEB/DES format) " ;
2019-05-19 10:44:09 +02:00
2020-10-31 14:32:18 +01:00
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
2022-05-02 20:21:58 +02:00
$this -> version = 'development' ;
2019-05-19 10:44:09 +02:00
2020-10-31 18:51:30 +01:00
$this -> const_name = 'MAIN_MODULE_' . strtoupper ( $this -> name );
2020-10-31 14:32:18 +01:00
$this -> picto = 'intracommreport' ;
2019-05-19 10:44:09 +02:00
2020-10-31 14:32:18 +01:00
// Data directories to create when module is enabled
$this -> dirs = array ( '/intracommreport/temp' );
2019-05-19 10:44:09 +02:00
2020-10-31 14:32:18 +01:00
// Config pages
$this -> config_page_url = array ( " intracommreport.php@intracommreport " );
2019-05-19 10:44:09 +02:00
// Dependencies
2020-12-17 06:02:28 +01:00
$this -> depends = array ( " modFacture " , " modTax " , " modCategorie " ); // List of modules id that must be enabled if this module is enabled
2020-10-31 14:32:18 +01:00
$this -> requiredby = array (); // List of modules id to disable if this one is disabled
$this -> conflictwith = array (); // List of modules id this module is in conflict with
2022-09-27 20:48:47 +02:00
$this -> phpmin = array ( 7 , 0 ); // Minimum version of PHP required by module
2020-10-31 14:32:18 +01:00
$this -> need_dolibarr_version = array ( 13 , 0 , - 5 ); // Minimum version of Dolibarr required by module
2019-05-19 10:44:09 +02:00
$this -> langfiles = array ( " intracommreport " );
// Constants
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
// );
$this -> const = array ();
2020-10-31 14:32:18 +01:00
// Tabs
$this -> tabs = array ();
2019-05-19 10:44:09 +02:00
2020-10-31 14:32:18 +01:00
// Css
$this -> module_parts = array ();
2019-05-19 10:44:09 +02:00
2020-10-31 14:32:18 +01:00
// Boxes
$this -> boxes = array ();
2019-05-19 10:44:09 +02:00
2020-10-31 14:32:18 +01:00
// Dictionaries
2021-02-23 22:03:23 +01:00
if ( ! isset ( $conf -> intracommreport -> enabled )) {
2020-10-31 18:51:30 +01:00
$conf -> intracommreport = new stdClass ();
$conf -> intracommreport -> enabled = 0 ;
2020-10-31 14:32:18 +01:00
}
2020-10-31 18:51:30 +01:00
$this -> dictionaries = array ();
2019-05-19 10:44:09 +02:00
2020-10-31 14:32:18 +01:00
// Permissions
2020-07-06 09:56:28 +02:00
$this -> rights = array ();
$this -> rights_class = 'intracommreport' ;
2020-10-31 14:32:18 +01:00
$r = 0 ;
2019-05-21 09:55:41 +02:00
2020-07-06 09:56:28 +02:00
$r ++ ;
2020-10-31 14:32:18 +01:00
$this -> rights [ $r ][ 0 ] = 68001 ;
$this -> rights [ $r ][ 1 ] = 'Read intracomm report' ;
$this -> rights [ $r ][ 2 ] = 'r' ;
$this -> rights [ $r ][ 3 ] = 0 ;
$this -> rights [ $r ][ 4 ] = 'read' ;
$r ++ ;
$this -> rights [ $r ][ 0 ] = 68002 ;
$this -> rights [ $r ][ 1 ] = 'Create/modify intracomm report' ;
$this -> rights [ $r ][ 2 ] = 'w' ;
$this -> rights [ $r ][ 3 ] = 0 ;
$this -> rights [ $r ][ 4 ] = 'write' ;
$r ++ ;
$this -> rights [ $r ][ 0 ] = 68004 ;
$this -> rights [ $r ][ 1 ] = 'Delete intracomm report' ;
$this -> rights [ $r ][ 2 ] = 'd' ;
$this -> rights [ $r ][ 3 ] = 0 ;
$this -> rights [ $r ][ 4 ] = 'delete' ;
2019-06-20 09:33:01 +02:00
2019-05-19 10:44:09 +02:00
// Main menu entries
2020-10-31 14:32:18 +01:00
$this -> menu = array (); // List of menus to add
$r = 0 ;
2019-05-21 09:55:41 +02:00
2019-05-19 10:44:09 +02:00
// Exports
2020-10-31 14:32:18 +01:00
$r = 1 ;
2019-05-19 10:44:09 +02:00
}
2022-02-06 13:31:44 +01:00
/**
* Function called when module is enabled .
* The init function add constants , boxes , permissions and menus ( defined in constructor ) into Dolibarr database .
* It also creates data directories
*
* @ param string $options Options when enabling module ( '' , 'noboxes' )
* @ return int 1 if OK , 0 if KO
*/
public function init ( $options = '' )
{
global $conf ;
2022-05-08 15:18:34 +02:00
$result = $this -> _load_tables ( '/install/mysql/' , 'intracommreport' );
2022-02-06 13:31:44 +01:00
if ( $result < 0 ) {
return - 1 ; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}
$sql = array ();
return $this -> _init ( $sql , $options );
}
2019-05-19 10:44:09 +02:00
}