These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* Copyright (C) 2007-2015 Laurent Destailleur <[email protected]> |
||
3 | * Copyright (C) ---Put here your own copyright and developer email--- |
||
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 | * \file flightLog/bbcvols_card.php |
||
21 | * \ingroup flightLog |
||
22 | * \brief This file is an example of a php page |
||
23 | * Initialy built by build_class_from_table on 2017-02-09 11:10 |
||
24 | */ |
||
25 | |||
26 | //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); |
||
0 ignored issues
–
show
|
|||
27 | //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); |
||
28 | //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); |
||
29 | //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); |
||
30 | //if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test |
||
31 | //if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data |
||
32 | //if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test |
||
33 | //if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu |
||
34 | //if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php |
||
35 | //if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); |
||
36 | //if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) |
||
37 | |||
38 | // Change this following line to use the correct relative path (../, ../../, etc) |
||
39 | $res = 0; |
||
40 | if (!$res && file_exists("../main.inc.php")) { |
||
41 | $res = @include '../main.inc.php'; |
||
42 | } // to work if your module directory is into dolibarr root htdocs directory |
||
43 | if (!$res && file_exists("../../main.inc.php")) { |
||
44 | $res = @include '../../main.inc.php'; |
||
45 | } // to work if your module directory is into a subdir of root htdocs directory |
||
46 | if (!$res && file_exists("../../../dolibarr/htdocs/main.inc.php")) { |
||
47 | $res = @include '../../../dolibarr/htdocs/main.inc.php'; |
||
48 | } // Used on dev env only |
||
49 | if (!$res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) { |
||
50 | $res = @include '../../../../dolibarr/htdocs/main.inc.php'; |
||
51 | } // Used on dev env only |
||
52 | if (!$res) { |
||
53 | die("Include of main fails"); |
||
54 | } |
||
55 | // Change this following line to use the correct relative path from htdocs |
||
56 | include_once(DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'); |
||
57 | dol_include_once('/flightLog/class/bbcvols.class.php'); |
||
58 | dol_include_once('/flightLog/class/bbctypes.class.php'); |
||
59 | dol_include_once('/flightLog/lib/flightLog.lib.php'); |
||
60 | dol_include_once('/flightLog/lib/PilotService.php'); |
||
61 | dol_include_once('/flightBalloon/bbc_ballons.class.php'); |
||
62 | dol_include_once('/user/class/usergroup.class.php'); |
||
63 | |||
64 | use PilotService; |
||
65 | |||
66 | // Load traductions files requiredby by page |
||
67 | $langs->load("mymodule@flightLog"); |
||
68 | $langs->load("other"); |
||
69 | |||
70 | // Get parameters |
||
71 | $id = GETPOST('id', 'int')?: GETPOST('idBBC_vols', 'int'); |
||
72 | $action = GETPOST('action', 'alpha'); |
||
73 | $cancel = GETPOST('cancel'); |
||
74 | $backtopage = GETPOST('backtopage'); |
||
75 | $myparam = GETPOST('myparam', 'alpha'); |
||
76 | |||
77 | |||
78 | $search_idBBC_vols = GETPOST('search_idBBC_vols', 'int'); |
||
79 | $search_lieuD = GETPOST('search_lieuD', 'alpha'); |
||
80 | $search_lieuA = GETPOST('search_lieuA', 'alpha'); |
||
81 | $search_heureD = GETPOST('search_heureD', 'alpha'); |
||
82 | $search_heureA = GETPOST('search_heureA', 'alpha'); |
||
83 | $search_BBC_ballons_idBBC_ballons = GETPOST('search_BBC_ballons_idBBC_ballons', 'int'); |
||
84 | $search_nbrPax = GETPOST('search_nbrPax', 'int'); |
||
85 | $search_remarque = GETPOST('search_remarque', 'alpha'); |
||
86 | $search_incidents = GETPOST('search_incidents', 'alpha'); |
||
87 | $search_fk_type = GETPOST('search_fk_type', 'int'); |
||
88 | $search_fk_pilot = GETPOST('search_fk_pilot', 'int'); |
||
89 | $search_fk_organisateur = GETPOST('search_fk_organisateur', 'int'); |
||
90 | $search_is_facture = GETPOST('search_is_facture', 'int'); |
||
91 | $search_kilometers = GETPOST('search_kilometers', 'int'); |
||
92 | $search_cost = GETPOST('search_cost', 'alpha'); |
||
93 | $search_fk_receiver = GETPOST('search_fk_receiver', 'int'); |
||
94 | $search_justif_kilometers = GETPOST('search_justif_kilometers', 'alpha'); |
||
95 | |||
96 | $pageTitle = "Fiche vol " . $id; |
||
97 | |||
98 | if (empty($action) && empty($id) && empty($ref)) { |
||
99 | $action = 'view'; |
||
100 | } |
||
101 | |||
102 | // Protection if external user |
||
103 | if ($user->societe_id > 0) { |
||
0 ignored issues
–
show
This
if statement is empty and can be removed.
This check looks for the bodies of These if (rand(1, 6) > 3) {
//print "Check failed";
} else {
print "Check succeeded";
}
could be turned into if (rand(1, 6) <= 3) {
print "Check succeeded";
}
This is much more concise to read. ![]() |
|||
104 | //accessforbidden(); |
||
105 | } |
||
106 | //$result = restrictedArea($user, 'flightLog', $id); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
60% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
107 | |||
108 | |||
109 | $object = new Bbcvols($db); |
||
110 | $extrafields = new ExtraFields($db); |
||
111 | |||
112 | $receiver = new User($db); |
||
113 | |||
114 | $pilotService = new PilotService($db); |
||
115 | $pilot = new User($db); |
||
116 | |||
117 | $organisator = new User($db); |
||
118 | |||
119 | $flightType = new Bbctypes($db); |
||
120 | $balloon = new Bbc_ballons($db); |
||
121 | |||
122 | // fetch optionals attributes and labels |
||
123 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
||
124 | |||
125 | // Load object |
||
126 | include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
||
127 | |||
128 | // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array |
||
129 | $hookmanager->initHooks(array('bbcvols')); |
||
130 | $object->ref = $object->idBBC_vols; |
||
131 | $receiver->fetch($object->fk_receiver); |
||
132 | $pilot->fetch($object->fk_pilot); |
||
133 | $organisator->fetch($object->fk_organisateur); |
||
134 | $flightType->fetch($object->fk_type); |
||
135 | $balloon->fetch($object->BBC_ballons_idBBC_ballons); |
||
136 | |||
137 | /******************************************************************* |
||
138 | * ACTIONS |
||
139 | * |
||
140 | * Put here all code to do according to value of "action" parameter |
||
141 | ********************************************************************/ |
||
142 | |||
143 | $parameters = array(); |
||
144 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, |
||
145 | $action); // Note that $action and $object may have been modified by some hooks |
||
146 | if ($reshook < 0) { |
||
147 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
||
148 | } |
||
149 | |||
150 | if (empty($reshook)) { |
||
151 | $isAllowedEdit = ($user->rights->flightLog->vol->edit || ($user->rights->flightLog->vol->add && $object->fk_pilot == $user->id)); |
||
152 | $isAllowedDelete = ($user->rights->flightLog->vol->delete || ($user->rights->flightLog->vol->add && $object->fk_pilot == $user->id && !$object->is_facture)); |
||
153 | if ($cancel || (!$isAllowedDelete && $action == 'update') || (!$isAllowedDelete && $action == "confirm_delete")) { |
||
154 | if ($id > 0 || !empty($ref)) { |
||
155 | $object->fetch($id); |
||
156 | |||
157 | $receiver->fetch($object->fk_receiver); |
||
158 | $pilot->fetch($object->fk_pilot); |
||
159 | $organisator->fetch($object->fk_organisateur); |
||
160 | $flightType->fetch($object->fk_type); |
||
161 | $balloon->fetch($object->BBC_ballons_idBBC_ballons); |
||
162 | } |
||
163 | $action = ''; |
||
164 | } |
||
165 | |||
166 | // Action to add record |
||
167 | if ($action == 'add') { |
||
168 | |||
169 | if (GETPOST('cancel')) { |
||
170 | $urltogo = $backtopage ? $backtopage : dol_buildpath('/flightLog/list.php', 1); |
||
171 | header("Location: " . $urltogo); |
||
172 | exit; |
||
173 | } |
||
174 | |||
175 | $error = 0; |
||
176 | |||
177 | /* object_prop_getpost_prop */ |
||
178 | |||
179 | $object->idBBC_vols = GETPOST('idBBC_vols', 'int'); |
||
180 | $object->lieuD = GETPOST('lieuD', 'alpha'); |
||
181 | $object->lieuA = GETPOST('lieuA', 'alpha'); |
||
182 | $object->heureD = GETPOST('heureD', 'alpha'); |
||
183 | $object->heureA = GETPOST('heureA', 'alpha'); |
||
184 | $object->BBC_ballons_idBBC_ballons = GETPOST('BBC_ballons_idBBC_ballons', 'int'); |
||
185 | $object->nbrPax = GETPOST('nbrPax', 'alpha'); |
||
186 | $object->remarque = GETPOST('remarque', 'alpha'); |
||
187 | $object->incidents = GETPOST('incidents', 'alpha'); |
||
188 | $object->fk_type = GETPOST('fk_type', 'int'); |
||
189 | $object->fk_pilot = GETPOST('fk_pilot', 'int'); |
||
190 | $object->fk_organisateur = GETPOST('fk_organisateur', 'int'); |
||
191 | $object->is_facture = GETPOST('is_facture', 'int'); |
||
192 | $object->kilometers = GETPOST('kilometers', 'int'); |
||
193 | $object->cost = GETPOST('cost', 'alpha'); |
||
194 | $object->fk_receiver = GETPOST('fk_receiver', 'int'); |
||
195 | $object->justif_kilometers = GETPOST('justif_kilometers', 'alpha'); |
||
196 | |||
197 | |||
198 | View Code Duplication | if (empty($object->idBBC_vols)) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
199 | $error++; |
||
200 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("idBBC_vols")), null, 'errors'); |
||
201 | } |
||
202 | |||
203 | if (!$error) { |
||
204 | $result = $object->create($user); |
||
205 | if ($result > 0) { |
||
206 | // Creation OK |
||
207 | $urltogo = $backtopage ? $backtopage : dol_buildpath('/flightLog/list.php', 1); |
||
208 | header("Location: " . $urltogo); |
||
209 | exit; |
||
210 | } |
||
211 | { |
||
212 | // Creation KO |
||
213 | View Code Duplication | if (!empty($object->errors)) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
214 | setEventMessages(null, $object->errors, 'errors'); |
||
215 | } else { |
||
216 | setEventMessages($object->error, null, 'errors'); |
||
217 | } |
||
218 | $action = 'create'; |
||
219 | } |
||
220 | } else { |
||
221 | $action = 'create'; |
||
222 | } |
||
223 | } |
||
224 | |||
225 | // Action to update record |
||
226 | if ($action == 'update') { |
||
227 | $error = 0; |
||
228 | |||
229 | $object->date = dol_mktime(12, 0, 0, GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); |
||
230 | $object->idBBC_vols = GETPOST('idBBC_vols', 'int'); |
||
231 | $object->id = $object->idBBC_vols; |
||
232 | $object->lieuD = GETPOST('lieuD', 'alpha'); |
||
233 | $object->lieuA = GETPOST('lieuA', 'alpha'); |
||
234 | $object->heureD = GETPOST('heureD_h', 'int').":".GETPOST('heureD_m', 'int').":00"; |
||
235 | $object->heureA = GETPOST('heureA_h', 'int').":".GETPOST('heureA_m', 'int').":00"; |
||
236 | $object->BBC_ballons_idBBC_ballons = GETPOST('BBC_ballons_idBBC_ballons', 'int'); |
||
237 | $object->nbrPax = GETPOST('nbrPax', 'alpha'); |
||
238 | $object->remarque = GETPOST('remarque', 'alpha'); |
||
239 | $object->incidents = GETPOST('incidents', 'alpha'); |
||
240 | $object->fk_type = GETPOST('fk_type', 'int'); |
||
241 | $object->fk_pilot = GETPOST('fk_pilot', 'int'); |
||
242 | $object->fk_organisateur = GETPOST('fk_organisateur', 'int'); |
||
243 | //$object->is_facture = GETPOST('is_facture', 'int'); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
244 | $object->kilometers = GETPOST('kilometers', 'int'); |
||
245 | $object->cost = GETPOST('cost', 'alpha'); |
||
246 | $object->fk_receiver = GETPOST('fk_receiver', 'int'); |
||
247 | $object->justif_kilometers = GETPOST('justif_kilometers', 'alpha'); |
||
248 | |||
249 | |||
250 | //validation |
||
251 | View Code Duplication | if (empty($object->idBBC_vols)) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
252 | $error++; |
||
253 | setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("idBBC_vols")), |
||
254 | null, 'errors'); |
||
255 | } |
||
256 | |||
257 | if(!dol_validElement($object->lieuD)){ |
||
258 | $error++; |
||
259 | setEventMessage("Erreur le champ : lieu de décollage", 'errors'); |
||
260 | } |
||
261 | |||
262 | if(!dol_validElement($object->lieuA)){ |
||
263 | $error++; |
||
264 | setEventMessage("Erreur le champ : lieu d'atterissage", 'errors'); |
||
265 | } |
||
266 | |||
267 | $dateD = date_create_from_format("H:i:s", $object->heureD); |
||
268 | $dateA = date_create_from_format("H:i:s", $object->heureA); |
||
269 | if ($dateA <= $dateD) { |
||
270 | $error++; |
||
271 | setEventMessage("Erreur avec les heures de vol", 'errors'); |
||
272 | } |
||
273 | |||
274 | if(!is_numeric($object->nbrPax) || $object->nbrPax < 0 ){ |
||
275 | $error++; |
||
276 | setEventMessage("Erreur le champ : nombre de passagers", 'errors'); |
||
277 | } |
||
278 | |||
279 | if(!$pilotService->isPilot($object->fk_pilot)){ |
||
280 | $error++; |
||
281 | setEventMessage("Le pilote selectionne n'est pas pilote", 'errors'); |
||
282 | } |
||
283 | |||
284 | // action : edit |
||
285 | if (!$error) { |
||
286 | $result = $object->update($user); |
||
287 | if ($result > 0) { |
||
288 | $action = 'view'; |
||
289 | |||
290 | $receiver->fetch($object->fk_receiver); |
||
291 | $pilot->fetch($object->fk_pilot); |
||
292 | $organisator->fetch($object->fk_organisateur); |
||
293 | $flightType ->fetch($object->fk_type); |
||
294 | $balloon->fetch($object->BBC_ballons_idBBC_ballons); |
||
295 | |||
296 | View Code Duplication | } else { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
297 | // Creation KO |
||
298 | if (!empty($object->errors)) { |
||
299 | setEventMessages(null, $object->errors, 'errors'); |
||
300 | } else { |
||
301 | setEventMessages($object->error, null, 'errors'); |
||
302 | } |
||
303 | $action = 'edit'; |
||
304 | } |
||
305 | } else { |
||
306 | $action = 'edit'; |
||
307 | } |
||
308 | } |
||
309 | |||
310 | // Action to delete |
||
311 | if ($action == 'confirm_delete') { |
||
312 | $result = $object->delete($user); |
||
313 | if ($result > 0) { |
||
314 | // Delete OK |
||
315 | setEventMessages("RecordDeleted", null, 'mesgs'); |
||
316 | header("Location: " . dol_buildpath('/flightLog/list.php', 1)); |
||
317 | exit; |
||
318 | View Code Duplication | } else { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
319 | if (!empty($object->errors)) { |
||
320 | setEventMessages(null, $object->errors, 'errors'); |
||
321 | } else { |
||
322 | setEventMessages($object->error, null, 'errors'); |
||
323 | } |
||
324 | } |
||
325 | } |
||
326 | } |
||
327 | |||
328 | |||
329 | /*************************************************** |
||
330 | * VIEW |
||
331 | * |
||
332 | * Put here all code to build page |
||
333 | ****************************************************/ |
||
334 | |||
335 | llxHeader('', $pageTitle, ''); |
||
336 | |||
337 | $form = new Form($db); |
||
338 | |||
339 | |||
340 | // Put here content of your page |
||
341 | |||
342 | // Example : Adding jquery code |
||
343 | print '<script type="text/javascript" language="javascript"> |
||
344 | jQuery(document).ready(function() { |
||
345 | function init_myfunc() |
||
346 | { |
||
347 | jQuery("#myid").removeAttr(\'disabled\'); |
||
348 | jQuery("#myid").attr(\'disabled\',\'disabled\'); |
||
349 | } |
||
350 | init_myfunc(); |
||
351 | jQuery("#mybutton").click(function() { |
||
352 | init_myfunc(); |
||
353 | }); |
||
354 | }); |
||
355 | </script>'; |
||
356 | |||
357 | |||
358 | // Part to create |
||
359 | if ($action == 'create') { |
||
360 | print load_fiche_titre($langs->trans("NewMyModule")); |
||
361 | |||
362 | print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
||
363 | print '<input type="hidden" name="action" value="add">'; |
||
364 | print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
||
365 | |||
366 | dol_fiche_head(); |
||
367 | |||
368 | print '<table class="border centpercent">' . "\n"; |
||
369 | // print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input class="flat" type="text" size="36" name="label" value="'.$label.'"></td></tr>'; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
62% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
370 | // |
||
371 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldidBBC_vols") . '</td><td><input class="flat" type="text" name="idBBC_vols" value="' . GETPOST('idBBC_vols') . '"></td></tr>'; |
||
372 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldlieuD") . '</td><td><input class="flat" type="text" name="lieuD" value="' . GETPOST('lieuD') . '"></td></tr>'; |
||
373 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldlieuA") . '</td><td><input class="flat" type="text" name="lieuA" value="' . GETPOST('lieuA') . '"></td></tr>'; |
||
374 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldheureD") . '</td><td><input class="flat" type="text" name="heureD" value="' . GETPOST('heureD') . '"></td></tr>'; |
||
375 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldheureA") . '</td><td><input class="flat" type="text" name="heureA" value="' . GETPOST('heureA') . '"></td></tr>'; |
||
376 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldBBC_ballons_idBBC_ballons") . '</td><td><input class="flat" type="text" name="BBC_ballons_idBBC_ballons" value="' . GETPOST('BBC_ballons_idBBC_ballons') . '"></td></tr>'; |
||
377 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldnbrPax") . '</td><td><input class="flat" type="text" name="nbrPax" value="' . GETPOST('nbrPax') . '"></td></tr>'; |
||
378 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldremarque") . '</td><td><input class="flat" type="text" name="remarque" value="' . GETPOST('remarque') . '"></td></tr>'; |
||
379 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldincidents") . '</td><td><input class="flat" type="text" name="incidents" value="' . GETPOST('incidents') . '"></td></tr>'; |
||
380 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_type") . '</td><td><input class="flat" type="text" name="fk_type" value="' . GETPOST('fk_type') . '"></td></tr>'; |
||
381 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_pilot") . '</td><td><input class="flat" type="text" name="fk_pilot" value="' . GETPOST('fk_pilot') . '"></td></tr>'; |
||
382 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_organisateur") . '</td><td><input class="flat" type="text" name="fk_organisateur" value="' . GETPOST('fk_organisateur') . '"></td></tr>'; |
||
383 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldis_facture") . '</td><td><input class="flat" type="text" name="is_facture" value="' . GETPOST('is_facture') . '"></td></tr>'; |
||
384 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldkilometers") . '</td><td><input class="flat" type="text" name="kilometers" value="' . GETPOST('kilometers') . '"></td></tr>'; |
||
385 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldcost") . '</td><td><input class="flat" type="text" name="cost" value="' . GETPOST('cost') . '"></td></tr>'; |
||
386 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_receiver") . '</td><td><input class="flat" type="text" name="fk_receiver" value="' . GETPOST('fk_receiver') . '"></td></tr>'; |
||
387 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldjustif_kilometers") . '</td><td><input class="flat" type="text" name="justif_kilometers" value="' . GETPOST('justif_kilometers') . '"></td></tr>'; |
||
388 | |||
389 | print '</table>' . "\n"; |
||
390 | |||
391 | dol_fiche_end(); |
||
392 | |||
393 | print '<div class="center"><input type="submit" class="button" name="add" value="' . $langs->trans("Create") . '"> <input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '"></div>'; |
||
394 | |||
395 | print '</form>'; |
||
396 | } |
||
397 | |||
398 | |||
399 | // Part to edit record |
||
400 | if (($id || $ref) && $action == 'edit') { |
||
401 | print load_fiche_titre($langs->trans("MyModule")); |
||
402 | |||
403 | print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
||
404 | print '<input type="hidden" name="action" value="update">'; |
||
405 | print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
||
406 | print '<input type="hidden" name="idBBC_vols" value="' . $object->id . '">'; |
||
407 | |||
408 | dol_fiche_head(); |
||
409 | |||
410 | print '<table class="border centpercent">' . "\n"; |
||
411 | |||
412 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldDate") . "</td><td>"; |
||
413 | print $form->select_date($object->date, '', '', '', '', 'add', 1, 1); |
||
414 | print "</td></tr>"; |
||
415 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldlieuD") . "</td><td><input class=\"flat\" type=\"text\" name=\"lieuD\" value=\"" . $object->lieuD . "\"></td></tr>"; |
||
416 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldlieuA") . "</td><td><input class=\"flat\" type=\"text\" name=\"lieuA\" value=\"" . $object->lieuA . "\"></td></tr>"; |
||
417 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldheureD") . "</td><td><input class=\"flat\" min=\"0\" max=\"23\" type=\"number\" name=\"heureD_h\" value=\"" . explode(":", $object->heureD)[0] . "\">h<input class=\"flat\" type=\"number\" min=\"0\" max=\"59\" name=\"heureD_m\" value=\"" . explode(":", $object->heureD)[1] . "\"></td></tr>"; |
||
418 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldheureA") . "</td><td><input class=\"flat\" type=\"number\" min=\"0\" max=\"23\" name=\"heureA_h\" value=\"" . explode(":", $object->heureA)[0] . "\">h<input class=\"flat\" type=\"number\" min=\"0\" max=\"59\" name=\"heureA_m\" value=\"" . explode(":", $object->heureA)[1] . "\"></td></tr>"; |
||
419 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldBBC_ballons_idBBC_ballons") . "</td><td>"; |
||
420 | select_balloons($object->BBC_ballons_idBBC_ballons, "BBC_ballons_idBBC_ballons"); |
||
421 | print "</td></tr>"; |
||
422 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldnbrPax") . "</td><td><input class=\"flat\" type=\"number\" name=\"nbrPax\" value=\"" . $object->nbrPax . "\"></td></tr>"; |
||
423 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldremarque") . "</td><td><textarea class=\"flat\" name=\"remarque\">".$object->remarque."</textarea></td></tr>"; |
||
424 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldincidents") . "</td><td><textarea class=\"flat\" name=\"incidents\">".$object->incidents."</textarea></td></tr>"; |
||
425 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldfk_type") . "</td><td>"; |
||
426 | select_flight_type($object->fk_type, "fk_type"); |
||
427 | print "</td></tr>"; |
||
428 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldfk_pilot") . "</td><td>".$form->select_dolusers($object->fk_pilot, "fk_pilot", 0, '', 0, '', '', 0, 0, 0, '', 0, '', '', 1)."</td></tr>"; |
||
429 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldfk_organisateur") . "</td><td>".$form->select_dolusers($object->fk_organisateur, "fk_organisateur")."</td></tr>"; |
||
430 | |||
431 | View Code Duplication | if($user->rights->flightLog->vol->financial || $user->id == $object->fk_pilot) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
432 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldkilometers") . "</td><td><input class=\"flat\" type=\"number\" name=\"kilometers\" value=\"" . $object->kilometers . "\"></td></tr>"; |
||
433 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldcost") . "</td><td><input class=\"flat\" type=\"number\" name=\"cost\" value=\"" . $object->cost . "\"></td></tr>"; |
||
434 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldfk_receiver") . "</td><td>" . $form->select_dolusers($object->fk_receiver,"fk_receiver", true ) . "</td></tr>"; |
||
435 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldjustif_kilometers") . "</td><td><textarea class=\"flat\" name=\"justif_kilometers\">" . $object->justif_kilometers . "</textarea></td></tr>"; |
||
436 | } |
||
437 | print '</table>'; |
||
438 | |||
439 | dol_fiche_end(); |
||
440 | |||
441 | print '<div class="center"><input type="submit" class="button" name="save" value="' . $langs->trans("Save") . '">'; |
||
442 | print ' <input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
||
443 | print '</div>'; |
||
444 | |||
445 | print '</form>'; |
||
446 | } |
||
447 | |||
448 | |||
449 | // Part to show record |
||
450 | if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { |
||
451 | $res = $object->fetch_optionals($object->id, $extralabels); |
||
452 | |||
453 | |||
454 | print load_fiche_titre($langs->trans($pageTitle)); |
||
455 | |||
456 | $linkback = '<a href="'.DOL_URL_ROOT.'/flightLog/list.php">'.$langs->trans("BackToList").'</a>'; |
||
457 | //dol_banner_tab($object, 'idBBC_vols', $linkback); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
73% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
458 | print $form->showrefnav($object, "idBBC_vols", $linkback, true, "idBBC_vols"); |
||
459 | dol_fiche_head(); |
||
460 | |||
461 | if ($action == 'delete') { |
||
462 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'), |
||
463 | $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1); |
||
464 | print $formconfirm; |
||
465 | } |
||
466 | |||
467 | print '<table class="border centpercent">' . "\n"; |
||
468 | |||
469 | |||
470 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldidBBC_vols") . '</td><td>' . $object->idBBC_vols . '</td></tr>'; |
||
471 | print '<tr><td class="fieldrequired">' . $langs->trans("Fielddate") . '</td><td>' . dol_print_date($object->date) . '</td></tr>'; |
||
472 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldlieuD") . '</td><td>' . $object->lieuD . '</td></tr>'; |
||
473 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldlieuA") . '</td><td>' . $object->lieuA . '</td></tr>'; |
||
474 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldheureD") . '</td><td>' . $object->heureD . '</td></tr>'; |
||
475 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldheureA") . '</td><td>' . $object->heureA . '</td></tr>'; |
||
476 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldBBC_ballons_idBBC_ballons") . '</td><td>' . $balloon->immat . '</td></tr>'; |
||
477 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldnbrPax") . '</td><td>' . $object->nbrPax . '</td></tr>'; |
||
478 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldremarque") . '</td><td>' . $object->remarque . '</td></tr>'; |
||
479 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldincidents") . '</td><td>' . $object->incidents . '</td></tr>'; |
||
480 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_type") . '</td><td>' . $object->fk_type . '</td></tr>'; |
||
481 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_pilot") . '</td><td>' . $pilot->getNomUrl(1) . '</td></tr>'; |
||
482 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_organisateur") . '</td><td>' . $organisator->getNomUrl(1) . '</td></tr>'; |
||
483 | |||
484 | if($user->rights->flightLog->vol->financial){ |
||
485 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldis_facture") . '</td><td>' . $object->is_facture . '</td></tr>'; |
||
486 | } |
||
487 | |||
488 | View Code Duplication | if($user->rights->flightLog->vol->financial || $user->id == $object->fk_pilot) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
489 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldkilometers") . '</td><td>' . $object->kilometers . ' KM</td></tr>'; |
||
490 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldcost") . '</td><td>' . $object->cost ." ". $langs->getCurrencySymbol($conf->currency).'</td></tr>'; |
||
491 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_receiver") . '</td><td>' . $receiver->getNomUrl(1) . '</td></tr>'; |
||
492 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldjustif_kilometers") . '</td><td>' . $object->justif_kilometers . '</td></tr>'; |
||
493 | } |
||
494 | |||
495 | print '</table>'; |
||
496 | |||
497 | dol_fiche_end(); |
||
498 | |||
499 | // Buttons |
||
500 | print '<div class="tabsAction">' . "\n"; |
||
501 | $parameters = array(); |
||
502 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, |
||
503 | $action); // Note that $action and $object may have been modified by hook |
||
504 | if ($reshook < 0) { |
||
505 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
||
506 | } |
||
507 | |||
508 | View Code Duplication | if ($user->rights->flightLog->vol->edit || ($user->rights->flightLog->vol->add && $object->fk_pilot == $user->id)) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
509 | print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit">' . $langs->trans("Modify") . '</a></div>' . "\n"; |
||
510 | } |
||
511 | |||
512 | View Code Duplication | if ($user->rights->flightLog->vol->delete || ($user->rights->flightLog->vol->add && $object->fk_pilot == $user->id && !$object->is_facture)) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
513 | print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>' . "\n"; |
||
514 | } |
||
515 | print '</div>' . "\n"; |
||
516 | |||
517 | |||
518 | // Example 2 : Adding links to objects |
||
519 | // Show links to link elements |
||
520 | //$linktoelem = $form->showLinkToObjectBlock($object, null, array('bbcvols')); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
70% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
521 | //$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
65% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
522 | |||
523 | } |
||
524 | |||
525 | |||
526 | // End of page |
||
527 | llxFooter(); |
||
528 | $db->close(); |
||
529 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.