dolibarr 24.0.0-beta
modPrinting.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2014-2015 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2014-2025 Frédéric France <frederic.france@free.fr>
4 * Copyright (C) 2026 MDW <mdeweerd@users.noreply.github.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
29include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
30
31
32
37{
43 public function __construct($db)
44 {
45 $this->db = $db;
46 $this->numero = 64000;
47 // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
48 // It is used to group modules in module setup page
49 $this->family = "interface";
50 $this->module_position = '52';
51 // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
52 $this->name = preg_replace('/^mod/i', '', get_class($this));
53 // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
54 $this->description = "Enable Direct Printing System.";
55 $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version
56 $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
57 // Name of image file used for this module.
58 // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
59 // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
60 $this->picto = 'printer';
61
62 // Data directories to create when module is enabled.
63 $this->dirs = array();
64
65 // Config pages
66 $this->config_page_url = array("printing.php@printing");
67
68 // Dependencies
69 $this->hidden = false; // A condition to hide module
70 $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
71 $this->requiredby = array(); // List of module ids to disable if this one is disabled
72 $this->conflictwith = array(); // List of module class names as string this module is in conflict with
73 $this->phpmin = array(7, 0); // Minimum version of PHP required by module
74 $this->need_dolibarr_version = array(3, 7, -2); // Minimum version of Dolibarr required by module
75 $this->conflictwith = array();
76 $this->langfiles = array("printing");
77
78 // Constants
79 $this->const = array();
80
81 // Boxes
82 $this->boxes = array();
83
84 // Rights
85 $this->rights = array();
86 $this->rights_class = 'printing';
87
88 $r = 0;
89 // $this->rights[$r][0] Id for right (unique across all modules)
90 // $this->rights[$r][1] Default label if the translation key "PermissionXXX" is not found (XXX = Id for right)
91 // $this->rights[$r][2] Not used
92 // $this->rights[$r][3] 1=Authorised by default, 0=Denied by default
93 // $this->rights[$r][4] Level 1 to name right in the code
94 // $this->rights[$r][5] Level 2 to name right in the code
95
96 $r++;
97 $this->rights[$r][0] = 64001;
98 $this->rights[$r][1] = 'DirectPrint';
99 $this->rights[$r][2] = 'r';
100 $this->rights[$r][3] = 0;
101 $this->rights[$r][4] = 'read';
102
103 // Main menu entries
104 $this->menu = array(); // List of menus to add
105 $r = 0;
106
107 // This is to declare the Top Menu entry:
108 $this->menu[$r] = array('fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Put 0 if this is a top menu
109 'type'=>'left', // This is a Top menu entry
110 'titre'=>'MenuDirectPrinting',
111 'url'=>'/printing/index.php?mainmenu=home&leftmenu=admintools',
112 'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
113 'position'=>300,
114 'enabled'=>'isModEnabled("printing") && isStringVarMatching("leftmenu", "(admintools|all)")',
115 'perms'=>'$user->hasRight("printing", "read")', // Use 'perms'=>'1' if you want your menu with no permission rules
116 'target'=>'',
117 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
118
119 $r++;
120 }
121}
Class DolibarrModules.
Class to describe and activate module Direct Printing.
__construct($db)
Constructor.
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.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:133