dolibarr  7.0.0-beta
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 = "technic";
50  $this->module_position = 530;
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  // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
59  $this->special = 1;
60  // Name of image file used for this module.
61  // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
62  // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
63  $this->picto = 'printer';
64 
65  // Data directories to create when module is enabled.
66  $this->dirs = array();
67 
68  // Config pages
69  $this->config_page_url = array("receiptprinter.php");
70 
71  // Dependencies
72  $this->depends = array();
73  $this->requiredby = array();
74  $this->phpmin = array(5,1); // 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 && $leftmenu==\'admintools\'',
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  }
125 
126 
135  function init($options='')
136  {
137  global $conf;
138  // Clean before activation
139  $this->remove($options);
140  $sql = array(
141  "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;",
142  "CREATE TABLE IF NOT EXISTS llx_printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;",
143  );
144  return $this->_init($sql,$options);
145  }
146 
147 }
init($options='')
Function called when module is enabled.
Class DolibarrModules.
</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
__construct($db)
Constructor.
Class to describe and activate module Receipt Printer.
$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.