2004-10-20 00:24:10 +02:00
|
|
|
<?php
|
2005-01-24 10:20:57 +01:00
|
|
|
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
2010-06-14 23:16:52 +02:00
|
|
|
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
2012-12-30 15:13:49 +01:00
|
|
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
2011-01-15 09:51:22 +01:00
|
|
|
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
2004-09-22 12:16:34 +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-09-22 12:16:34 +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-09-22 12:16:34 +02:00
|
|
|
*/
|
|
|
|
|
|
2005-04-05 16:33:56 +02:00
|
|
|
/**
|
2008-12-15 23:17:49 +01:00
|
|
|
* \defgroup prelevement Module prelevement
|
|
|
|
|
* \brief Module de gestion des prelevements bancaires
|
2011-10-24 14:11:49 +02:00
|
|
|
* \file htdocs/core/modules/modPrelevement.class.php
|
2011-08-31 12:27:17 +02:00
|
|
|
* \ingroup prelevement
|
|
|
|
|
* \brief Fichier de description et activation du module Prelevement
|
2008-10-01 21:10:17 +02:00
|
|
|
*/
|
2007-10-10 01:15:25 +02:00
|
|
|
|
2012-08-23 02:04:35 +02:00
|
|
|
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
2004-09-22 12:16:34 +02:00
|
|
|
|
2006-07-23 03:38:43 +02:00
|
|
|
|
2005-04-05 16:33:56 +02:00
|
|
|
/**
|
2015-09-07 15:55:26 +02:00
|
|
|
* Class to describe and enable module Prelevement
|
2008-10-01 21:10:17 +02:00
|
|
|
*/
|
2004-09-22 12:16:34 +02:00
|
|
|
class modPrelevement extends DolibarrModules
|
|
|
|
|
{
|
|
|
|
|
|
2008-10-01 21:10:17 +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
|
2008-10-01 21:10:17 +02:00
|
|
|
*/
|
2012-07-30 17:17:33 +02:00
|
|
|
function __construct($db)
|
2006-07-23 03:38:43 +02:00
|
|
|
{
|
|
|
|
|
global $conf;
|
2008-10-01 21:10:17 +02:00
|
|
|
|
2012-01-04 21:23:50 +01:00
|
|
|
$this->db = $db;
|
|
|
|
|
$this->numero = 57;
|
2008-10-01 21:10:17 +02:00
|
|
|
|
2006-07-23 03:38:43 +02:00
|
|
|
$this->family = "financial";
|
2015-11-17 00:58:12 +01:00
|
|
|
$this->module_position = 520;
|
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));
|
2008-10-01 21:10:17 +02:00
|
|
|
$this->description = "Gestion des Prelevements";
|
|
|
|
|
|
2008-12-15 23:17:49 +01:00
|
|
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
2010-09-05 15:24:59 +02:00
|
|
|
$this->version = 'dolibarr';
|
2008-10-01 21:10:17 +02:00
|
|
|
|
2008-10-06 09:39:52 +02:00
|
|
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
2006-07-23 03:38:43 +02:00
|
|
|
$this->special = 0;
|
2008-02-19 20:10:24 +01:00
|
|
|
// Name of png file (without png) used for this module
|
|
|
|
|
$this->picto='payment';
|
2009-05-04 13:40:00 +02:00
|
|
|
|
2009-04-28 23:49:08 +02:00
|
|
|
// Data directories to create when module is enabled
|
2009-05-04 13:40:00 +02:00
|
|
|
$this->dirs = array("/prelevement/temp","/prelevement/receipts");
|
2008-10-01 21:10:17 +02:00
|
|
|
|
2008-12-15 23:17:49 +01:00
|
|
|
// Dependancies
|
2011-01-25 23:12:47 +01:00
|
|
|
$this->depends = array("modFacture","modBanque");
|
2006-07-23 03:38:43 +02:00
|
|
|
$this->requiredby = array();
|
2010-09-05 15:24:59 +02:00
|
|
|
|
2010-06-15 10:43:50 +02:00
|
|
|
// Config pages
|
|
|
|
|
$this->config_page_url = array("prelevement.php");
|
2008-10-01 21:10:17 +02:00
|
|
|
|
2015-09-07 15:40:55 +02:00
|
|
|
// Constants
|
2006-07-23 03:38:43 +02:00
|
|
|
$this->const = array();
|
2016-09-19 00:26:30 +02:00
|
|
|
$r=0;
|
|
|
|
|
|
|
|
|
|
$this->const[$r][0] = "BANK_ADDON_PDF";
|
|
|
|
|
$this->const[$r][1] = "chaine";
|
|
|
|
|
$this->const[$r][2] = "sepamandate";
|
|
|
|
|
$this->const[$r][3] = 'Name of manager to generate SEPA mandate';
|
|
|
|
|
$this->const[$r][4] = 0;
|
|
|
|
|
$r++;
|
|
|
|
|
|
|
|
|
|
|
2015-09-07 15:46:57 +02:00
|
|
|
// Boxes
|
2006-07-23 03:38:43 +02:00
|
|
|
$this->boxes = array();
|
2008-10-01 21:10:17 +02:00
|
|
|
|
2006-07-23 03:38:43 +02:00
|
|
|
// Permissions
|
|
|
|
|
$this->rights = array();
|
|
|
|
|
$this->rights_class = 'prelevement';
|
2011-01-15 09:51:22 +01:00
|
|
|
$r=0;
|
|
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 151;
|
2016-10-01 20:12:00 +02:00
|
|
|
$this->rights[$r][1] = 'Read direct debit payment orders';
|
2011-01-15 09:51:22 +01:00
|
|
|
$this->rights[$r][2] = 'r';
|
2016-06-04 12:16:30 +02:00
|
|
|
$this->rights[$r][3] = 0;
|
2011-01-15 09:51:22 +01:00
|
|
|
$this->rights[$r][4] = 'bons';
|
|
|
|
|
$this->rights[$r][5] = 'lire';
|
|
|
|
|
|
|
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 152;
|
2016-10-01 20:12:00 +02:00
|
|
|
$this->rights[$r][1] = 'Create/modify a direct debit payment order';
|
2011-01-15 09:51:22 +01:00
|
|
|
$this->rights[$r][2] = 'w';
|
|
|
|
|
$this->rights[$r][3] = 0;
|
|
|
|
|
$this->rights[$r][4] = 'bons';
|
|
|
|
|
$this->rights[$r][5] = 'creer';
|
|
|
|
|
|
|
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 153;
|
2016-10-01 20:12:00 +02:00
|
|
|
$this->rights[$r][1] = 'Send/Transmit direct debit payment orders';
|
2011-01-15 09:51:22 +01:00
|
|
|
$this->rights[$r][2] = 'a';
|
|
|
|
|
$this->rights[$r][3] = 0;
|
|
|
|
|
$this->rights[$r][4] = 'bons';
|
|
|
|
|
$this->rights[$r][5] = 'send';
|
2011-08-31 12:27:17 +02:00
|
|
|
|
2011-01-15 09:51:22 +01:00
|
|
|
$r++;
|
|
|
|
|
$this->rights[$r][0] = 154;
|
2016-10-01 20:12:00 +02:00
|
|
|
$this->rights[$r][1] = 'Record Credits/Rejects of direct debit payment orders';
|
2011-01-15 09:51:22 +01:00
|
|
|
$this->rights[$r][2] = 'a';
|
|
|
|
|
$this->rights[$r][3] = 0;
|
|
|
|
|
$this->rights[$r][4] = 'bons';
|
|
|
|
|
$this->rights[$r][5] = 'credit';
|
2011-08-31 12:27:17 +02:00
|
|
|
|
2010-09-05 15:24:59 +02:00
|
|
|
/* $this->rights[2][0] = 154;
|
|
|
|
|
$this->rights[2][1] = 'Setup withdraw account';
|
|
|
|
|
$this->rights[2][2] = 'w';
|
|
|
|
|
$this->rights[2][3] = 0;
|
|
|
|
|
$this->rights[2][4] = 'bons';
|
|
|
|
|
$this->rights[2][5] = 'configurer';
|
|
|
|
|
*/
|
2016-09-30 13:02:13 +02:00
|
|
|
|
|
|
|
|
// Menus
|
|
|
|
|
//-------
|
|
|
|
|
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
|
|
|
|
|
|
2006-07-23 03:38:43 +02:00
|
|
|
}
|
2005-05-14 16:22:08 +02:00
|
|
|
|
|
|
|
|
|
2008-10-01 21:10:17 +02:00
|
|
|
/**
|
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
|
2008-10-01 21:10:17 +02:00
|
|
|
*/
|
2012-01-04 21:23:50 +01:00
|
|
|
function init($options='')
|
2006-07-23 03:38:43 +02:00
|
|
|
{
|
|
|
|
|
global $conf;
|
2008-10-01 21:10:17 +02:00
|
|
|
|
2006-07-23 03:38:43 +02:00
|
|
|
// Permissions
|
2012-03-03 17:37:45 +01:00
|
|
|
$this->remove($options);
|
2008-10-01 21:10:17 +02:00
|
|
|
|
2016-09-19 00:26:30 +02:00
|
|
|
$sql = array(
|
2016-10-02 20:00:57 +02:00
|
|
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND type = 'bankaccount' AND entity = ".$conf->entity,
|
2016-09-19 00:26:30 +02:00
|
|
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','bankaccount',".$conf->entity.")",
|
|
|
|
|
);
|
2008-10-01 21:10:17 +02:00
|
|
|
|
2012-01-04 21:23:50 +01:00
|
|
|
return $this->_init($sql,$options);
|
2006-07-23 03:38:43 +02:00
|
|
|
}
|
2004-09-22 12:16:34 +02:00
|
|
|
}
|