2004-10-19 22:24:10 +00:00
|
|
|
<?php
|
2005-05-14 14:22:08 +00:00
|
|
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2008-02-16 17:50:25 +00:00
|
|
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
2005-05-14 14:22:08 +00:00
|
|
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
|
|
|
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
2003-09-14 10:35:52 +00: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
|
2013-01-16 14:36:08 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-09-14 10:35:52 +00:00
|
|
|
* (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
|
2019-09-23 19:55:30 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2003-09-14 10:35:52 +00:00
|
|
|
*/
|
|
|
|
|
|
2011-08-27 16:15:06 +00:00
|
|
|
/**
|
|
|
|
|
* \defgroup comptabilite Module comptabilite
|
|
|
|
|
* \brief Module pour inclure des fonctions de comptabilite (gestion de comptes comptables et rapports)
|
2011-10-24 12:11:49 +00:00
|
|
|
* \file htdocs/core/modules/modComptabilite.class.php
|
2011-08-27 16:15:06 +00:00
|
|
|
* \ingroup comptabilite
|
2021-03-20 12:55:43 +00:00
|
|
|
* \brief Description and activation file for the module simple accountancy
|
2011-08-27 16:15:06 +00:00
|
|
|
*/
|
2007-10-09 23:15:25 +00:00
|
|
|
|
2020-04-10 08:59:32 +00:00
|
|
|
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
2003-09-14 10:35:52 +00:00
|
|
|
|
2006-07-23 01:38:43 +00:00
|
|
|
|
|
|
|
|
/**
|
2015-09-07 13:55:26 +00:00
|
|
|
* Class to describe and enable module Comptabilite
|
2011-09-26 14:22:35 +00:00
|
|
|
*/
|
2003-11-13 15:09:12 +00:00
|
|
|
class modComptabilite extends DolibarrModules
|
2003-09-14 10:35:52 +00:00
|
|
|
{
|
|
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
/**
|
|
|
|
|
* Constructor. Define names, constants, directories, boxes, permissions
|
|
|
|
|
*
|
|
|
|
|
* @param DoliDB $db Database handler
|
|
|
|
|
*/
|
2019-02-25 19:35:59 +00:00
|
|
|
public function __construct($db)
|
2006-07-23 01:38:43 +00:00
|
|
|
{
|
|
|
|
|
global $conf;
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2012-01-04 20:23:50 +00:00
|
|
|
$this->db = $db;
|
|
|
|
|
$this->numero = 10;
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2006-07-23 01:38:43 +00:00
|
|
|
$this->family = "financial";
|
2018-10-06 09:57:53 +00:00
|
|
|
$this->module_position = '60';
|
2008-10-01 19:10:17 +00:00
|
|
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
2019-01-27 10:55:16 +00:00
|
|
|
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
2008-10-01 19:10:17 +00:00
|
|
|
$this->description = "Gestion sommaire de comptabilite";
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2008-12-15 22:25:59 +00:00
|
|
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
|
|
|
|
$this->version = 'dolibarr';
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2008-10-06 07:39:52 +00:00
|
|
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
2021-04-30 13:22:17 +00:00
|
|
|
$this->picto = 'accountancy';
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2006-07-23 01:38:43 +00:00
|
|
|
// Config pages
|
2006-12-05 23:20:18 +00:00
|
|
|
$this->config_page_url = array("compta.php");
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2015-09-07 13:29:51 +00:00
|
|
|
// Dependencies
|
2020-04-10 08:59:32 +00:00
|
|
|
$this->depends = array("modFacture", "modBanque");
|
2006-07-23 01:38:43 +00:00
|
|
|
$this->requiredby = array();
|
2009-06-16 20:21:51 +00:00
|
|
|
$this->conflictwith = array("modAccounting");
|
2006-07-23 01:38:43 +00:00
|
|
|
$this->langfiles = array("compta");
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2015-09-07 13:40:55 +00:00
|
|
|
// Constants
|
2006-07-23 01:38:43 +00:00
|
|
|
$this->const = array();
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2009-04-28 13:52:08 +00:00
|
|
|
// Data directories to create when module is enabled
|
2020-10-31 13:32:18 +00:00
|
|
|
$this->dirs = array(
|
|
|
|
|
"/comptabilite/temp",
|
|
|
|
|
"/comptabilite/rapport",
|
|
|
|
|
"/comptabilite/export",
|
|
|
|
|
"/comptabilite/bordereau"
|
|
|
|
|
);
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2015-09-07 13:46:57 +00:00
|
|
|
// Boxes
|
2006-07-23 01:38:43 +00:00
|
|
|
$this->boxes = array();
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2006-07-23 01:38:43 +00:00
|
|
|
// Permissions
|
|
|
|
|
$this->rights = array();
|
|
|
|
|
$this->rights_class = 'compta';
|
2020-04-10 08:59:32 +00:00
|
|
|
$r = 0;
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2006-07-23 01:38:43 +00:00
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 95;
|
2008-10-28 20:37:30 +00:00
|
|
|
$this->rights[$r][1] = 'Lire CA, bilans, resultats';
|
2006-07-23 01:38:43 +00:00
|
|
|
$this->rights[$r][2] = 'r';
|
2016-06-04 10:16:30 +00:00
|
|
|
$this->rights[$r][3] = 0;
|
2006-07-23 01:38:43 +00:00
|
|
|
$this->rights[$r][4] = 'resultat';
|
|
|
|
|
$this->rights[$r][5] = 'lire';
|
2018-02-25 09:55:02 +00:00
|
|
|
|
|
|
|
|
|
2016-09-30 11:02:13 +00:00
|
|
|
// Menus
|
|
|
|
|
//-------
|
2020-04-10 08:59:32 +00:00
|
|
|
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
2006-07-23 01:38:43 +00:00
|
|
|
}
|
2005-05-14 14:22:08 +00:00
|
|
|
|
|
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
/**
|
|
|
|
|
* Function called when module is enabled.
|
2019-02-26 20:13:07 +00:00
|
|
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
|
|
|
|
* It also creates data directories
|
2012-01-04 20:23:50 +00:00
|
|
|
*
|
2020-10-31 13:32:18 +00:00
|
|
|
* @param string $options Options when enabling module ('', 'noboxes')
|
|
|
|
|
* @return int 1 if OK, 0 if KO
|
|
|
|
|
*/
|
|
|
|
|
public function init($options = '')
|
|
|
|
|
{
|
2006-07-23 01:38:43 +00:00
|
|
|
global $conf;
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2006-07-23 01:38:43 +00:00
|
|
|
// Nettoyage avant activation
|
2012-03-03 16:37:45 +00:00
|
|
|
$this->remove($options);
|
2009-06-16 20:21:51 +00:00
|
|
|
|
2011-12-05 18:03:36 +00:00
|
|
|
$sql = array();
|
2012-01-04 20:23:50 +00:00
|
|
|
|
2019-01-27 10:55:16 +00:00
|
|
|
return $this->_init($sql, $options);
|
2006-07-23 01:38:43 +00:00
|
|
|
}
|
2003-09-14 10:35:52 +00:00
|
|
|
}
|