dolibarr  9.0.0
modReceiptPrinter.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) 2015 Frederic France <frederic.france@free.fr>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
28 include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
29 
30 
31 
36 {
37 
43  function __construct($db)
44  {
45  $this->db = $db ;
46  $this->numero = 67000;
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 = '53';
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 = "ReceiptPrinterDesc";
55  // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
56  $this->version = 'development';
57  $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
58  // Name of image file used for this module.
59  // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
60  // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
61  $this->picto = 'printer';
62 
63  // Data directories to create when module is enabled.
64  $this->dirs = array();
65 
66  // Config pages
67  $this->config_page_url = array("receiptprinter.php");
68 
69  // Dependencies
70  $this->hidden = false; // A condition to hide module
71  $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
72  $this->requiredby = array(); // List of module ids to disable if this one is disabled
73  $this->conflictwith = array(); // List of module class names as string this module is in conflict with
74  $this->phpmin = array(5,4); // Minimum version of PHP required by module
75  $this->need_dolibarr_version = array(3,9,-2); // Minimum version of Dolibarr required by module
76  $this->conflictwith = array();
77  $this->langfiles = array("receiptprinter");
78 
79  // Constants
80  $this->const = array();
81 
82  // Boxes
83  $this->boxes = array();
84 
85  // Permissions
86  $this->rights = array();
87  $this->rights_class = 'receiptprinter';
88 
89  $r=0;
90  // $this->rights[$r][0] Id permission (unique tous modules confondus)
91  // $this->rights[$r][1] Libelle par defaut si traduction de cle "PermissionXXX" non trouvee (XXX = Id permission)
92  // $this->rights[$r][2] Non utilise
93  // $this->rights[$r][3] 1=Permis par defaut, 0=Non permis par defaut
94  // $this->rights[$r][4] Niveau 1 pour nommer permission dans code
95  // $this->rights[$r][5] Niveau 2 pour nommer permission dans code
96 
97  $r++;
98  $this->rights[$r][0] = 67000;
99  $this->rights[$r][1] = 'ReceiptPrinter';
100  $this->rights[$r][2] = 'r';
101  $this->rights[$r][3] = 0;
102  $this->rights[$r][4] = 'read';
103 
104  // Main menu entries
105  $this->menus = array(); // List of menus to add
106  $r=0;
107 
108  // This is to declare the Top Menu entry:
109  //$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Put 0 if this is a top menu
110  // 'type'=>'left', // This is a Top menu entry
111  // 'titre'=>'MenuDirectPrinting',
112  // 'mainmenu'=>'printing',
113  // 'url'=>'/printing/index.php',
114  // 'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
115  // 'position'=>300,
116  // 'enabled'=>'$conf->printing->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu)',
117  // 'perms'=>'$user->rights->printing->read', // Use 'perms'=>'1' if you want your menu with no permission rules
118  // 'target'=>'',
119  // 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
120 
121  $r++;
122  }
123 
124 
133  function init($options='')
134  {
135  global $conf;
136  // Clean before activation
137  $this->remove($options);
138  $sql = array(
139  "CREATE TABLE IF NOT EXISTS llx_printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;",
140  "CREATE TABLE IF NOT EXISTS llx_printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;",
141  );
142  return $this->_init($sql,$options);
143  }
144 }
init($options='')
Function called when module is enabled.
Class DolibarrModules.
</td >< td class="liste_titre" align="right"></td ></tr >< tr class="liste_titre">< input type="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< tr class="oddeven">< td >< input type="checkbox" class="check" name="' . $i . '"' . $disabled . '></td >< td >< input type="checkbox" class="check" name="choose'.$i.'"></td >< td class="nowrap"></td >< td >< input type="hidden" name="desc' . $i . '" value="' . dol_escape_htmltag($objp-> description
Only used if Module[ID]Desc translation string is not found.
Definition: replenish.php:573
__construct($db)
Constructor.
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition: repair.php:103
Class to describe and activate module Receipt Printer.
_init($array_sql, $options='')
Enables a module.