@@ -31,182 +31,182 @@ discard block |
||
31 | 31 | class modSubtotal extends DolibarrModules |
32 | 32 | { |
33 | 33 | |
34 | - /** |
|
35 | - * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | - * |
|
37 | - * @param DoliDB $db Database handler |
|
38 | - */ |
|
34 | + /** |
|
35 | + * Constructor. Define names, constants, directories, boxes, permissions |
|
36 | + * |
|
37 | + * @param DoliDB $db Database handler |
|
38 | + */ |
|
39 | 39 | |
40 | - public function __construct($db) |
|
41 | - { |
|
42 | - global $langs, $conf; |
|
40 | + public function __construct($db) |
|
41 | + { |
|
42 | + global $langs, $conf; |
|
43 | 43 | |
44 | - $this->db = $db; |
|
44 | + $this->db = $db; |
|
45 | 45 | |
46 | 46 | $this->editor_name = 'ATM-Consulting'; |
47 | - // Id for module (must be unique). |
|
48 | - // Use a free id here |
|
49 | - // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
50 | - $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
51 | - // Key text used to identify module (for permissions, menus, etc...) |
|
52 | - $this->rights_class = 'subtotal'; |
|
47 | + // Id for module (must be unique). |
|
48 | + // Use a free id here |
|
49 | + // (See in Home -> System information -> Dolibarr for list of used modules id). |
|
50 | + $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING |
|
51 | + // Key text used to identify module (for permissions, menus, etc...) |
|
52 | + $this->rights_class = 'subtotal'; |
|
53 | 53 | |
54 | - // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
55 | - // It is used to group modules in module setup page |
|
56 | - $this->family = "technic"; |
|
57 | - // Module label (no space allowed) |
|
58 | - // used if translation string 'ModuleXXXName' not found |
|
59 | - // (where XXX is value of numeric property 'numero' of module) |
|
60 | - $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
61 | - // Module description |
|
62 | - // used if translation string 'ModuleXXXDesc' not found |
|
63 | - // (where XXX is value of numeric property 'numero' of module) |
|
64 | - $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
65 | - // Possible values for version are: 'development', 'experimental' or version |
|
66 | - $this->version = '3.1.4'; |
|
67 | - // Key used in llx_const table to save module status enabled/disabled |
|
68 | - // (where MYMODULE is value of property name of module in uppercase) |
|
69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
70 | - // Where to store the module in setup page |
|
71 | - // (0=common,1=interface,2=others,3=very specific) |
|
72 | - $this->special = 2; |
|
73 | - // Name of image file used for this module. |
|
74 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
75 | - // use this->picto='pictovalue' |
|
76 | - // If file is in module/img directory under name object_pictovalue.png |
|
77 | - // use this->picto='pictovalue@module' |
|
78 | - $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
79 | - // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
80 | - // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
81 | - // for specific path of parts (eg: /titre/core/modules/barcode) |
|
82 | - // for specific css file (eg: /titre/css/titre.css.php) |
|
83 | - $this->module_parts = array( |
|
84 | - // Set this to 1 if module has its own trigger directory |
|
85 | - 'triggers' => 1, |
|
86 | - // Set this to 1 if module has its own login method directory |
|
87 | - //'login' => 0, |
|
88 | - // Set this to 1 if module has its own substitution function file |
|
89 | - //'substitutions' => 0, |
|
90 | - // Set this to 1 if module has its own menus handler directory |
|
91 | - //'menus' => 0, |
|
92 | - // Set this to 1 if module has its own barcode directory |
|
93 | - //'barcode' => 0, |
|
94 | - // Set this to 1 if module has its own models directory |
|
95 | - 'models' => 1, |
|
96 | - // Set this to relative path of css if module has its own css file |
|
97 | - //'css' => '/titre/css/mycss.css.php', |
|
98 | - // Set here all hooks context managed by module |
|
99 | - 'hooks' => array( |
|
100 | - 'invoicecard' |
|
101 | - ,'invoicesuppliercard' |
|
102 | - ,'propalcard' |
|
103 | - ,'supplier_proposalcard' |
|
104 | - ,'ordercard' |
|
105 | - ,'ordersuppliercard' |
|
106 | - ,'odtgeneration' |
|
107 | - ,'orderstoinvoice' |
|
108 | - ,'admin' |
|
109 | - ,'invoicereccard' |
|
110 | - ,'consumptionthirdparty' |
|
111 | - ) |
|
112 | - // Set here all workflow context managed by module |
|
113 | - //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
114 | - ); |
|
54 | + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
|
55 | + // It is used to group modules in module setup page |
|
56 | + $this->family = "technic"; |
|
57 | + // Module label (no space allowed) |
|
58 | + // used if translation string 'ModuleXXXName' not found |
|
59 | + // (where XXX is value of numeric property 'numero' of module) |
|
60 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
61 | + // Module description |
|
62 | + // used if translation string 'ModuleXXXDesc' not found |
|
63 | + // (where XXX is value of numeric property 'numero' of module) |
|
64 | + $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre"; |
|
65 | + // Possible values for version are: 'development', 'experimental' or version |
|
66 | + $this->version = '3.1.4'; |
|
67 | + // Key used in llx_const table to save module status enabled/disabled |
|
68 | + // (where MYMODULE is value of property name of module in uppercase) |
|
69 | + $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
70 | + // Where to store the module in setup page |
|
71 | + // (0=common,1=interface,2=others,3=very specific) |
|
72 | + $this->special = 2; |
|
73 | + // Name of image file used for this module. |
|
74 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png |
|
75 | + // use this->picto='pictovalue' |
|
76 | + // If file is in module/img directory under name object_pictovalue.png |
|
77 | + // use this->picto='pictovalue@module' |
|
78 | + $this->picto = 'subtotal@subtotal'; // mypicto@titre |
|
79 | + // Defined all module parts (triggers, login, substitutions, menus, css, etc...) |
|
80 | + // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable) |
|
81 | + // for specific path of parts (eg: /titre/core/modules/barcode) |
|
82 | + // for specific css file (eg: /titre/css/titre.css.php) |
|
83 | + $this->module_parts = array( |
|
84 | + // Set this to 1 if module has its own trigger directory |
|
85 | + 'triggers' => 1, |
|
86 | + // Set this to 1 if module has its own login method directory |
|
87 | + //'login' => 0, |
|
88 | + // Set this to 1 if module has its own substitution function file |
|
89 | + //'substitutions' => 0, |
|
90 | + // Set this to 1 if module has its own menus handler directory |
|
91 | + //'menus' => 0, |
|
92 | + // Set this to 1 if module has its own barcode directory |
|
93 | + //'barcode' => 0, |
|
94 | + // Set this to 1 if module has its own models directory |
|
95 | + 'models' => 1, |
|
96 | + // Set this to relative path of css if module has its own css file |
|
97 | + //'css' => '/titre/css/mycss.css.php', |
|
98 | + // Set here all hooks context managed by module |
|
99 | + 'hooks' => array( |
|
100 | + 'invoicecard' |
|
101 | + ,'invoicesuppliercard' |
|
102 | + ,'propalcard' |
|
103 | + ,'supplier_proposalcard' |
|
104 | + ,'ordercard' |
|
105 | + ,'ordersuppliercard' |
|
106 | + ,'odtgeneration' |
|
107 | + ,'orderstoinvoice' |
|
108 | + ,'admin' |
|
109 | + ,'invoicereccard' |
|
110 | + ,'consumptionthirdparty' |
|
111 | + ) |
|
112 | + // Set here all workflow context managed by module |
|
113 | + //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
114 | + ); |
|
115 | 115 | |
116 | - // Data directories to create when module is enabled. |
|
117 | - // Example: this->dirs = array("/titre/temp"); |
|
118 | - $this->dirs = array(); |
|
116 | + // Data directories to create when module is enabled. |
|
117 | + // Example: this->dirs = array("/titre/temp"); |
|
118 | + $this->dirs = array(); |
|
119 | 119 | |
120 | - // Config pages. Put here list of php pages |
|
121 | - // stored into titre/admin directory, used to setup module. |
|
122 | - $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
120 | + // Config pages. Put here list of php pages |
|
121 | + // stored into titre/admin directory, used to setup module. |
|
122 | + $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
123 | 123 | |
124 | - // Dependencies |
|
125 | - // List of modules id that must be enabled if this module is enabled |
|
126 | - $this->depends = array(); |
|
124 | + // Dependencies |
|
125 | + // List of modules id that must be enabled if this module is enabled |
|
126 | + $this->depends = array(); |
|
127 | 127 | |
128 | 128 | $this->conflictwith=array('modMilestone'); |
129 | - // List of modules id to disable if this one is disabled |
|
130 | - $this->requiredby = array(); |
|
131 | - // Minimum version of PHP required by module |
|
132 | - $this->phpmin = array(5, 3); |
|
133 | - // Minimum version of Dolibarr required by module |
|
134 | - $this->need_dolibarr_version = array(3, 2); |
|
135 | - $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
136 | - // Constants |
|
137 | - // List of particular constants to add when module is enabled |
|
138 | - // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
139 | - // Example: |
|
140 | - $this->const = array( |
|
141 | - 0=>array( |
|
142 | - 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
143 | - 'chaine', |
|
144 | - 'I', |
|
145 | - 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
146 | - 1 |
|
147 | - ) |
|
129 | + // List of modules id to disable if this one is disabled |
|
130 | + $this->requiredby = array(); |
|
131 | + // Minimum version of PHP required by module |
|
132 | + $this->phpmin = array(5, 3); |
|
133 | + // Minimum version of Dolibarr required by module |
|
134 | + $this->need_dolibarr_version = array(3, 2); |
|
135 | + $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
136 | + // Constants |
|
137 | + // List of particular constants to add when module is enabled |
|
138 | + // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
139 | + // Example: |
|
140 | + $this->const = array( |
|
141 | + 0=>array( |
|
142 | + 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
143 | + 'chaine', |
|
144 | + 'I', |
|
145 | + 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
146 | + 1 |
|
147 | + ) |
|
148 | 148 | ,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux') |
149 | 149 | ,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux') |
150 | 150 | ,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux') |
151 | 151 | ,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU') |
152 | 152 | ,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B') |
153 | - // 1=>array( |
|
154 | - // 'MYMODULE_MYNEWCONST2', |
|
155 | - // 'chaine', |
|
156 | - // 'myvalue', |
|
157 | - // 'This is another constant to add', |
|
158 | - // 0 |
|
159 | - // ) |
|
160 | - ); |
|
153 | + // 1=>array( |
|
154 | + // 'MYMODULE_MYNEWCONST2', |
|
155 | + // 'chaine', |
|
156 | + // 'myvalue', |
|
157 | + // 'This is another constant to add', |
|
158 | + // 0 |
|
159 | + // ) |
|
160 | + ); |
|
161 | 161 | |
162 | 162 | |
163 | 163 | |
164 | 164 | |
165 | - // Array to add new pages in new tabs |
|
166 | - // Example: |
|
167 | - $this->tabs = array( |
|
168 | - // // To add a new tab identified by code tabname1 |
|
169 | - // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
170 | - // // To add another new tab identified by code tabname2 |
|
171 | - // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
172 | - // // To remove an existing tab identified by code tabname |
|
173 | - // 'objecttype:-tabname' |
|
174 | - ); |
|
175 | - // where objecttype can be |
|
176 | - // 'thirdparty' to add a tab in third party view |
|
177 | - // 'intervention' to add a tab in intervention view |
|
178 | - // 'order_supplier' to add a tab in supplier order view |
|
179 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
180 | - // 'invoice' to add a tab in customer invoice view |
|
181 | - // 'order' to add a tab in customer order view |
|
182 | - // 'product' to add a tab in product view |
|
183 | - // 'stock' to add a tab in stock view |
|
184 | - // 'propal' to add a tab in propal view |
|
185 | - // 'member' to add a tab in fundation member view |
|
186 | - // 'contract' to add a tab in contract view |
|
187 | - // 'user' to add a tab in user view |
|
188 | - // 'group' to add a tab in group view |
|
189 | - // 'contact' to add a tab in contact view |
|
190 | - // 'categories_x' to add a tab in category view |
|
191 | - // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
192 | - // Dictionnaries |
|
193 | - if (! isset($conf->subtotal->enabled)) { |
|
194 | - $conf->subtotal=new stdClass(); |
|
195 | - $conf->subtotal->enabled = 0; |
|
196 | - } |
|
197 | - $this->dictionaries = array( |
|
165 | + // Array to add new pages in new tabs |
|
166 | + // Example: |
|
167 | + $this->tabs = array( |
|
168 | + // // To add a new tab identified by code tabname1 |
|
169 | + // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
170 | + // // To add another new tab identified by code tabname2 |
|
171 | + // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
172 | + // // To remove an existing tab identified by code tabname |
|
173 | + // 'objecttype:-tabname' |
|
174 | + ); |
|
175 | + // where objecttype can be |
|
176 | + // 'thirdparty' to add a tab in third party view |
|
177 | + // 'intervention' to add a tab in intervention view |
|
178 | + // 'order_supplier' to add a tab in supplier order view |
|
179 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
180 | + // 'invoice' to add a tab in customer invoice view |
|
181 | + // 'order' to add a tab in customer order view |
|
182 | + // 'product' to add a tab in product view |
|
183 | + // 'stock' to add a tab in stock view |
|
184 | + // 'propal' to add a tab in propal view |
|
185 | + // 'member' to add a tab in fundation member view |
|
186 | + // 'contract' to add a tab in contract view |
|
187 | + // 'user' to add a tab in user view |
|
188 | + // 'group' to add a tab in group view |
|
189 | + // 'contact' to add a tab in contact view |
|
190 | + // 'categories_x' to add a tab in category view |
|
191 | + // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
192 | + // Dictionnaries |
|
193 | + if (! isset($conf->subtotal->enabled)) { |
|
194 | + $conf->subtotal=new stdClass(); |
|
195 | + $conf->subtotal->enabled = 0; |
|
196 | + } |
|
197 | + $this->dictionaries = array( |
|
198 | 198 | 'langs'=>'subtotal@subtotal', |
199 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
200 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
201 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
202 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
203 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
204 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
205 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
206 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
207 | - 'tabcond'=>array($conf->subtotal->enabled) |
|
199 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
200 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
201 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
202 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
203 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
204 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
205 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
206 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
207 | + 'tabcond'=>array($conf->subtotal->enabled) |
|
208 | 208 | ); |
209 | - /* Example: |
|
209 | + /* Example: |
|
210 | 210 | // This is to avoid warnings |
211 | 211 | if (! isset($conf->titre->enabled)) $conf->titre->enabled=0; |
212 | 212 | $this->dictionnaries=array( |
@@ -247,223 +247,223 @@ discard block |
||
247 | 247 | ); |
248 | 248 | */ |
249 | 249 | |
250 | - // Boxes |
|
251 | - // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
252 | - $this->boxes = array(); // Boxes list |
|
250 | + // Boxes |
|
251 | + // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
252 | + $this->boxes = array(); // Boxes list |
|
253 | 253 | |
254 | - /* |
|
254 | + /* |
|
255 | 255 | $this->boxes[$r][1] = "myboxb.php"; |
256 | 256 | $r++; |
257 | 257 | */ |
258 | 258 | |
259 | - // Permissions |
|
260 | - $this->rights = array(); // Permission array used by this module |
|
261 | - $r = 0; |
|
259 | + // Permissions |
|
260 | + $this->rights = array(); // Permission array used by this module |
|
261 | + $r = 0; |
|
262 | 262 | |
263 | - // Add here list of permission defined by |
|
264 | - // an id, a label, a boolean and two constant strings. |
|
265 | - // Example: |
|
266 | - //// Permission id (must not be already used) |
|
267 | - //$this->rights[$r][0] = 2000; |
|
268 | - //// Permission label |
|
269 | - //$this->rights[$r][1] = 'Permision label'; |
|
270 | - //// Permission by default for new user (0/1) |
|
271 | - //$this->rights[$r][3] = 1; |
|
272 | - //// In php code, permission will be checked by test |
|
273 | - //// if ($user->rights->permkey->level1->level2) |
|
274 | - //$this->rights[$r][4] = 'level1'; |
|
275 | - //// In php code, permission will be checked by test |
|
276 | - //// if ($user->rights->permkey->level1->level2) |
|
277 | - //$this->rights[$r][5] = 'level2'; |
|
278 | - //$r++; |
|
279 | - // Main menu entries |
|
280 | - $this->menus = array(); // List of menus to add |
|
281 | - $r = 0; |
|
263 | + // Add here list of permission defined by |
|
264 | + // an id, a label, a boolean and two constant strings. |
|
265 | + // Example: |
|
266 | + //// Permission id (must not be already used) |
|
267 | + //$this->rights[$r][0] = 2000; |
|
268 | + //// Permission label |
|
269 | + //$this->rights[$r][1] = 'Permision label'; |
|
270 | + //// Permission by default for new user (0/1) |
|
271 | + //$this->rights[$r][3] = 1; |
|
272 | + //// In php code, permission will be checked by test |
|
273 | + //// if ($user->rights->permkey->level1->level2) |
|
274 | + //$this->rights[$r][4] = 'level1'; |
|
275 | + //// In php code, permission will be checked by test |
|
276 | + //// if ($user->rights->permkey->level1->level2) |
|
277 | + //$this->rights[$r][5] = 'level2'; |
|
278 | + //$r++; |
|
279 | + // Main menu entries |
|
280 | + $this->menus = array(); // List of menus to add |
|
281 | + $r = 0; |
|
282 | 282 | |
283 | - // Add here entries to declare new menus |
|
284 | - // |
|
285 | - // Example to declare a new Top Menu entry and its Left menu entry: |
|
286 | - //$this->menu[$r]=array( |
|
287 | - // // Put 0 if this is a top menu |
|
288 | - // 'fk_menu'=>0, |
|
289 | - // // This is a Top menu entry |
|
290 | - // 'type'=>'top', |
|
291 | - // 'titre'=>'titre top menu', |
|
292 | - // 'mainmenu'=>'titre', |
|
293 | - // 'leftmenu'=>'titre', |
|
294 | - // 'url'=>'/titre/pagetop.php', |
|
295 | - // // Lang file to use (without .lang) by module. |
|
296 | - // // File must be in langs/code_CODE/ directory. |
|
297 | - // 'langs'=>'mylangfile', |
|
298 | - // 'position'=>100, |
|
299 | - // // Define condition to show or hide menu entry. |
|
300 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
301 | - // 'enabled'=>'$conf->titre->enabled', |
|
302 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
303 | - // // if you want your menu with a permission rules |
|
304 | - // 'perms'=>'1', |
|
305 | - // 'target'=>'', |
|
306 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
307 | - // 'user'=>2 |
|
308 | - //); |
|
309 | - //$r++; |
|
310 | - //$this->menu[$r]=array( |
|
311 | - // // Use r=value where r is index key used for the parent menu entry |
|
312 | - // // (higher parent must be a top menu entry) |
|
313 | - // 'fk_menu'=>'r=0', |
|
314 | - // // This is a Left menu entry |
|
315 | - // 'type'=>'left', |
|
316 | - // 'titre'=>'titre left menu', |
|
317 | - // 'mainmenu'=>'titre', |
|
318 | - // 'leftmenu'=>'titre', |
|
319 | - // 'url'=>'/titre/pagelevel1.php', |
|
320 | - // // Lang file to use (without .lang) by module. |
|
321 | - // // File must be in langs/code_CODE/ directory. |
|
322 | - // 'langs'=>'mylangfile', |
|
323 | - // 'position'=>100, |
|
324 | - // // Define condition to show or hide menu entry. |
|
325 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
326 | - // 'enabled'=>'$conf->titre->enabled', |
|
327 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
328 | - // // if you want your menu with a permission rules |
|
329 | - // 'perms'=>'1', |
|
330 | - // 'target'=>'', |
|
331 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
332 | - // 'user'=>2 |
|
333 | - //); |
|
334 | - //$r++; |
|
335 | - // |
|
336 | - // Example to declare a Left Menu entry into an existing Top menu entry: |
|
337 | - //$this->menu[$r]=array( |
|
338 | - // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
339 | - // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
340 | - // // This is a Left menu entry |
|
341 | - // 'type'=>'left', |
|
342 | - // 'titre'=>'titre left menu', |
|
343 | - // 'mainmenu'=>'mainmenucode', |
|
344 | - // 'leftmenu'=>'titre', |
|
345 | - // 'url'=>'/titre/pagelevel2.php', |
|
346 | - // // Lang file to use (without .lang) by module. |
|
347 | - // // File must be in langs/code_CODE/ directory. |
|
348 | - // 'langs'=>'mylangfile', |
|
349 | - // 'position'=>100, |
|
350 | - // // Define condition to show or hide menu entry. |
|
351 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
352 | - // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
353 | - // 'enabled'=>'$conf->titre->enabled', |
|
354 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
355 | - // // if you want your menu with a permission rules |
|
356 | - // 'perms'=>'1', |
|
357 | - // 'target'=>'', |
|
358 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
359 | - // 'user'=>2 |
|
360 | - //); |
|
361 | - //$r++; |
|
362 | - // Exports |
|
363 | - $r = 1; |
|
283 | + // Add here entries to declare new menus |
|
284 | + // |
|
285 | + // Example to declare a new Top Menu entry and its Left menu entry: |
|
286 | + //$this->menu[$r]=array( |
|
287 | + // // Put 0 if this is a top menu |
|
288 | + // 'fk_menu'=>0, |
|
289 | + // // This is a Top menu entry |
|
290 | + // 'type'=>'top', |
|
291 | + // 'titre'=>'titre top menu', |
|
292 | + // 'mainmenu'=>'titre', |
|
293 | + // 'leftmenu'=>'titre', |
|
294 | + // 'url'=>'/titre/pagetop.php', |
|
295 | + // // Lang file to use (without .lang) by module. |
|
296 | + // // File must be in langs/code_CODE/ directory. |
|
297 | + // 'langs'=>'mylangfile', |
|
298 | + // 'position'=>100, |
|
299 | + // // Define condition to show or hide menu entry. |
|
300 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
301 | + // 'enabled'=>'$conf->titre->enabled', |
|
302 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
303 | + // // if you want your menu with a permission rules |
|
304 | + // 'perms'=>'1', |
|
305 | + // 'target'=>'', |
|
306 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
307 | + // 'user'=>2 |
|
308 | + //); |
|
309 | + //$r++; |
|
310 | + //$this->menu[$r]=array( |
|
311 | + // // Use r=value where r is index key used for the parent menu entry |
|
312 | + // // (higher parent must be a top menu entry) |
|
313 | + // 'fk_menu'=>'r=0', |
|
314 | + // // This is a Left menu entry |
|
315 | + // 'type'=>'left', |
|
316 | + // 'titre'=>'titre left menu', |
|
317 | + // 'mainmenu'=>'titre', |
|
318 | + // 'leftmenu'=>'titre', |
|
319 | + // 'url'=>'/titre/pagelevel1.php', |
|
320 | + // // Lang file to use (without .lang) by module. |
|
321 | + // // File must be in langs/code_CODE/ directory. |
|
322 | + // 'langs'=>'mylangfile', |
|
323 | + // 'position'=>100, |
|
324 | + // // Define condition to show or hide menu entry. |
|
325 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
326 | + // 'enabled'=>'$conf->titre->enabled', |
|
327 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
328 | + // // if you want your menu with a permission rules |
|
329 | + // 'perms'=>'1', |
|
330 | + // 'target'=>'', |
|
331 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
332 | + // 'user'=>2 |
|
333 | + //); |
|
334 | + //$r++; |
|
335 | + // |
|
336 | + // Example to declare a Left Menu entry into an existing Top menu entry: |
|
337 | + //$this->menu[$r]=array( |
|
338 | + // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
339 | + // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
340 | + // // This is a Left menu entry |
|
341 | + // 'type'=>'left', |
|
342 | + // 'titre'=>'titre left menu', |
|
343 | + // 'mainmenu'=>'mainmenucode', |
|
344 | + // 'leftmenu'=>'titre', |
|
345 | + // 'url'=>'/titre/pagelevel2.php', |
|
346 | + // // Lang file to use (without .lang) by module. |
|
347 | + // // File must be in langs/code_CODE/ directory. |
|
348 | + // 'langs'=>'mylangfile', |
|
349 | + // 'position'=>100, |
|
350 | + // // Define condition to show or hide menu entry. |
|
351 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
352 | + // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
353 | + // 'enabled'=>'$conf->titre->enabled', |
|
354 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
355 | + // // if you want your menu with a permission rules |
|
356 | + // 'perms'=>'1', |
|
357 | + // 'target'=>'', |
|
358 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
359 | + // 'user'=>2 |
|
360 | + //); |
|
361 | + //$r++; |
|
362 | + // Exports |
|
363 | + $r = 1; |
|
364 | 364 | |
365 | - // Example: |
|
366 | - //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
367 | - //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
368 | - //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
369 | - //// Condition to show export in list (ie: '$user->id==3'). |
|
370 | - //// Set to 1 to always show when module is enabled. |
|
371 | - //$this->export_enabled[$r]='1'; |
|
372 | - //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
373 | - //$this->export_fields_array[$r]=array( |
|
374 | - // 's.rowid'=>"IdCompany", |
|
375 | - // 's.nom'=>'CompanyName', |
|
376 | - // 's.address'=>'Address', |
|
377 | - // 's.cp'=>'Zip', |
|
378 | - // 's.ville'=>'Town', |
|
379 | - // 's.fk_pays'=>'Country', |
|
380 | - // 's.tel'=>'Phone', |
|
381 | - // 's.siren'=>'ProfId1', |
|
382 | - // 's.siret'=>'ProfId2', |
|
383 | - // 's.ape'=>'ProfId3', |
|
384 | - // 's.idprof4'=>'ProfId4', |
|
385 | - // 's.code_compta'=>'CustomerAccountancyCode', |
|
386 | - // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
387 | - // 'f.rowid'=>"InvoiceId", |
|
388 | - // 'f.facnumber'=>"InvoiceRef", |
|
389 | - // 'f.datec'=>"InvoiceDateCreation", |
|
390 | - // 'f.datef'=>"DateInvoice", |
|
391 | - // 'f.total'=>"TotalHT", |
|
392 | - // 'f.total_ttc'=>"TotalTTC", |
|
393 | - // 'f.tva'=>"TotalVAT", |
|
394 | - // 'f.paye'=>"InvoicePaid", |
|
395 | - // 'f.fk_statut'=>'InvoiceStatus', |
|
396 | - // 'f.note'=>"InvoiceNote", |
|
397 | - // 'fd.rowid'=>'LineId', |
|
398 | - // 'fd.description'=>"LineDescription", |
|
399 | - // 'fd.price'=>"LineUnitPrice", |
|
400 | - // 'fd.tva_tx'=>"LineVATRate", |
|
401 | - // 'fd.qty'=>"LineQty", |
|
402 | - // 'fd.total_ht'=>"LineTotalHT", |
|
403 | - // 'fd.total_tva'=>"LineTotalTVA", |
|
404 | - // 'fd.total_ttc'=>"LineTotalTTC", |
|
405 | - // 'fd.date_start'=>"DateStart", |
|
406 | - // 'fd.date_end'=>"DateEnd", |
|
407 | - // 'fd.fk_product'=>'ProductId', |
|
408 | - // 'p.ref'=>'ProductRef' |
|
409 | - //); |
|
410 | - //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
411 | - // 's.nom'=>'company', |
|
412 | - // 's.address'=>'company', |
|
413 | - // 's.cp'=>'company', |
|
414 | - // 's.ville'=>'company', |
|
415 | - // 's.fk_pays'=>'company', |
|
416 | - // 's.tel'=>'company', |
|
417 | - // 's.siren'=>'company', |
|
418 | - // 's.siret'=>'company', |
|
419 | - // 's.ape'=>'company', |
|
420 | - // 's.idprof4'=>'company', |
|
421 | - // 's.code_compta'=>'company', |
|
422 | - // 's.code_compta_fournisseur'=>'company', |
|
423 | - // 'f.rowid'=>"invoice", |
|
424 | - // 'f.facnumber'=>"invoice", |
|
425 | - // 'f.datec'=>"invoice", |
|
426 | - // 'f.datef'=>"invoice", |
|
427 | - // 'f.total'=>"invoice", |
|
428 | - // 'f.total_ttc'=>"invoice", |
|
429 | - // 'f.tva'=>"invoice", |
|
430 | - // 'f.paye'=>"invoice", |
|
431 | - // 'f.fk_statut'=>'invoice', |
|
432 | - // 'f.note'=>"invoice", |
|
433 | - // 'fd.rowid'=>'invoice_line', |
|
434 | - // 'fd.description'=>"invoice_line", |
|
435 | - // 'fd.price'=>"invoice_line", |
|
436 | - // 'fd.total_ht'=>"invoice_line", |
|
437 | - // 'fd.total_tva'=>"invoice_line", |
|
438 | - // 'fd.total_ttc'=>"invoice_line", |
|
439 | - // 'fd.tva_tx'=>"invoice_line", |
|
440 | - // 'fd.qty'=>"invoice_line", |
|
441 | - // 'fd.date_start'=>"invoice_line", |
|
442 | - // 'fd.date_end'=>"invoice_line", |
|
443 | - // 'fd.fk_product'=>'product', |
|
444 | - // 'p.ref'=>'product' |
|
445 | - //); |
|
446 | - //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
447 | - //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
448 | - // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
449 | - //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
450 | - // . 'product as p on (fd.fk_product = p.rowid)'; |
|
451 | - //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
452 | - // . 'AND f.rowid = fd.fk_facture'; |
|
453 | - //$r++; |
|
454 | - } |
|
365 | + // Example: |
|
366 | + //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
367 | + //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
368 | + //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
369 | + //// Condition to show export in list (ie: '$user->id==3'). |
|
370 | + //// Set to 1 to always show when module is enabled. |
|
371 | + //$this->export_enabled[$r]='1'; |
|
372 | + //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
373 | + //$this->export_fields_array[$r]=array( |
|
374 | + // 's.rowid'=>"IdCompany", |
|
375 | + // 's.nom'=>'CompanyName', |
|
376 | + // 's.address'=>'Address', |
|
377 | + // 's.cp'=>'Zip', |
|
378 | + // 's.ville'=>'Town', |
|
379 | + // 's.fk_pays'=>'Country', |
|
380 | + // 's.tel'=>'Phone', |
|
381 | + // 's.siren'=>'ProfId1', |
|
382 | + // 's.siret'=>'ProfId2', |
|
383 | + // 's.ape'=>'ProfId3', |
|
384 | + // 's.idprof4'=>'ProfId4', |
|
385 | + // 's.code_compta'=>'CustomerAccountancyCode', |
|
386 | + // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
387 | + // 'f.rowid'=>"InvoiceId", |
|
388 | + // 'f.facnumber'=>"InvoiceRef", |
|
389 | + // 'f.datec'=>"InvoiceDateCreation", |
|
390 | + // 'f.datef'=>"DateInvoice", |
|
391 | + // 'f.total'=>"TotalHT", |
|
392 | + // 'f.total_ttc'=>"TotalTTC", |
|
393 | + // 'f.tva'=>"TotalVAT", |
|
394 | + // 'f.paye'=>"InvoicePaid", |
|
395 | + // 'f.fk_statut'=>'InvoiceStatus', |
|
396 | + // 'f.note'=>"InvoiceNote", |
|
397 | + // 'fd.rowid'=>'LineId', |
|
398 | + // 'fd.description'=>"LineDescription", |
|
399 | + // 'fd.price'=>"LineUnitPrice", |
|
400 | + // 'fd.tva_tx'=>"LineVATRate", |
|
401 | + // 'fd.qty'=>"LineQty", |
|
402 | + // 'fd.total_ht'=>"LineTotalHT", |
|
403 | + // 'fd.total_tva'=>"LineTotalTVA", |
|
404 | + // 'fd.total_ttc'=>"LineTotalTTC", |
|
405 | + // 'fd.date_start'=>"DateStart", |
|
406 | + // 'fd.date_end'=>"DateEnd", |
|
407 | + // 'fd.fk_product'=>'ProductId', |
|
408 | + // 'p.ref'=>'ProductRef' |
|
409 | + //); |
|
410 | + //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
411 | + // 's.nom'=>'company', |
|
412 | + // 's.address'=>'company', |
|
413 | + // 's.cp'=>'company', |
|
414 | + // 's.ville'=>'company', |
|
415 | + // 's.fk_pays'=>'company', |
|
416 | + // 's.tel'=>'company', |
|
417 | + // 's.siren'=>'company', |
|
418 | + // 's.siret'=>'company', |
|
419 | + // 's.ape'=>'company', |
|
420 | + // 's.idprof4'=>'company', |
|
421 | + // 's.code_compta'=>'company', |
|
422 | + // 's.code_compta_fournisseur'=>'company', |
|
423 | + // 'f.rowid'=>"invoice", |
|
424 | + // 'f.facnumber'=>"invoice", |
|
425 | + // 'f.datec'=>"invoice", |
|
426 | + // 'f.datef'=>"invoice", |
|
427 | + // 'f.total'=>"invoice", |
|
428 | + // 'f.total_ttc'=>"invoice", |
|
429 | + // 'f.tva'=>"invoice", |
|
430 | + // 'f.paye'=>"invoice", |
|
431 | + // 'f.fk_statut'=>'invoice', |
|
432 | + // 'f.note'=>"invoice", |
|
433 | + // 'fd.rowid'=>'invoice_line', |
|
434 | + // 'fd.description'=>"invoice_line", |
|
435 | + // 'fd.price'=>"invoice_line", |
|
436 | + // 'fd.total_ht'=>"invoice_line", |
|
437 | + // 'fd.total_tva'=>"invoice_line", |
|
438 | + // 'fd.total_ttc'=>"invoice_line", |
|
439 | + // 'fd.tva_tx'=>"invoice_line", |
|
440 | + // 'fd.qty'=>"invoice_line", |
|
441 | + // 'fd.date_start'=>"invoice_line", |
|
442 | + // 'fd.date_end'=>"invoice_line", |
|
443 | + // 'fd.fk_product'=>'product', |
|
444 | + // 'p.ref'=>'product' |
|
445 | + //); |
|
446 | + //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
447 | + //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
448 | + // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
449 | + //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
450 | + // . 'product as p on (fd.fk_product = p.rowid)'; |
|
451 | + //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
452 | + // . 'AND f.rowid = fd.fk_facture'; |
|
453 | + //$r++; |
|
454 | + } |
|
455 | 455 | |
456 | - /** |
|
457 | - * Function called when module is enabled. |
|
458 | - * The init function add constants, boxes, permissions and menus |
|
459 | - * (defined in constructor) into Dolibarr database. |
|
460 | - * It also creates data directories |
|
461 | - * |
|
462 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
463 | - * @return int 1 if OK, 0 if KO |
|
464 | - */ |
|
465 | - public function init($options = '') |
|
466 | - { |
|
456 | + /** |
|
457 | + * Function called when module is enabled. |
|
458 | + * The init function add constants, boxes, permissions and menus |
|
459 | + * (defined in constructor) into Dolibarr database. |
|
460 | + * It also creates data directories |
|
461 | + * |
|
462 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
463 | + * @return int 1 if OK, 0 if KO |
|
464 | + */ |
|
465 | + public function init($options = '') |
|
466 | + { |
|
467 | 467 | global $conf, $db; |
468 | 468 | |
469 | 469 | |
@@ -471,46 +471,46 @@ discard block |
||
471 | 471 | exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant."); |
472 | 472 | } |
473 | 473 | */ |
474 | - $sql = array(); |
|
474 | + $sql = array(); |
|
475 | 475 | |
476 | - $result = $this->loadTables(); |
|
477 | - dol_include_once('/core/class/extrafields.class.php'); |
|
476 | + $result = $this->loadTables(); |
|
477 | + dol_include_once('/core/class/extrafields.class.php'); |
|
478 | 478 | |
479 | - $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
480 | - $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
481 | - foreach($TElementType as $element_type) { |
|
482 | - $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
483 | - $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
484 | - } |
|
479 | + $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
480 | + $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
481 | + foreach($TElementType as $element_type) { |
|
482 | + $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
483 | + $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
|
484 | + } |
|
485 | 485 | |
486 | - return $this->_init($sql, $options); |
|
487 | - } |
|
486 | + return $this->_init($sql, $options); |
|
487 | + } |
|
488 | 488 | |
489 | - /** |
|
490 | - * Function called when module is disabled. |
|
491 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
492 | - * Data directories are not deleted |
|
493 | - * |
|
494 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
495 | - * @return int 1 if OK, 0 if KO |
|
496 | - */ |
|
497 | - public function remove($options = '') |
|
498 | - { |
|
499 | - $sql = array(); |
|
489 | + /** |
|
490 | + * Function called when module is disabled. |
|
491 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
492 | + * Data directories are not deleted |
|
493 | + * |
|
494 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
495 | + * @return int 1 if OK, 0 if KO |
|
496 | + */ |
|
497 | + public function remove($options = '') |
|
498 | + { |
|
499 | + $sql = array(); |
|
500 | 500 | |
501 | - return $this->_remove($sql, $options); |
|
502 | - } |
|
501 | + return $this->_remove($sql, $options); |
|
502 | + } |
|
503 | 503 | |
504 | - /** |
|
505 | - * Create tables, keys and data required by module |
|
506 | - * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
507 | - * and create data commands must be stored in directory /titre/sql/ |
|
508 | - * This function is called by this->init |
|
509 | - * |
|
510 | - * @return int <=0 if KO, >0 if OK |
|
511 | - */ |
|
512 | - private function loadTables() |
|
513 | - { |
|
514 | - return $this->_load_tables('/subtotal/sql/'); |
|
515 | - } |
|
504 | + /** |
|
505 | + * Create tables, keys and data required by module |
|
506 | + * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
507 | + * and create data commands must be stored in directory /titre/sql/ |
|
508 | + * This function is called by this->init |
|
509 | + * |
|
510 | + * @return int <=0 if KO, >0 if OK |
|
511 | + */ |
|
512 | + private function loadTables() |
|
513 | + { |
|
514 | + return $this->_load_tables('/subtotal/sql/'); |
|
515 | + } |
|
516 | 516 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup titre |
24 | 24 | * \brief Description and activation file for module titre |
25 | 25 | */ |
26 | -include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php"; |
|
26 | +include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php"; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Description and activation class for module titre |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->version = '3.1.4'; |
67 | 67 | // Key used in llx_const table to save module status enabled/disabled |
68 | 68 | // (where MYMODULE is value of property name of module in uppercase) |
69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
69 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
70 | 70 | // Where to store the module in setup page |
71 | 71 | // (0=common,1=interface,2=others,3=very specific) |
72 | 72 | $this->special = 2; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | // List of modules id that must be enabled if this module is enabled |
126 | 126 | $this->depends = array(); |
127 | 127 | |
128 | - $this->conflictwith=array('modMilestone'); |
|
128 | + $this->conflictwith = array('modMilestone'); |
|
129 | 129 | // List of modules id to disable if this one is disabled |
130 | 130 | $this->requiredby = array(); |
131 | 131 | // Minimum version of PHP required by module |
@@ -190,20 +190,20 @@ discard block |
||
190 | 190 | // 'categories_x' to add a tab in category view |
191 | 191 | // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
192 | 192 | // Dictionnaries |
193 | - if (! isset($conf->subtotal->enabled)) { |
|
194 | - $conf->subtotal=new stdClass(); |
|
193 | + if (!isset($conf->subtotal->enabled)) { |
|
194 | + $conf->subtotal = new stdClass(); |
|
195 | 195 | $conf->subtotal->enabled = 0; |
196 | 196 | } |
197 | 197 | $this->dictionaries = array( |
198 | 198 | 'langs'=>'subtotal@subtotal', |
199 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
200 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
201 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
202 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
203 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
204 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
205 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
206 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
199 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
200 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
201 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
202 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
203 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
204 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
205 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
206 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
207 | 207 | 'tabcond'=>array($conf->subtotal->enabled) |
208 | 208 | ); |
209 | 209 | /* Example: |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | |
479 | 479 | $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
480 | 480 | $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
481 | - foreach($TElementType as $element_type) { |
|
481 | + foreach ($TElementType as $element_type) { |
|
482 | 482 | $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
483 | 483 | $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1); |
484 | 484 | } |