dolibarr/htdocs/core/modules/modPrelevement.class.php

162 lines
5.0 KiB
PHP
Raw Normal View History

<?php
2005-01-24 10:20:57 +01:00
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* 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>
* 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
* 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
* \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
*/
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
2004-09-22 12:16:34 +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
*/
function __construct($db)
{
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
$this->family = "financial";
$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)
$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
$this->version = 'dolibarr';
2008-10-01 21:10:17 +02:00
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
2008-02-19 20:10:24 +01:00
// Name of png file (without png) used for this module
$this->picto='payment';
// Data directories to create when module is enabled
$this->dirs = array("/prelevement/temp","/prelevement/receipts");
2008-10-01 21:10:17 +02:00
2008-12-15 23:17:49 +01:00
// Dependancies
$this->depends = array("modFacture","modBanque");
$this->requiredby = array();
// 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
$this->const = array();
$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
$this->boxes = array();
2008-10-01 21:10:17 +02:00
// Permissions
$this->rights = array();
$this->rights_class = 'prelevement';
$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';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$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';
$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';
$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
$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';
$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
/* $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';
*/
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
}
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='')
{
global $conf;
2008-10-01 21:10:17 +02:00
// Permissions
$this->remove($options);
2008-10-01 21:10:17 +02:00
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".$conf->entity,
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($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);
}
2004-09-22 12:16:34 +02:00
}