dolibarr  7.0.0-beta
modDon.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
5  * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
29 include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
30 
31 
35 class modDon extends DolibarrModules
36 {
37 
43  function __construct($db)
44  {
45  $this->db = $db;
46  $this->numero = 700;
47 
48  $this->family = "financial";
49  // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
50  $this->name = preg_replace('/^mod/i','',get_class($this));
51  $this->description = "Gestion des dons";
52  // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
53  $this->version = 'dolibarr';
54  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
55  $this->special = 0;
56  // Name of png file (without png) used for this module.
57  // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
58  $this->picto='bill';
59 
60  // Data directories to create when module is enabled
61  $this->dirs = array("/don/temp");
62 
63  // Dependancies
64  $this->depends = array();
65  $this->requiredby = array();
66 
67  // Config pages
68  $this->config_page_url = array("donation.php@don");
69 
70  // Constants
71  $this->const = array();
72  $r=0;
73 
74  $this->const[$r][0] = "DON_ADDON_MODEL";
75  $this->const[$r][1] = "chaine";
76  $this->const[$r][2] = "html_cerfafr";
77  $this->const[$r][3] = 'Nom du gestionnaire de generation de recu de dons';
78  $this->const[$r][4] = 0;
79 
80  $r++;
81  $this->const[$r][0] = "DONATION_ART200";
82  $this->const[$r][1] = "yesno";
83  $this->const[$r][2] = "0";
84  $this->const[$r][3] = 'Option Française - Eligibilité Art200 du CGI';
85  $this->const[$r][4] = 0;
86 
87  $r++;
88  $this->const[$r][0] = "DONATION_ART238";
89  $this->const[$r][1] = "yesno";
90  $this->const[$r][2] = "0";
91  $this->const[$r][3] = 'Option Française - Eligibilité Art238 bis du CGI';
92  $this->const[$r][4] = 0;
93 
94  $r++;
95  $this->const[$r][0] = "DONATION_ART885";
96  $this->const[$r][1] = "yesno";
97  $this->const[$r][2] = "0";
98  $this->const[$r][3] = 'Option Française - Eligibilité Art885-0 V bis du CGI';
99  $this->const[$r][4] = 0;
100 
101  $r++;
102  $this->const[$r][0] = "DONATION_MESSAGE";
103  $this->const[$r][1] = "chaine";
104  $this->const[$r][2] = "Thank you";
105  $this->const[$r][3] = 'Message affiché sur le récépissé de versements ou dons';
106  $this->const[$r][4] = 0;
107 
108  $r++;
109  $this->const[$r][0] = "DONATION_ACCOUNTINGACCOUNT";
110  $this->const[$r][1] = "chaine";
111  $this->const[$r][2] = "758";
112  $this->const[$r][3] = 'Compte comptable de remise des versements ou dons';
113  $this->const[$r][4] = 0;
114 
115  // Boxes
116  $this->boxes = array();
117 
118  // Permissions
119  $this->rights = array();
120  $this->rights_class = 'don';
121 
122  $this->rights[1][0] = 701;
123  $this->rights[1][1] = 'Lire les dons';
124  $this->rights[1][2] = 'r';
125  $this->rights[1][3] = 1;
126  $this->rights[1][4] = 'lire';
127 
128  $this->rights[2][0] = 702;
129  $this->rights[2][1] = 'Creer/modifier les dons';
130  $this->rights[2][2] = 'w';
131  $this->rights[2][3] = 0;
132  $this->rights[2][4] = 'creer';
133 
134  $this->rights[3][0] = 703;
135  $this->rights[3][1] = 'Supprimer les dons';
136  $this->rights[3][2] = 'd';
137  $this->rights[3][3] = 0;
138  $this->rights[3][4] = 'supprimer';
139 
140 
141  // Menus
142  //-------
143  $this->menu = 1; // This module add menu entries. They are coded into menu manager.
144 
145  }
146 
147 
156  function init($options='')
157  {
158  global $conf;
159 
160  $sql = array(
161  "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'donation' AND entity = ".$conf->entity,
162  "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','donation',".$conf->entity.")",
163  );
164 
165  return $this->_init($sql,$options);
166  }
167 }
Class DolibarrModules.
__construct($db)
Constructor.
</td >< tdclass="liste_titre"align="right"></td ></tr >< trclass="liste_titre">< inputtype="checkbox"onClick="toggle(this)"/> Ref p ref Label p label Duration p duration warehouseinternal SELECT description FROM product_lang WHERE qty< br > qty qty qty StockTooLow img yes disabled img no img no< trclass="oddeven">< td >< inputtype="checkbox"class="check"name="'.$i.'"'.$disabled.'></td >< td >< inputtype="checkbox"class="check"name="choose'.$i.'"></td >< tdclass="nowrap"></td >< td >< inputtype="hidden"name="desc'.$i.'"value="'.dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:554
init($options='')
Function called when module is enabled.
Class to describe and enable module Donation.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:104
_init($array_sql, $options='')
Enables a module.