|
1
|
|
|
<?php |
|
2
|
|
|
/* Copyright (C) 2003 Rodolphe Quiedeville <[email protected]> |
|
3
|
|
|
* Copyright (C) 2004-2015 Laurent Destailleur <[email protected]> |
|
4
|
|
|
* Copyright (C) 2005-2016 Regis Houssin <[email protected]> |
|
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 <http://www.gnu.org/licenses/>. |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* \defgroup mymodule Module MyModule |
|
22
|
|
|
* \brief Example of a module descriptor. |
|
23
|
|
|
* Such a file must be copied into htdocs/mymodule/core/modules directory. |
|
24
|
|
|
* \file htdocs/mymodule/core/modules/modMyModule.class.php |
|
25
|
|
|
* \ingroup mymodule |
|
26
|
|
|
* \brief Description and activation file for module MyModule |
|
27
|
|
|
*/ |
|
28
|
|
|
include_once DOL_DOCUMENT_ROOT . '/core/modules/DolibarrModules.class.php'; |
|
29
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Description and activation class for module MyModule |
|
33
|
|
|
*/ |
|
34
|
|
|
class modFlightLog extends DolibarrModules |
|
35
|
|
|
{ |
|
36
|
|
|
const MENU_TYPE_LEFT = 'left'; |
|
37
|
|
|
const MENU_TYPE_TOP = 'top'; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var array Indexed list of export IDs |
|
41
|
|
|
* |
|
42
|
|
|
*/ |
|
43
|
|
|
public $export_code = array(); |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @var array Indexed list of export names |
|
47
|
|
|
* |
|
48
|
|
|
*/ |
|
49
|
|
|
public $export_label = array(); |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @var array Indexed list of export enabling conditions |
|
53
|
|
|
* |
|
54
|
|
|
*/ |
|
55
|
|
|
public $export_enabled = array(); |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @var array Indexed list of export required permissions |
|
59
|
|
|
* |
|
60
|
|
|
*/ |
|
61
|
|
|
public $export_permission = array(); |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @var array Indexed list of export fields |
|
65
|
|
|
* |
|
66
|
|
|
*/ |
|
67
|
|
|
public $export_fields_array = array(); |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @var array Indexed list of export entities |
|
71
|
|
|
* |
|
72
|
|
|
*/ |
|
73
|
|
|
public $export_entities_array = array(); |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @var array Indexed list of export SQL queries start |
|
77
|
|
|
* |
|
78
|
|
|
*/ |
|
79
|
|
|
public $export_sql_start = array(); |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @var array Indexed list of export SQL queries end |
|
83
|
|
|
* |
|
84
|
|
|
*/ |
|
85
|
|
|
public $export_sql_end = array(); |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* @var array |
|
89
|
|
|
*/ |
|
90
|
|
|
public $export_TypeFields_array = []; |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @var array |
|
94
|
|
|
*/ |
|
95
|
|
|
public $menus; |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @var array |
|
99
|
|
|
*/ |
|
100
|
|
|
public $tabs; |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @var array |
|
104
|
|
|
*/ |
|
105
|
|
|
public $dictionaries; |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* Constructor. Define names, constants, directories, boxes, permissions |
|
109
|
|
|
* |
|
110
|
|
|
* @param DoliDB $db Database handler |
|
111
|
|
|
*/ |
|
112
|
|
|
public function __construct($db) |
|
113
|
|
|
{ |
|
114
|
|
|
parent::__construct($db); |
|
115
|
|
|
|
|
116
|
|
|
global $conf; |
|
117
|
|
|
|
|
118
|
|
|
// Id for module (must be unique). |
|
119
|
|
|
$this->numero = 500000; |
|
120
|
|
|
// Key text used to identify module (for permissions, menus, etc...) |
|
121
|
|
|
$this->rights_class = 'flightlog'; |
|
122
|
|
|
|
|
123
|
|
|
$this->family = "Belgian Balloon Club"; |
|
124
|
|
|
$this->module_position = 500; |
|
125
|
|
|
$this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
126
|
|
|
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
|
127
|
|
|
$this->description = "Pilots flight log"; |
|
128
|
|
|
$this->descriptionlong = "Manage flights and flight types for the Belgian Balloon Club"; |
|
129
|
|
|
$this->editor_name = 'De Coninck Laurent'; |
|
130
|
|
|
$this->editor_url = 'http://www.dolibarr.org'; |
|
131
|
|
|
|
|
132
|
|
|
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' |
|
133
|
|
|
$this->version = '1.1'; |
|
134
|
|
|
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
135
|
|
|
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
136
|
|
|
// Name of image file used for this module. |
|
137
|
|
|
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
138
|
|
|
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
139
|
|
|
$this->picto = 'flight@flightlog'; |
|
140
|
|
|
|
|
141
|
|
|
$this->module_parts = [ |
|
142
|
|
|
'css' => '/flightlog/css/flightlog.css', |
|
143
|
|
|
]; |
|
144
|
|
|
|
|
145
|
|
|
// Data directories to create when module is enabled. |
|
146
|
|
|
$this->dirs = array(); |
|
147
|
|
|
|
|
148
|
|
|
// Config pages. Put here list of php page, stored into mymodule/admin directory, to use to setup module. |
|
149
|
|
|
$this->config_page_url = [ |
|
150
|
|
|
"vol.php@flightlog", |
|
151
|
|
|
]; |
|
152
|
|
|
|
|
153
|
|
|
// Dependencies |
|
154
|
|
|
$this->hidden = false; |
|
155
|
|
|
$this->depends = array('modFlightBalloon'); |
|
156
|
|
|
$this->requiredby = array(); |
|
157
|
|
|
$this->conflictwith = array(); |
|
158
|
|
|
$this->phpmin = array(5, 5); |
|
159
|
|
|
$this->need_dolibarr_version = array(4, 0); |
|
160
|
|
|
$this->langfiles = array("mymodule@flightlog"); |
|
161
|
|
|
|
|
162
|
|
|
// Constants |
|
163
|
|
|
$this->initConstants(); |
|
164
|
|
|
|
|
165
|
|
|
// Array to add new pages in new tabs |
|
166
|
|
|
$this->tabs = []; |
|
167
|
|
|
|
|
168
|
|
|
if (!isset($conf->flightLog) || !isset($conf->flightLog->enabled)) { |
|
169
|
|
|
$conf->flightLog = new stdClass(); |
|
170
|
|
|
$conf->flightLog->enabled = 0; |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
$this->boxes = []; |
|
174
|
|
|
|
|
175
|
|
|
$this->initDictionnaries(); |
|
176
|
|
|
$this->initCronJobs(); |
|
177
|
|
|
$this->initMenu(); |
|
178
|
|
|
$this->initHooks(); |
|
179
|
|
|
$this->initPermissions(); |
|
180
|
|
|
$this->initExports(); |
|
181
|
|
|
|
|
182
|
|
|
$this->activateTriggers(); |
|
183
|
|
|
$this->initWorkflows(); |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* Function called when module is enabled. |
|
188
|
|
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
|
189
|
|
|
* It also creates data directories |
|
190
|
|
|
* |
|
191
|
|
|
* @param string $options Options when enabling module ('', 'noboxes') |
|
192
|
|
|
* |
|
193
|
|
|
* @return int 1 if OK, 0 if KO |
|
194
|
|
|
*/ |
|
195
|
|
|
public function init($options = '') |
|
196
|
|
|
{ |
|
197
|
|
|
$sql = array(); |
|
198
|
|
|
|
|
199
|
|
|
$this->_load_tables('/flightlog/sql/'); |
|
200
|
|
|
|
|
201
|
|
|
return $this->_init($sql, $options); |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
/** |
|
205
|
|
|
* Function called when module is disabled. |
|
206
|
|
|
* Remove from database constants, boxes and permissions from Dolibarr database. |
|
207
|
|
|
* Data directories are not deleted |
|
208
|
|
|
* |
|
209
|
|
|
* @param string $options Options when enabling module ('', 'noboxes') |
|
210
|
|
|
* |
|
211
|
|
|
* @return int 1 if OK, 0 if KO |
|
212
|
|
|
*/ |
|
213
|
|
|
public function remove($options = '') |
|
214
|
|
|
{ |
|
215
|
|
|
$sql = array(); |
|
216
|
|
|
|
|
217
|
|
|
return $this->_remove($sql, $options); |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* Init menu |
|
222
|
|
|
*/ |
|
223
|
|
|
private function initMenu() |
|
224
|
|
|
{ |
|
225
|
|
|
$this->menus = array(); |
|
226
|
|
|
$r = 0; |
|
227
|
|
|
|
|
228
|
|
|
$this->menu[$r] = array( |
|
229
|
|
|
'fk_menu' => 'fk_mainmenu=flightlog', |
|
230
|
|
|
'type' => self::MENU_TYPE_TOP, |
|
231
|
|
|
'titre' => 'Carnet de vols', |
|
232
|
|
|
'mainmenu' => 'flightlog', |
|
233
|
|
|
'leftmenu' => 'readFlight', |
|
234
|
|
|
'url' => '/flightlog/readFlights.php', |
|
235
|
|
|
'langs' => 'mylangfile', |
|
236
|
|
|
'position' => 100, |
|
237
|
|
|
'enabled' => '1', |
|
238
|
|
|
'perms' => '$user->rights->flightlog->vol->access', |
|
239
|
|
|
'target' => '', |
|
240
|
|
|
'user' => 0 |
|
241
|
|
|
); |
|
242
|
|
|
$r++; |
|
243
|
|
|
|
|
244
|
|
|
$this->menu[$r] = array( |
|
245
|
|
|
'fk_menu' => 'fk_mainmenu=flightlog', |
|
246
|
|
|
'type' => self::MENU_TYPE_LEFT, |
|
247
|
|
|
'titre' => 'Ajouter un vol', |
|
248
|
|
|
'mainmenu' => 'flightlog', |
|
249
|
|
|
'leftmenu' => 'addFlight', |
|
250
|
|
|
'url' => '/flightlog/addFlight.php', |
|
251
|
|
|
'langs' => 'mylangfile', |
|
252
|
|
|
'position' => 101, |
|
253
|
|
|
'enabled' => '1', |
|
254
|
|
|
'perms' => '$user->rights->flightlog->vol->add', |
|
255
|
|
|
'target' => '', |
|
256
|
|
|
'user' => 2 |
|
257
|
|
|
); |
|
258
|
|
|
$r++; |
|
259
|
|
|
$this->menu[$r] = array( |
|
260
|
|
|
'fk_menu' => 'fk_mainmenu=flightlog', |
|
261
|
|
|
'type' => self::MENU_TYPE_LEFT, |
|
262
|
|
|
'titre' => 'Visualisation', |
|
263
|
|
|
'mainmenu' => 'flightlog', |
|
264
|
|
|
'leftmenu' => 'showFlight', |
|
265
|
|
|
'url' => '/flightlog/readFlights.php', |
|
266
|
|
|
'langs' => 'mylangfile', |
|
267
|
|
|
'position' => 102, |
|
268
|
|
|
'enabled' => '1', |
|
269
|
|
|
'perms' => '1', |
|
270
|
|
|
'target' => '', |
|
271
|
|
|
'user' => 2 |
|
272
|
|
|
); |
|
273
|
|
|
$this->menu[$r] = array( |
|
274
|
|
|
'fk_menu' => 'fk_mainmenu=flightlog', |
|
275
|
|
|
'type' => self::MENU_TYPE_LEFT, |
|
276
|
|
|
'titre' => 'Les vols', |
|
277
|
|
|
'mainmenu' => 'flightlog', |
|
278
|
|
|
'leftmenu' => 'flightlog', |
|
279
|
|
|
'url' => '/flightlog/list.php', |
|
280
|
|
|
'langs' => 'mylangfile', |
|
281
|
|
|
'position' => 105, |
|
282
|
|
|
'enabled' => '1', |
|
283
|
|
|
'perms' => '1', |
|
284
|
|
|
'target' => '', |
|
285
|
|
|
'user' => 2 |
|
286
|
|
|
); |
|
287
|
|
|
$r++; |
|
288
|
|
|
$this->menu[$r] = array( |
|
289
|
|
|
'fk_menu' => 'fk_mainmenu=flightlog', |
|
290
|
|
|
'type' => self::MENU_TYPE_LEFT, |
|
291
|
|
|
'titre' => 'Gestion', |
|
292
|
|
|
'mainmenu' => 'flightlog', |
|
293
|
|
|
'leftmenu' => 'management', |
|
294
|
|
|
'url' => '', |
|
295
|
|
|
'langs' => 'mylangfile', |
|
296
|
|
|
'position' => 106, |
|
297
|
|
|
'enabled' => '1', |
|
298
|
|
|
'perms' => '$user->rights->flightlog->vol->status||$user->rights->flightlog->vol->detail', |
|
299
|
|
|
'target' => '', |
|
300
|
|
|
'user' => 2 |
|
301
|
|
|
); |
|
302
|
|
|
$r++; |
|
303
|
|
|
$this->menu[$r] = array( |
|
304
|
|
|
'fk_menu' => 'fk_mainmenu=flightlog,fk_leftmenu=management', |
|
305
|
|
|
'type' => self::MENU_TYPE_LEFT, |
|
306
|
|
|
'titre' => 'Payement', |
|
307
|
|
|
'mainmenu' => 'flightlog', |
|
308
|
|
|
'leftmenu' => 'flightBilling', |
|
309
|
|
|
'url' => '/flightlog/listFact.php?view=1', |
|
310
|
|
|
'langs' => 'mylangfile', |
|
311
|
|
|
'position' => 107, |
|
312
|
|
|
'enabled' => '1', |
|
313
|
|
|
'perms' => '$user->rights->flightlog->vol->financial', |
|
314
|
|
|
'target' => '', |
|
315
|
|
|
'user' => 2 |
|
316
|
|
|
); |
|
317
|
|
|
$r++; |
|
318
|
|
|
$this->menu[$r] = array( |
|
319
|
|
|
'fk_menu' => 'fk_mainmenu=flightlog,fk_leftmenu=management', |
|
320
|
|
|
'type' => self::MENU_TYPE_LEFT, |
|
321
|
|
|
'titre' => 'Aviabel', |
|
322
|
|
|
'mainmenu' => 'flightlog', |
|
323
|
|
|
'leftmenu' => 'flightAviabel', |
|
324
|
|
|
'url' => '/flightlog/listFact.php?view=2', |
|
325
|
|
|
'langs' => 'mylangfile', |
|
326
|
|
|
'position' => 108, |
|
327
|
|
|
'enabled' => '1', |
|
328
|
|
|
'perms' => '$user->rights->flightlog->vol->detail', |
|
329
|
|
|
'target' => '', |
|
330
|
|
|
'user' => 2 |
|
331
|
|
|
); |
|
332
|
|
|
} |
|
333
|
|
|
|
|
334
|
|
|
/** |
|
335
|
|
|
* Init permissions |
|
336
|
|
|
*/ |
|
337
|
|
|
private function initPermissions() |
|
338
|
|
|
{ |
|
339
|
|
|
$this->rights = array(); // Permission array used by this module |
|
340
|
|
|
$r = 0; |
|
341
|
|
|
|
|
342
|
|
|
$this->rights[$r][0] = 9993; |
|
343
|
|
|
$this->rights[$r][1] = 'Permet d\'acceder au module des vols.'; |
|
344
|
|
|
$this->rights[$r][3] = 0; |
|
345
|
|
|
$this->rights[$r][4] = 'vol'; |
|
346
|
|
|
$this->rights[$r][5] = 'access'; |
|
347
|
|
|
$r++; |
|
348
|
|
|
|
|
349
|
|
|
$this->rights[$r][0] = 9998; |
|
350
|
|
|
$this->rights[$r][1] = 'Enregistrer un nouveau vol.'; |
|
351
|
|
|
$this->rights[$r][3] = 0; |
|
352
|
|
|
$this->rights[$r][4] = 'vol'; |
|
353
|
|
|
$this->rights[$r][5] = 'add'; |
|
354
|
|
|
$r++; |
|
355
|
|
|
|
|
356
|
|
|
$this->rights[$r][0] = 9997; |
|
357
|
|
|
$this->rights[$r][1] = 'Permet de facturer un vol.'; |
|
358
|
|
|
$this->rights[$r][3] = 0; |
|
359
|
|
|
$this->rights[$r][4] = 'vol'; |
|
360
|
|
|
$this->rights[$r][5] = 'status'; |
|
361
|
|
|
$r++; |
|
362
|
|
|
|
|
363
|
|
|
$this->rights[$r][0] = 9996; |
|
364
|
|
|
$this->rights[$r][1] = 'Permet de supprimer un vol.'; |
|
365
|
|
|
$this->rights[$r][3] = 0; |
|
366
|
|
|
$this->rights[$r][4] = 'vol'; |
|
367
|
|
|
$this->rights[$r][5] = 'delete'; |
|
368
|
|
|
$r++; |
|
369
|
|
|
|
|
370
|
|
|
$this->rights[$r][0] = 9995; |
|
371
|
|
|
$this->rights[$r][1] = 'Permet de modifier tous les vols.'; |
|
372
|
|
|
$this->rights[$r][3] = 0; |
|
373
|
|
|
$this->rights[$r][4] = 'vol'; |
|
374
|
|
|
$this->rights[$r][5] = 'edit'; |
|
375
|
|
|
$r++; |
|
376
|
|
|
|
|
377
|
|
|
$this->rights[$r][0] = 9994; |
|
378
|
|
|
$this->rights[$r][1] = 'affiche les details de tous les ballons et de tous les pilotes.'; |
|
379
|
|
|
$this->rights[$r][3] = 0; |
|
380
|
|
|
$this->rights[$r][4] = 'vol'; |
|
381
|
|
|
$this->rights[$r][5] = 'detail'; |
|
382
|
|
|
$r++; |
|
383
|
|
|
|
|
384
|
|
|
$this->rights[$r][0] = 9999; |
|
385
|
|
|
$this->rights[$r][1] = 'Gérer les aspects financier des vols'; |
|
386
|
|
|
$this->rights[$r][3] = 0; |
|
387
|
|
|
$this->rights[$r][4] = 'vol'; |
|
388
|
|
|
$this->rights[$r][5] = 'financial'; |
|
389
|
|
|
$r++; |
|
390
|
|
|
|
|
391
|
|
|
$this->rights[$r][0] = 10000; |
|
392
|
|
|
$this->rights[$r][1] = 'Gérer des documents financiers'; |
|
393
|
|
|
$this->rights[$r][3] = 0; |
|
394
|
|
|
$this->rights[$r][4] = 'vol'; |
|
395
|
|
|
$this->rights[$r][5] = 'financialGenerateDocuments'; |
|
396
|
|
|
} |
|
397
|
|
|
|
|
398
|
|
|
private function initCronJobs() |
|
399
|
|
|
{ |
|
400
|
|
|
$this->cronjobs = array(); |
|
401
|
|
|
} |
|
402
|
|
|
|
|
403
|
|
|
private function initDictionnaries() |
|
404
|
|
|
{ |
|
405
|
|
|
$this->initFlightTypeDictionnary(); |
|
406
|
|
|
} |
|
407
|
|
|
|
|
408
|
|
|
private function initFlightTypeDictionnary() |
|
409
|
|
|
{ |
|
410
|
|
|
$this->dictionaries = array( |
|
411
|
|
|
'langs' => 'mylangfile@mymodule', |
|
412
|
|
|
'tabname' => array(MAIN_DB_PREFIX . "bbc_types"), |
|
413
|
|
|
'tablib' => array("Types de vols"), |
|
414
|
|
|
'tabsql' => array('SELECT f.idType, f.numero, f.nom, f.active FROM ' . MAIN_DB_PREFIX . 'bbc_types as f',), |
|
415
|
|
|
'tabsqlsort' => array("numero ASC"), |
|
416
|
|
|
'tabfield' => array("idType,numero,nom"), |
|
417
|
|
|
'tabfieldvalue' => array("numero,nom"), |
|
418
|
|
|
'tabfieldinsert' => array("numero,nom"), |
|
419
|
|
|
'tabrowid' => array("idType"), |
|
420
|
|
|
'tabcond' => array('$conf->flightlog->enabled'), |
|
421
|
|
|
); |
|
422
|
|
|
} |
|
423
|
|
|
|
|
424
|
|
|
/** |
|
425
|
|
|
* Init hooks |
|
426
|
|
|
*/ |
|
427
|
|
|
private function initHooks() |
|
428
|
|
|
{ |
|
429
|
|
|
if (!isset($this->module_parts["hooks"])) { |
|
430
|
|
|
$this->module_parts["hooks"] = []; |
|
431
|
|
|
} |
|
432
|
|
|
|
|
433
|
|
|
$this->module_parts["hooks"][] = "searchform"; |
|
434
|
|
|
$this->module_parts["hooks"][] = "showLinkToObjectBlock"; |
|
435
|
|
|
$this->module_parts["hooks"][] = "criccar"; |
|
436
|
|
|
|
|
437
|
|
|
} |
|
438
|
|
|
|
|
439
|
|
|
private function initConstants() |
|
440
|
|
|
{ |
|
441
|
|
|
$this->const = array( |
|
442
|
|
|
0 => [ |
|
443
|
|
|
'BBC_FLIGHT_LOG_TAUX_REMB_KM', |
|
444
|
|
|
'chaine', |
|
445
|
|
|
'0.25', |
|
446
|
|
|
'Taux remboursement des kilomètres au BBC', |
|
447
|
|
|
true, |
|
448
|
|
|
'current', |
|
449
|
|
|
true |
|
450
|
|
|
], |
|
451
|
|
|
1 => [ |
|
452
|
|
|
'BBC_FLIGHT_LOG_UNIT_PRICE_MISSION', |
|
453
|
|
|
'chaine', |
|
454
|
|
|
'35', |
|
455
|
|
|
'Unit price special mission', |
|
456
|
|
|
true, |
|
457
|
|
|
'current', |
|
458
|
|
|
true |
|
459
|
|
|
], |
|
460
|
|
|
); |
|
461
|
|
|
} |
|
462
|
|
|
|
|
463
|
|
|
/** |
|
464
|
|
|
* Init exports |
|
465
|
|
|
*/ |
|
466
|
|
|
private function initExports() |
|
467
|
|
|
{ |
|
468
|
|
|
$r = 0; |
|
469
|
|
|
$this->addFullFlightsExport($r); |
|
470
|
|
|
} |
|
471
|
|
|
|
|
472
|
|
|
/** |
|
473
|
|
|
* @param int $r |
|
474
|
|
|
*/ |
|
475
|
|
|
private function addFullFlightsExport($r) |
|
476
|
|
|
{ |
|
477
|
|
|
$this->export_code[$r] = $this->rights_class . '_' . $r; |
|
478
|
|
|
$this->export_label[$r] = 'Flights export'; |
|
479
|
|
|
$this->export_enabled[$r] = '1'; |
|
480
|
|
|
$this->export_permission[$r] = array(array("flightlog", "vol", "detail")); |
|
481
|
|
|
$this->export_fields_array[$r] = array( |
|
482
|
|
|
"flight.idBBC_vols" => "Identifiant", |
|
483
|
|
|
"flight.date" => "Date", |
|
484
|
|
|
"flight.lieuD" => "Lieu décollage ", |
|
485
|
|
|
"flight.lieuA" => "Lieu atterissage", |
|
486
|
|
|
"flight.heureD" => "Heure décollage", |
|
487
|
|
|
"flight.heureA" => "Heure atterissage", |
|
488
|
|
|
"flight.BBC_ballons_idBBC_ballons" => "Identifiant ballon", |
|
489
|
|
|
"flight.nbrPax" => "# pax", |
|
490
|
|
|
"flight.remarque" => "Remarque", |
|
491
|
|
|
"flight.incidents" => "Incidents", |
|
492
|
|
|
"flight.fk_type" => "Identifiant type", |
|
493
|
|
|
"flight.fk_pilot" => "Identifiant pilote", |
|
494
|
|
|
"flight.fk_organisateur" => "Identifiant organisateur", |
|
495
|
|
|
"flight.is_facture" => "Facture Oui/Non", |
|
496
|
|
|
"flight.kilometers" => "# Km", |
|
497
|
|
|
"flight.cost" => "Cout", |
|
498
|
|
|
"flight.fk_receiver" => "Identifiant receveur d'argent", |
|
499
|
|
|
"flight.justif_kilometers" => "Justificatif kilomètres", |
|
500
|
|
|
"balloon.immat" => "Immat.", |
|
501
|
|
|
"pilot.login" => "Pilote", |
|
502
|
|
|
"flightType.nom" => "Type de vol", |
|
503
|
|
|
"organisator.login" => "Organisateur", |
|
504
|
|
|
"receiver.login" => "Percepteur", |
|
505
|
|
|
); |
|
506
|
|
|
|
|
507
|
|
|
$this->export_TypeFields_array[$r] = [ |
|
508
|
|
|
"flight.date" => "Date", |
|
509
|
|
|
"flight.lieuD" => "Text", |
|
510
|
|
|
"flight.lieuA" => "Text", |
|
511
|
|
|
"flight.heureD" => "Text", |
|
512
|
|
|
"flight.heureA" => "Text", |
|
513
|
|
|
"flight.BBC_ballons_idBBC_ballons" => implode(":", ["List", "bbc_ballons", "immat", "rowid"]), |
|
514
|
|
|
"flight.nbrPax" => "Numeric", |
|
515
|
|
|
"flight.remarque" => "Text", |
|
516
|
|
|
"flight.incidents" => "Text", |
|
517
|
|
|
"flight.fk_type" => implode(":", ["List", "bbc_types", "nom", "idType"]), |
|
518
|
|
|
"flight.fk_pilot" => implode(":", ["List", "user", "login", "rowid"]), |
|
519
|
|
|
"flight.fk_organisateur" => implode(":", ["List", "user", "login", "rowid"]), |
|
520
|
|
|
"flight.is_facture" => "Boolean", |
|
521
|
|
|
"flight.kilometers" => "Numeric", |
|
522
|
|
|
"flight.cost" => "Numeric", |
|
523
|
|
|
"flight.fk_receiver" => implode(":", ["List", "user", "login", "rowid"]), |
|
524
|
|
|
"flight.justif_kilometers" => "Text", |
|
525
|
|
|
]; |
|
526
|
|
|
|
|
527
|
|
|
$this->export_entities_array[$r] = array( |
|
528
|
|
|
"flight.idBBC_vols" => "Flight", |
|
529
|
|
|
"flight.date" => "Flight", |
|
530
|
|
|
"flight.lieuD" => "Flight", |
|
531
|
|
|
"flight.lieuA" => "Flight", |
|
532
|
|
|
"flight.heureD" => "Flight", |
|
533
|
|
|
"flight.heureA" => "Flight", |
|
534
|
|
|
"flight.BBC_ballons_idBBC_ballons" => "Flight", |
|
535
|
|
|
"flight.nbrPax" => "Flight", |
|
536
|
|
|
"flight.remarque" => "Flight", |
|
537
|
|
|
"flight.incidents" => "Flight", |
|
538
|
|
|
"flight.fk_type" => "Flight", |
|
539
|
|
|
"flight.fk_pilot" => "Flight", |
|
540
|
|
|
"flight.fk_organisateur" => "Flight", |
|
541
|
|
|
"flight.is_facture" => "Flight", |
|
542
|
|
|
"flight.kilometers" => "Flight", |
|
543
|
|
|
"flight.cost" => "Flight", |
|
544
|
|
|
"flight.fk_receiver" => "Flight", |
|
545
|
|
|
"flight.justif_kilometers" => "Flight", |
|
546
|
|
|
"balloon.immat" => "Balloon", |
|
547
|
|
|
"pilot.login" => "Pilot", |
|
548
|
|
|
"flightType.nom" => "FlightType", |
|
549
|
|
|
"organisator.login" => "Organisator", |
|
550
|
|
|
"receiver.login" => "Percepteur", |
|
551
|
|
|
); |
|
552
|
|
|
$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
553
|
|
|
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'bbc_vols as flight'; |
|
554
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bbc_ballons as balloon on (flight.BBC_ballons_idBBC_ballons = balloon.rowid)'; |
|
555
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bbc_types as flightType on (flight.fk_type = flightType.idType)'; |
|
556
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user as pilot on (flight.fk_pilot = pilot.rowid)'; |
|
557
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user as organisator on (flight.fk_organisateur = organisator.rowid)'; |
|
558
|
|
|
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user as receiver on (flight.fk_receiver = receiver.rowid)'; |
|
559
|
|
|
$this->export_sql_end[$r] .= ' WHERE 1 = 1'; |
|
560
|
|
|
} |
|
561
|
|
|
|
|
562
|
|
|
/** |
|
563
|
|
|
* Activate triggers for this module |
|
564
|
|
|
*/ |
|
565
|
|
|
private function activateTriggers() |
|
566
|
|
|
{ |
|
567
|
|
|
$this->module_parts['triggers'] = 1; |
|
568
|
|
|
} |
|
569
|
|
|
|
|
570
|
|
|
/** |
|
571
|
|
|
* Initialize all workflows |
|
572
|
|
|
*/ |
|
573
|
|
|
private function initWorkflows() |
|
574
|
|
|
{ |
|
575
|
|
|
$this->module_parts['workflow'] = [ |
|
576
|
|
|
"WORKFLOW_BBC_FLIGHTLOG_SEND_MAIL_ON_INCIDENT" => [ |
|
577
|
|
|
'family' => 'create', |
|
578
|
|
|
'position' => 10, |
|
579
|
|
|
'enabled' => '1', |
|
580
|
|
|
'picto' => 'order' |
|
581
|
|
|
], |
|
582
|
|
|
]; |
|
583
|
|
|
} |
|
584
|
|
|
|
|
585
|
|
|
} |
|
586
|
|
|
|
|
587
|
|
|
|