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