dolibarr 21.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@inodbox.com>
5 * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
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 <https://www.gnu.org/licenses/>.
19 */
20
29include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
30
31
36{
42 public function __construct($db)
43 {
44 $this->db = $db;
45 $this->numero = 700;
46
47 $this->family = "financial";
48 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
49 $this->name = preg_replace('/^mod/i', '', get_class($this));
50 $this->description = "Gestion des dons";
51 // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
52 $this->version = 'dolibarr';
53 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
54 // Name of png file (without png) used for this module.
55 // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png.
56 $this->picto = 'donation';
57
58 // Data directories to create when module is enabled
59 $this->dirs = array("/don/temp");
60
61 // Dependencies
62 $this->depends = array();
63 $this->requiredby = array();
64
65 // Config pages
66 $this->config_page_url = array("donation.php@don");
67
68 // Constants
69 $this->const = array();
70 $r = 0;
71
72 $this->const[$r][0] = "DON_ADDON_MODEL";
73 $this->const[$r][1] = "chaine";
74 $this->const[$r][2] = "html_cerfafr";
75 $this->const[$r][3] = 'Nom du gestionnaire de generation de recu de dons';
76 $this->const[$r][4] = 0;
77
78 $r++;
79 $this->const[$r][0] = "DONATION_ART200";
80 $this->const[$r][1] = "yesno";
81 $this->const[$r][2] = "0";
82 $this->const[$r][3] = 'Option Française - Eligibilité Art200 du CGI';
83 $this->const[$r][4] = 0;
84
85 $r++;
86 $this->const[$r][0] = "DONATION_ART238";
87 $this->const[$r][1] = "yesno";
88 $this->const[$r][2] = "0";
89 $this->const[$r][3] = 'Option Française - Eligibilité Art238 bis du CGI';
90 $this->const[$r][4] = 0;
91
92 $r++;
93 $this->const[$r][0] = "DONATION_ART978";
94 $this->const[$r][1] = "yesno";
95 $this->const[$r][2] = "0";
96 $this->const[$r][3] = 'Option Française - Eligibilité Art978 du CGI';
97 $this->const[$r][4] = 0;
98
99 $r++;
100 $this->const[$r][0] = "DONATION_MESSAGE";
101 $this->const[$r][1] = "chaine";
102 $this->const[$r][2] = "Thank you";
103 $this->const[$r][3] = 'Message affiché sur le récépissé de versements ou dons';
104 $this->const[$r][4] = 0;
105
106 $r++;
107 $this->const[$r][0] = "DONATION_ACCOUNTINGACCOUNT";
108 $this->const[$r][1] = "chaine";
109 $this->const[$r][2] = "758";
110 $this->const[$r][3] = 'Compte comptable de remise des versements ou dons';
111 $this->const[$r][4] = 0;
112
113 // Boxes
114 $this->boxes = array();
115
116 // Permissions
117 $this->rights = array();
118 $this->rights_class = 'don';
119
120 $this->rights[1][0] = 701;
121 $this->rights[1][1] = 'Lire les dons';
122 $this->rights[1][2] = 'r';
123 $this->rights[1][3] = 0;
124 $this->rights[1][4] = 'lire';
125
126 $this->rights[2][0] = 702;
127 $this->rights[2][1] = 'Creer/modifier les dons';
128 $this->rights[2][2] = 'w';
129 $this->rights[2][3] = 0;
130 $this->rights[2][4] = 'creer';
131
132 $this->rights[3][0] = 703;
133 $this->rights[3][1] = 'Supprimer les dons';
134 $this->rights[3][2] = 'd';
135 $this->rights[3][3] = 0;
136 $this->rights[3][4] = 'supprimer';
137
138
139 // Menus
140 //-------
141 $this->menu = 1; // This module add menu entries. They are coded into menu manager.
142 }
143
144
153 public function init($options = '')
154 {
155 global $conf;
156
157 $result = $this->_load_tables('/install/mysql/', 'don');
158 if ($result < 0) {
159 return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
160 }
161
162 $sql = array(
163 "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'donation' AND entity = ".((int) $conf->entity),
164 "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','donation',".((int) $conf->entity).")",
165 );
166
167 return $this->_init($sql, $options);
168 }
169}
Class DolibarrModules.
_init($array_sql, $options='')
Enables a module.
_load_tables($reldir, $onlywithsuffix='')
Create tables and keys required by module:
Class to describe and enable module Donation.
__construct($db)
Constructor.
init($options='')
Function called when module is enabled.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:152