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 | // Change this following line to use the correct relative path (../, ../../, etc) |
||
27 | $res = 0; |
||
28 | if (!$res && file_exists("../main.inc.php")) { |
||
29 | $res = @include '../main.inc.php'; |
||
30 | } // to work if your module directory is into dolibarr root htdocs directory |
||
31 | if (!$res && file_exists("../../main.inc.php")) { |
||
32 | $res = @include '../../main.inc.php'; |
||
33 | } // to work if your module directory is into a subdir of root htdocs directory |
||
34 | if (!$res && file_exists("../../../dolibarr/htdocs/main.inc.php")) { |
||
35 | $res = @include '../../../dolibarr/htdocs/main.inc.php'; |
||
36 | } // Used on dev env only |
||
37 | if (!$res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) { |
||
38 | $res = @include '../../../../dolibarr/htdocs/main.inc.php'; |
||
39 | } // Used on dev env only |
||
40 | if (!$res) { |
||
41 | die("Include of main fails"); |
||
42 | } |
||
43 | // Change this following line to use the correct relative path from htdocs |
||
44 | include_once(DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'); |
||
45 | |||
46 | dol_include_once('/flightlog/class/bbcvols.class.php'); |
||
47 | dol_include_once('/flightlog/class/bbctypes.class.php'); |
||
48 | dol_include_once('/flightlog/lib/flightLog.lib.php'); |
||
49 | dol_include_once('/flightlog/lib/card.lib.php'); |
||
50 | dol_include_once('/flightlog/lib/PilotService.php'); |
||
51 | dol_include_once('/flightballoon/class/bbc_ballons.class.php'); |
||
52 | dol_include_once('/user/class/usergroup.class.php'); |
||
53 | |||
54 | global $langs, $user, $conf; |
||
55 | |||
56 | const ACTION_FLAG_BILLED = 'action_flag_bill'; |
||
57 | const ACTION_CONFIRM_FLAG_BILLED = 'confirm_flag_bill'; |
||
58 | |||
59 | // Load traductions files requiredby by page |
||
60 | $langs->load("mymodule@flightlog"); |
||
61 | $langs->load("other"); |
||
62 | |||
63 | // Get parameters |
||
64 | $id = GETPOST('id', 'int') ?: GETPOST('idBBC_vols', 'int'); |
||
65 | $action = GETPOST('action', 'alpha'); |
||
66 | $cancel = GETPOST('cancel'); |
||
67 | $backtopage = GETPOST('backtopage'); |
||
68 | $myparam = GETPOST('myparam', 'alpha'); |
||
69 | |||
70 | $isAllowedEdit = ($user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)); |
||
71 | $isAllowedDelete = ($user->rights->flightlog->vol->delete || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id && !$object->is_facture)); |
||
72 | $permissiondellink=$user->rights->flightlog->vol->financial; |
||
73 | |||
74 | $search_idBBC_vols = GETPOST('search_idBBC_vols', 'int'); |
||
75 | $search_lieuD = GETPOST('search_lieuD', 'alpha'); |
||
76 | $search_lieuA = GETPOST('search_lieuA', 'alpha'); |
||
77 | $search_heureD = GETPOST('search_heureD', 'alpha'); |
||
78 | $search_heureA = GETPOST('search_heureA', 'alpha'); |
||
79 | $search_BBC_ballons_idBBC_ballons = GETPOST('search_BBC_ballons_idBBC_ballons', 'int'); |
||
80 | $search_nbrPax = GETPOST('search_nbrPax', 'int'); |
||
81 | $search_remarque = GETPOST('search_remarque', 'alpha'); |
||
82 | $search_incidents = GETPOST('search_incidents', 'alpha'); |
||
83 | $search_fk_type = GETPOST('search_fk_type', 'int'); |
||
84 | $search_fk_pilot = GETPOST('search_fk_pilot', 'int'); |
||
85 | $search_fk_organisateur = GETPOST('search_fk_organisateur', 'int'); |
||
86 | $search_is_facture = GETPOST('search_is_facture', 'int'); |
||
87 | $search_kilometers = GETPOST('search_kilometers', 'int'); |
||
88 | $search_cost = GETPOST('search_cost', 'alpha'); |
||
89 | $search_fk_receiver = GETPOST('search_fk_receiver', 'int'); |
||
90 | $search_justif_kilometers = GETPOST('search_justif_kilometers', 'alpha'); |
||
91 | |||
92 | $pageTitle = "Fiche vol " . $id; |
||
93 | |||
94 | if (!$user->rights->flightlog->vol->access) { |
||
95 | accessforbidden($langs->trans("Tu n'as pas accès au vol")); |
||
96 | } |
||
97 | |||
98 | if (empty($action) && empty($id) && empty($ref)) { |
||
99 | $action = 'view'; |
||
100 | } |
||
101 | |||
102 | $object = new Bbcvols($db); |
||
103 | $extrafields = new ExtraFields($db); |
||
104 | |||
105 | $receiver = new User($db); |
||
106 | |||
107 | $pilotService = new PilotService($db); |
||
108 | $pilot = new User($db); |
||
109 | |||
110 | $organisator = new User($db); |
||
111 | |||
112 | $flightType = new Bbctypes($db); |
||
113 | $balloon = new Bbc_ballons($db); |
||
114 | |||
115 | // fetch optionals attributes and labels |
||
116 | $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); |
||
117 | |||
118 | // Load object |
||
119 | include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals |
||
120 | include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
||
121 | |||
122 | // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array |
||
123 | $hookmanager->initHooks(array('bbcvols')); |
||
124 | $object->ref = $object->idBBC_vols; |
||
125 | $receiver->fetch($object->fk_receiver); |
||
126 | $pilot->fetch($object->fk_pilot); |
||
127 | $organisator->fetch($object->fk_organisateur); |
||
128 | $flightType->fetch($object->fk_type); |
||
129 | $balloon->fetch($object->BBC_ballons_idBBC_ballons); |
||
130 | |||
131 | |||
132 | if (($action == "update" || $action == "edit") && !($user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id))) { |
||
133 | setEventMessage("Ceci n'est pas un de tes vols tu ne peux l'editer ! ", 'errors'); |
||
134 | $action = 'view'; |
||
135 | } |
||
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 | |||
152 | // Action to update record |
||
153 | if ($action == 'update') { |
||
154 | $error = 0; |
||
155 | |||
156 | $object->idBBC_vols = GETPOST('idBBC_vols', 'int'); |
||
157 | $object->id = $object->idBBC_vols; |
||
158 | |||
159 | $object->lieuD = GETPOST('lieuD', 'alpha'); |
||
160 | $object->lieuA = GETPOST('lieuA', 'alpha'); |
||
161 | $object->heureD = GETPOST('heureD_h', 'int') . ":" . GETPOST('heureD_m', 'int') . ":00"; |
||
162 | $object->heureA = GETPOST('heureA_h', 'int') . ":" . GETPOST('heureA_m', 'int') . ":00"; |
||
163 | $object->BBC_ballons_idBBC_ballons = GETPOST('BBC_ballons_idBBC_ballons', 'int'); |
||
164 | |||
165 | $object->remarque = GETPOST('remarque', 'alpha'); |
||
166 | $object->incidents = GETPOST('incidents', 'alpha'); |
||
167 | $object->kilometers = GETPOST('kilometers', 'int') ?: $object->kilometers; |
||
168 | $object->justif_kilometers = GETPOST('justif_kilometers', 'alpha') ?: $object->justif_kilometers; |
||
169 | |||
170 | |||
171 | //validation |
||
172 | if (empty($object->idBBC_vols)) { |
||
173 | $error++; |
||
174 | setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", |
||
175 | $langs->transnoentitiesnoconv("idBBC_vols")), |
||
176 | null, 'errors'); |
||
177 | } |
||
178 | |||
179 | if (!dol_validElement($object->lieuD)) { |
||
180 | $error++; |
||
181 | setEventMessage("Erreur le champ : lieu de décollage", 'errors'); |
||
182 | } |
||
183 | |||
184 | if (!dol_validElement($object->lieuA)) { |
||
185 | $error++; |
||
186 | setEventMessage("Erreur le champ : lieu d'atterissage", 'errors'); |
||
187 | } |
||
188 | |||
189 | $dateD = date_create_from_format("H:i:s", $object->heureD); |
||
190 | $dateA = date_create_from_format("H:i:s", $object->heureA); |
||
191 | if ($dateA <= $dateD) { |
||
192 | $error++; |
||
193 | setEventMessage("Erreur avec les heures de vol", 'errors'); |
||
194 | } |
||
195 | |||
196 | if (!is_numeric($object->nbrPax) || $object->nbrPax < 0) { |
||
197 | $error++; |
||
198 | setEventMessage("Erreur le champ : nombre de passagers", 'errors'); |
||
199 | } |
||
200 | |||
201 | // action : edit |
||
202 | if (!$error) { |
||
203 | $result = $object->update($user); |
||
204 | if ($result > 0) { |
||
205 | $action = 'view'; |
||
206 | |||
207 | $object->id = $object->idBBC_vols; |
||
208 | $receiver->fetch($object->fk_receiver); |
||
209 | $pilot->fetch($object->fk_pilot); |
||
210 | $organisator->fetch($object->fk_organisateur); |
||
211 | $flightType->fetch($object->fk_type); |
||
212 | $balloon->fetch($object->BBC_ballons_idBBC_ballons); |
||
213 | |||
214 | View Code Duplication | } else { |
|
215 | // Creation KO |
||
216 | if (!empty($object->errors)) { |
||
217 | setEventMessages(null, $object->errors, 'errors'); |
||
218 | } else { |
||
219 | setEventMessages($object->error, null, 'errors'); |
||
220 | } |
||
221 | $action = 'edit'; |
||
222 | } |
||
223 | } else { |
||
224 | $action = 'edit'; |
||
225 | } |
||
226 | } |
||
227 | |||
228 | // Action to delete |
||
229 | if ($action == 'confirm_delete') { |
||
230 | $result = $object->delete($user); |
||
231 | if ($result > 0) { |
||
232 | // Delete OK |
||
233 | setEventMessages("RecordDeleted", null, 'mesgs'); |
||
234 | header("Location: " . dol_buildpath('/flightlog/list.php', 1)); |
||
235 | exit; |
||
236 | View Code Duplication | } else { |
|
237 | if (!empty($object->errors)) { |
||
238 | setEventMessages(null, $object->errors, 'errors'); |
||
239 | } else { |
||
240 | setEventMessages($object->error, null, 'errors'); |
||
241 | } |
||
242 | } |
||
243 | } |
||
244 | |||
245 | // Action to delete |
||
246 | if ($user->rights->flightlog->vol->financial && !$object->isBilled() && $action === ACTION_CONFIRM_FLAG_BILLED) { |
||
247 | $result = $object |
||
248 | ->bill() |
||
249 | ->update($user); |
||
250 | |||
251 | if ($result > 0) { |
||
252 | setEventMessages("Facturé", null, 'mesgs'); |
||
253 | $action = 'show'; |
||
254 | View Code Duplication | } else { |
|
255 | if (!empty($object->errors)) { |
||
256 | setEventMessages(null, $object->errors, 'errors'); |
||
257 | } else { |
||
258 | setEventMessages($object->error, null, 'errors'); |
||
259 | } |
||
260 | } |
||
261 | } |
||
262 | } |
||
263 | |||
264 | |||
265 | /*************************************************** |
||
266 | * VIEW |
||
267 | * |
||
268 | * Put here all code to build page |
||
269 | ****************************************************/ |
||
270 | |||
271 | llxHeader('', $pageTitle, ''); |
||
272 | |||
273 | $form = new Form($db); |
||
274 | |||
275 | // Put here content of your page |
||
276 | |||
277 | print '<script type="text/javascript" language="javascript"> |
||
278 | jQuery(document).ready(function() { |
||
279 | function init_myfunc() |
||
280 | { |
||
281 | jQuery("#myid").removeAttr(\'disabled\'); |
||
282 | jQuery("#myid").attr(\'disabled\',\'disabled\'); |
||
283 | } |
||
284 | init_myfunc(); |
||
285 | jQuery("#mybutton").click(function() { |
||
286 | init_myfunc(); |
||
287 | }); |
||
288 | }); |
||
289 | </script>'; |
||
290 | |||
291 | |||
292 | // Part to edit record |
||
293 | if (($id || $ref) && $action == 'edit') { |
||
294 | print load_fiche_titre($langs->trans("MyModule")); |
||
295 | |||
296 | print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
||
297 | print '<input type="hidden" name="action" value="update">'; |
||
298 | print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
||
299 | print '<input type="hidden" name="idBBC_vols" value="' . $object->id . '">'; |
||
300 | |||
301 | dol_fiche_head(); |
||
302 | |||
303 | print '<table class="border centpercent">' . "\n"; |
||
304 | |||
305 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldlieuD") . "</td><td><input class=\"flat\" type=\"text\" name=\"lieuD\" value=\"" . $object->lieuD . "\"></td></tr>"; |
||
306 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldlieuA") . "</td><td><input class=\"flat\" type=\"text\" name=\"lieuA\" value=\"" . $object->lieuA . "\"></td></tr>"; |
||
307 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldheureD") . "</td><td><input class=\"flat\" min=\"0\" max=\"23\" type=\"number\" name=\"heureD_h\" value=\"" . explode(":", |
||
308 | $object->heureD)[0] . "\">h<input class=\"flat\" type=\"number\" min=\"0\" max=\"59\" name=\"heureD_m\" value=\"" . explode(":", |
||
309 | $object->heureD)[1] . "\"></td></tr>"; |
||
310 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldheureA") . "</td><td><input class=\"flat\" type=\"number\" min=\"0\" max=\"23\" name=\"heureA_h\" value=\"" . explode(":", |
||
311 | $object->heureA)[0] . "\">h<input class=\"flat\" type=\"number\" min=\"0\" max=\"59\" name=\"heureA_m\" value=\"" . explode(":", |
||
312 | $object->heureA)[1] . "\"></td></tr>"; |
||
313 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("FieldBBC_ballons_idBBC_ballons") . "</td><td>"; |
||
314 | select_balloons($object->BBC_ballons_idBBC_ballons, "BBC_ballons_idBBC_ballons"); |
||
315 | print "</td></tr>"; |
||
316 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldremarque") . "</td><td><textarea class=\"flat\" name=\"remarque\">" . $object->remarque . "</textarea></td></tr>"; |
||
317 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldincidents") . "</td><td><textarea class=\"flat\" name=\"incidents\">" . $object->incidents . "</textarea></td></tr>"; |
||
318 | |||
319 | if ($user->rights->flightlog->vol->financial || $user->id == $object->fk_pilot) { |
||
320 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldkilometers") . "</td><td><input class=\"flat\" type=\"number\" name=\"kilometers\" value=\"" . $object->kilometers . "\"></td></tr>"; |
||
321 | print "<tr><td class=\"fieldrequired\">" . $langs->trans("Fieldjustif_kilometers") . "</td><td><textarea class=\"flat\" name=\"justif_kilometers\">" . $object->justif_kilometers . "</textarea></td></tr>"; |
||
322 | } |
||
323 | print '</table>'; |
||
324 | |||
325 | dol_fiche_end(); |
||
326 | |||
327 | print '<div class="center"><input type="submit" class="button" name="save" value="' . $langs->trans("Save") . '">'; |
||
328 | print ' <input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
||
329 | print '</div>'; |
||
330 | |||
331 | print '</form>'; |
||
332 | } |
||
333 | |||
334 | |||
335 | // Part to show record |
||
336 | if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { |
||
337 | $res = $object->fetch_optionals($object->id, $extralabels); |
||
338 | |||
339 | $head = prepareFlightTabs($object); |
||
340 | |||
341 | dol_fiche_head($head, 'general', $langs->trans("Vol")); |
||
342 | |||
343 | $linkback = '<a href="' . DOL_URL_ROOT . '/flightlog/list.php">' . $langs->trans("BackToList") . '</a>'; |
||
344 | print $form->showrefnav($object, "idBBC_vols", $linkback, true, "idBBC_vols"); |
||
345 | |||
346 | if ($action == 'delete') { |
||
347 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'), |
||
348 | $langs->trans('êtes-vous sure de vouloir supprimer ce vol ?'), 'confirm_delete', '', 0, 1); |
||
349 | print $formconfirm; |
||
350 | }elseif ($user->rights->flightlog->vol->financial && !$object->isBilled() && $action == ACTION_FLAG_BILLED) { |
||
351 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Marque comme facturé'), |
||
352 | $langs->trans('Ce vol va être marqué comme facturé, est-ce bien le cas ?'), ACTION_CONFIRM_FLAG_BILLED, '', 0, 1); |
||
353 | print $formconfirm; |
||
354 | } |
||
355 | |||
356 | print '<table class="border centpercent">' . "\n"; |
||
357 | |||
358 | |||
359 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldidBBC_vols") . '</td><td>' . $object->idBBC_vols . '</td></tr>'; |
||
360 | print '<tr><td class="fieldrequired">' . $langs->trans("Fielddate") . '</td><td>' . dol_print_date($object->date) . '</td></tr>'; |
||
361 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldlieuD") . '</td><td>' . $object->lieuD . '</td></tr>'; |
||
362 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldlieuA") . '</td><td>' . $object->lieuA . '</td></tr>'; |
||
363 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldheureD") . '</td><td>' . $object->heureD . '</td></tr>'; |
||
364 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldheureA") . '</td><td>' . $object->heureA . '</td></tr>'; |
||
365 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldBBC_ballons_idBBC_ballons") . '</td><td>' . $balloon->immat . '</td></tr>'; |
||
366 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldnbrPax") . '</td><td>' . $object->nbrPax . '</td></tr>'; |
||
367 | print '<tr><td class="fieldrequired">' . $langs->trans("Noms des passagers") . '</td><td>' . $object->getPassengerNames() . '</td></tr>'; |
||
368 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_type") . '</td><td>' . $object->fk_type . '</td></tr>'; |
||
369 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_pilot") . '</td><td>' . $pilot->getNomUrl(1) . '</td></tr>'; |
||
370 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_organisateur") . '</td><td>' . $organisator->getNomUrl(1) . '</td></tr>'; |
||
371 | |||
372 | print '</table>'; |
||
373 | |||
374 | dol_fiche_end(); |
||
375 | |||
376 | // Buttons |
||
377 | print '<div class="tabsAction">' . "\n"; |
||
378 | $parameters = array(); |
||
379 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, |
||
380 | $action); // Note that $action and $object may have been modified by hook |
||
381 | if ($reshook < 0) { |
||
382 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
||
383 | } |
||
384 | |||
385 | View Code Duplication | if ($user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id)) { |
|
386 | print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit">' . $langs->trans("Modify") . '</a></div>' . "\n"; |
||
387 | } |
||
388 | |||
389 | 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
|
|||
390 | print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>' . "\n"; |
||
391 | } |
||
392 | |||
393 | View Code Duplication | if($user->rights->flightlog->vol->financial && $object->fk_type == 2 && !$object->hasFacture() && $object->hasReceiver()){ |
|
394 | print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/flightlog/facture.php?id=' . $object->id.'">' . $langs->trans("Facturer") . '</a></div>' . "\n"; |
||
395 | } |
||
396 | ?> |
||
397 | |||
398 | <?php if($user->rights->flightlog->vol->financial && !$object->isBilled() ): ?> |
||
399 | <div class="inline-block divButAction"> |
||
400 | <a class="butAction" href="<?php echo sprintf('%s?id=%s&action=%s' , $_SERVER["PHP_SELF"], $object->id, ACTION_FLAG_BILLED);?>"> |
||
401 | <?php echo $langs->trans("Marqué comme facturé ") ?> |
||
402 | </a> |
||
403 | </div> |
||
404 | <?php endif; ?> |
||
405 | |||
406 | </div> |
||
407 | <?php |
||
408 | if($user->rights->flightlog->vol->financial){ |
||
409 | print '<div class="fichecenter"><div class="fichehalfleft">'; |
||
410 | $form->showLinkedObjectBlock($object); |
||
411 | print '</div></div>'; |
||
412 | } |
||
413 | |||
414 | } |
||
415 | |||
416 | |||
417 | // End of page |
||
418 | llxFooter(); |
||
419 | $db->close(); |
||
420 |
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.