2004-10-20 00:24:10 +02:00
|
|
|
<?php
|
2005-07-31 01:22:07 +02:00
|
|
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2008-02-25 17:48:16 +01:00
|
|
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 15:13:49 +01:00
|
|
|
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
2011-02-18 18:12:22 +01:00
|
|
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
2004-05-01 02:50:27 +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
|
2013-01-16 15:36:08 +01:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2004-05-01 02:50:27 +02: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
|
2011-08-01 01:24:38 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-05-01 02:50:27 +02:00
|
|
|
*/
|
|
|
|
|
|
2005-06-11 13:35:12 +02:00
|
|
|
/**
|
2009-07-30 00:52:08 +02:00
|
|
|
* \defgroup contrat Module contract
|
|
|
|
|
* \brief Module pour gerer la tenue de contrat de services
|
2011-10-24 14:11:49 +02:00
|
|
|
* \file htdocs/core/modules/modContrat.class.php
|
2009-07-30 00:52:08 +02:00
|
|
|
* \ingroup contrat
|
|
|
|
|
* \brief Fichier de description et activation du module Contrat
|
2009-05-04 13:40:00 +02:00
|
|
|
*/
|
2004-08-14 14:21:24 +02:00
|
|
|
|
2012-08-23 02:04:35 +02:00
|
|
|
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
2004-05-01 02:50:27 +02:00
|
|
|
|
2005-08-14 20:19:30 +02:00
|
|
|
|
|
|
|
|
/**
|
2012-10-03 00:30:50 +02:00
|
|
|
* Classe de description et activation du module Contrat
|
2009-05-04 13:40:00 +02:00
|
|
|
*/
|
2004-05-01 02:50:27 +02:00
|
|
|
class modContrat extends DolibarrModules
|
|
|
|
|
{
|
|
|
|
|
|
2009-05-04 13:40:00 +02:00
|
|
|
/**
|
2011-09-26 16:22:35 +02:00
|
|
|
* Constructor. Define names, constants, directories, boxes, permissions
|
|
|
|
|
*
|
2012-01-04 21:23:50 +01:00
|
|
|
* @param DoliDB $db Database handler
|
2009-05-04 13:40:00 +02:00
|
|
|
*/
|
2012-07-30 17:17:33 +02:00
|
|
|
function __construct($db)
|
2009-05-04 13:40:00 +02:00
|
|
|
{
|
2012-01-04 21:23:50 +01:00
|
|
|
$this->db = $db;
|
|
|
|
|
$this->numero = 54;
|
2005-08-14 20:19:30 +02:00
|
|
|
|
2009-05-04 13:40:00 +02:00
|
|
|
$this->family = "crm";
|
2008-10-01 21:10:17 +02:00
|
|
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
|
2009-10-21 15:09:42 +02:00
|
|
|
$this->name = preg_replace('/^mod/i','',get_class($this));
|
2009-05-04 13:40:00 +02:00
|
|
|
$this->description = "Gestion des contrats de services";
|
2005-08-14 20:19:30 +02:00
|
|
|
|
2008-12-15 23:25:59 +01:00
|
|
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
|
|
|
|
$this->version = 'dolibarr';
|
2009-05-04 13:40:00 +02:00
|
|
|
|
|
|
|
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
|
|
|
|
$this->special = 0;
|
|
|
|
|
$this->picto='contract';
|
|
|
|
|
|
|
|
|
|
// Data directories to create when module is enabled
|
2013-08-26 14:29:46 +02:00
|
|
|
$this->dirs = array("/contract/temp");
|
2009-05-04 13:40:00 +02:00
|
|
|
|
|
|
|
|
// Dependances
|
2012-07-22 01:03:19 +02:00
|
|
|
$this->depends = array("modSociete","modService");
|
2009-05-04 13:40:00 +02:00
|
|
|
$this->requiredby = array();
|
2011-05-03 19:58:01 +02:00
|
|
|
|
2011-02-18 18:12:22 +01:00
|
|
|
// Config pages
|
|
|
|
|
$this->config_page_url = array("contract.php");
|
2009-05-04 13:40:00 +02:00
|
|
|
|
|
|
|
|
// Constantes
|
|
|
|
|
$this->const = array();
|
2011-02-18 18:12:22 +01:00
|
|
|
$this->const[0][0] = "CONTRACT_ADDON";
|
|
|
|
|
$this->const[0][1] = "chaine";
|
2011-05-03 19:58:01 +02:00
|
|
|
$this->const[0][2] = "mod_contract_serpis";
|
2011-02-18 18:12:22 +01:00
|
|
|
$this->const[0][3] = 'Nom du gestionnaire de numerotation des contrats';
|
|
|
|
|
$this->const[0][4] = 0;
|
2011-05-03 19:58:01 +02:00
|
|
|
|
2010-04-19 08:43:15 +02:00
|
|
|
// Boxes
|
2009-05-04 13:40:00 +02:00
|
|
|
$this->boxes = array();
|
2010-04-19 08:43:15 +02:00
|
|
|
$this->boxes[0][1] = "box_contracts.php";
|
2011-11-23 18:10:10 +01:00
|
|
|
$this->boxes[1][1] = "box_services_expired.php";
|
2009-05-04 13:40:00 +02:00
|
|
|
|
|
|
|
|
// Permissions
|
|
|
|
|
$this->rights = array();
|
|
|
|
|
$this->rights_class = 'contrat';
|
|
|
|
|
|
|
|
|
|
$this->rights[1][0] = 161;
|
|
|
|
|
$this->rights[1][1] = 'Lire les contrats';
|
|
|
|
|
$this->rights[1][2] = 'r';
|
|
|
|
|
$this->rights[1][3] = 1;
|
|
|
|
|
$this->rights[1][4] = 'lire';
|
|
|
|
|
|
|
|
|
|
$this->rights[2][0] = 162;
|
|
|
|
|
$this->rights[2][1] = 'Creer / modifier les contrats';
|
|
|
|
|
$this->rights[2][2] = 'w';
|
|
|
|
|
$this->rights[2][3] = 0;
|
|
|
|
|
$this->rights[2][4] = 'creer';
|
|
|
|
|
|
|
|
|
|
$this->rights[3][0] = 163;
|
|
|
|
|
$this->rights[3][1] = 'Activer un service d\'un contrat';
|
|
|
|
|
$this->rights[3][2] = 'w';
|
|
|
|
|
$this->rights[3][3] = 0;
|
|
|
|
|
$this->rights[3][4] = 'activer';
|
|
|
|
|
|
|
|
|
|
$this->rights[4][0] = 164;
|
|
|
|
|
$this->rights[4][1] = 'Desactiver un service d\'un contrat';
|
|
|
|
|
$this->rights[4][2] = 'w';
|
|
|
|
|
$this->rights[4][3] = 0;
|
|
|
|
|
$this->rights[4][4] = 'desactiver';
|
|
|
|
|
|
|
|
|
|
$this->rights[5][0] = 165;
|
|
|
|
|
$this->rights[5][1] = 'Supprimer un contrat';
|
|
|
|
|
$this->rights[5][2] = 'd';
|
|
|
|
|
$this->rights[5][3] = 0;
|
|
|
|
|
$this->rights[5][4] = 'supprimer';
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2012-01-04 21:23:50 +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
|
2009-05-04 13:40:00 +02:00
|
|
|
*/
|
2012-01-04 21:23:50 +01:00
|
|
|
function init($options='')
|
2009-05-04 13:40:00 +02:00
|
|
|
{
|
|
|
|
|
global $conf;
|
|
|
|
|
|
2011-05-03 19:58:01 +02:00
|
|
|
// Nettoyage avant activation
|
2012-03-03 17:37:45 +01:00
|
|
|
$this->remove($options);
|
2011-05-03 19:58:01 +02:00
|
|
|
|
2011-12-05 19:03:36 +01:00
|
|
|
$sql = array();
|
|
|
|
|
|
2012-01-04 21:23:50 +01:00
|
|
|
return $this->_init($sql,$options);
|
2009-05-04 13:40:00 +02:00
|
|
|
}
|
|
|
|
|
|
2012-03-03 17:37:45 +01:00
|
|
|
/**
|
|
|
|
|
* Function called when module is disabled.
|
|
|
|
|
* Remove from database constants, boxes and permissions from Dolibarr database.
|
|
|
|
|
* Data directories are not deleted
|
|
|
|
|
*
|
|
|
|
|
* @param string $options Options when enabling module ('', 'noboxes')
|
|
|
|
|
* @return int 1 if OK, 0 if KO
|
|
|
|
|
*/
|
|
|
|
|
function remove($options='')
|
|
|
|
|
{
|
2009-05-04 13:40:00 +02:00
|
|
|
$sql = array();
|
|
|
|
|
|
2012-03-03 17:37:45 +01:00
|
|
|
return $this->_remove($sql,$options);
|
|
|
|
|
}
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2004-05-01 02:50:27 +02:00
|
|
|
}
|
|
|
|
|
?>
|