|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* Copyright (C) 2007-2009 Regis Houssin <[email protected]> |
|
4
|
|
|
* Copyright (C) 2008 Laurent Destailleur <[email protected]> |
|
5
|
|
|
* Copyright (C) 2024 Rafael San José <[email protected]> |
|
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
|
|
|
|
|
21
|
|
|
namespace Dolibarr\Modules; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* \defgroup label Module labels |
|
25
|
|
|
* \brief Module pour gerer les formats d'impression des etiquettes |
|
26
|
|
|
* \file htdocs/core/modules/modLabel.class.php |
|
27
|
|
|
* \ingroup other |
|
28
|
|
|
* \brief Description and activation file for the module Labels |
|
29
|
|
|
*/ |
|
30
|
|
|
|
|
31
|
|
|
use Dolibarr\Core\Base\DolibarrModules; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Class to describe and enable module Label |
|
35
|
|
|
*/ |
|
36
|
|
|
class Label extends DolibarrModules |
|
37
|
|
|
{ |
|
38
|
|
|
/** |
|
39
|
|
|
* Constructor. Define names, constants, directories, boxes, permissions |
|
40
|
|
|
* |
|
41
|
|
|
* @param DoliDB $db Database handler |
|
|
|
|
|
|
42
|
|
|
*/ |
|
43
|
|
|
public function __construct($db) |
|
44
|
|
|
{ |
|
45
|
|
|
$this->db = $db; |
|
46
|
|
|
$this->numero = 60; |
|
47
|
|
|
|
|
48
|
|
|
$this->family = "technic"; |
|
49
|
|
|
$this->module_position = '75'; |
|
50
|
|
|
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
51
|
|
|
$this->name = preg_replace('/^mod/i', '', get_only_class($this)); |
|
52
|
|
|
$this->description = "Management of stickers"; |
|
53
|
|
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
54
|
|
|
$this->version = 'development'; |
|
55
|
|
|
$this->const_name = 'MAIN_MODULE_' . static::getNameOf($this->name); // strtoupper($this->name); |
|
56
|
|
|
$this->picto = 'generic'; |
|
57
|
|
|
|
|
58
|
|
|
// Data directories to create when module is enabled |
|
59
|
|
|
$this->dirs = array("/label/temp"); |
|
60
|
|
|
|
|
61
|
|
|
// Dependencies |
|
62
|
|
|
$this->hidden = false; // A condition to hide module |
|
63
|
|
|
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled |
|
64
|
|
|
$this->requiredby = array(); // List of module ids to disable if this one is disabled |
|
65
|
|
|
$this->conflictwith = array(); // List of module class names as string this module is in conflict with |
|
66
|
|
|
$this->phpmin = array(7, 0); // Minimum version of PHP required by module |
|
67
|
|
|
|
|
68
|
|
|
// Config pages |
|
69
|
|
|
// $this->config_page_url = array("label.php"); |
|
70
|
|
|
|
|
71
|
|
|
// Constants |
|
72
|
|
|
$this->const = array(); |
|
73
|
|
|
|
|
74
|
|
|
// Boxes |
|
75
|
|
|
$this->boxes = array(); |
|
76
|
|
|
|
|
77
|
|
|
// Permissions |
|
78
|
|
|
$this->rights = array(); |
|
79
|
|
|
$this->rights_class = 'label'; |
|
80
|
|
|
|
|
81
|
|
|
$this->rights[1][0] = 601; // id de la permission |
|
82
|
|
|
$this->rights[1][1] = 'Read stickers'; |
|
83
|
|
|
$this->rights[1][3] = 0; // La permission est-elle une permission par default |
|
84
|
|
|
$this->rights[1][4] = 'lire'; |
|
85
|
|
|
|
|
86
|
|
|
$this->rights[2][0] = 602; // id de la permission |
|
87
|
|
|
$this->rights[2][1] = 'Create/modify stickers'; |
|
88
|
|
|
$this->rights[2][3] = 0; // La permission est-elle une permission par default |
|
89
|
|
|
$this->rights[2][4] = 'creer'; |
|
90
|
|
|
|
|
91
|
|
|
$this->rights[4][0] = 609; // id de la permission |
|
92
|
|
|
$this->rights[4][1] = 'Delete stickers'; |
|
93
|
|
|
$this->rights[4][3] = 0; // La permission est-elle une permission par default |
|
94
|
|
|
$this->rights[4][4] = 'supprimer'; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Function called when module is enabled. |
|
99
|
|
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
100
|
|
|
* It also creates data directories |
|
101
|
|
|
* |
|
102
|
|
|
* @param string $options Options when enabling module ('', 'noboxes') |
|
103
|
|
|
* @return int 1 if OK, 0 if KO |
|
104
|
|
|
*/ |
|
105
|
|
|
public function init($options = '') |
|
106
|
|
|
{ |
|
107
|
|
|
// Permissions |
|
108
|
|
|
$this->remove($options); |
|
109
|
|
|
|
|
110
|
|
|
$sql = array(); |
|
111
|
|
|
|
|
112
|
|
|
return $this->_init($sql, $options); |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
|