These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | // Load Dolibarr environment |
||
4 | if (false === (@include '../main.inc.php')) { // From htdocs directory |
||
5 | require '../../documents/custom/main.inc.php'; // From "custom" directory |
||
6 | } |
||
7 | |||
8 | global $db, $langs, $user, $conf; |
||
9 | |||
10 | dol_include_once('/commande/class/commande.class.php'); |
||
11 | dol_include_once('/flightlog/class/bbcvols.class.php'); |
||
12 | dol_include_once('/flightlog/class/bbctypes.class.php'); |
||
13 | dol_include_once("/flightlog/lib/flightLog.lib.php"); |
||
14 | dol_include_once("/flightlog/flightlog.inc.php"); |
||
15 | |||
16 | |||
17 | // Load translation files required by the page |
||
18 | $langs->load("mymodule@flightlog"); |
||
19 | |||
20 | $validator = new FlightValidator($langs, $db, $conf->global->BBC_FLIGHT_TYPE_CUSTOMER, $user->id); |
||
21 | $createFlightHandler = new CreateFlightCommandHandler($db, $conf, $user, $langs, $validator); |
||
22 | |||
23 | if (!$user->rights->flightlog->vol->add) { |
||
24 | accessforbidden(); |
||
25 | } |
||
26 | |||
27 | /* * ***************************************************************** |
||
28 | * ACTIONS |
||
29 | * |
||
30 | * Put here all code to do according to value of "action" parameter |
||
31 | * ****************************************************************** */ |
||
32 | $msg = ''; |
||
33 | if (GETPOST("action") == 'add') { |
||
34 | if (!$_POST["cancel"]) { |
||
35 | $isGroupedFlight = (int) GETPOST('grouped_flight', 'int', 2) === 1; |
||
36 | $orderIds = GETPOST('order_id', 'array', 2); |
||
37 | $orderPassengersCount = GETPOST('order_passengers_count', 'array', 2); |
||
38 | |||
39 | try { |
||
40 | $volCommand = new CreateFlightCommand(); |
||
41 | |||
42 | $volCommand |
||
43 | ->setDate(new DateTimeImmutable($_POST['flight_date'])) |
||
44 | ->setLieuD($_POST['lieuD']) |
||
45 | ->setLieuA($_POST['lieuA']) |
||
46 | ->setHeureD(new DateTimeImmutable($_POST['flight_date'].' '.$_POST['heureD'])) |
||
47 | ->setHeureA(new DateTimeImmutable($_POST['flight_date'].' '.$_POST['heureA'])) |
||
48 | ->setBBCBallonsIdBBCBallons($_POST['ballon']) |
||
49 | ->setNbrPax($_POST['nbrPax']) |
||
50 | ->setRemarque($_POST['comm']) |
||
51 | ->setIncidents($_POST['inci']) |
||
52 | ->setFkType($_POST['type']) |
||
53 | ->setFkPilot($_POST['pilot']) |
||
54 | ->setFkOrganisateur($_POST['orga']) |
||
55 | ->setKilometers($_POST['kilometers']) |
||
56 | ->setCost($_POST['cost']) |
||
57 | ->setFkReceiver($_POST['fk_receiver']) |
||
58 | ->setJustifKilometers($_POST['justif_kilometers']) |
||
59 | ->setPassengerNames($_POST['passenger_names']) |
||
60 | ->setGroupedFlight($isGroupedFlight) |
||
61 | ->setOrderIds($orderPassengersCount); |
||
62 | |||
63 | $vol = $createFlightHandler->handle($volCommand); |
||
64 | |||
65 | include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; |
||
66 | $interface = new Interfaces($db); |
||
67 | $triggerResult = $interface->run_triggers('BBC_FLIGHT_LOG_ADD_FLIGHT', $vol, $user, $langs, $conf); |
||
68 | |||
69 | $msg = '<div class="ok">L\'ajout du vol du : ' . $_POST["reday"] . '/' . $_POST["remonth"] . '/' . $_POST["reyear"] . ' s\'est correctement effectue ! </div>'; |
||
70 | Header("Location: card.php?id=" . $vol->id); |
||
71 | }catch (\Exception $e){ |
||
72 | $msg = '<div class="error">Erreur lors de l\'ajout du vol : ' . ($vol->error?:$e->getMessage()) . '! </div>'; |
||
73 | } |
||
74 | |||
75 | } |
||
76 | } |
||
77 | |||
78 | |||
79 | /* * ************************************************* |
||
80 | * PAGE |
||
81 | * |
||
82 | * Put here all code to build page |
||
83 | * ************************************************** */ |
||
84 | |||
85 | llxHeader('', 'Carnet de vol', ''); |
||
86 | |||
87 | $html = new Form($db); |
||
88 | $commande = new Commande($db); |
||
89 | $orders = $commande->liste_array(2); |
||
90 | $datec = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); |
||
91 | $takeOffPlaces = (new \FlightLog\Infrastructure\Flight\Query\Repository\TakeOffQueryRepository($db))->__invoke($user->id); |
||
92 | $mostUsedBalloon = (new \FlightLog\Infrastructure\Flight\Query\Repository\BalloonQueryRepository($db))->query([ |
||
93 | 'pilot' => $user->id, |
||
94 | ]); |
||
95 | |||
96 | if ($msg) { |
||
97 | print $msg; |
||
98 | } |
||
99 | |||
100 | ?> |
||
101 | |||
102 | <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300&display=swap" rel="stylesheet"> |
||
103 | |||
104 | <section class="bbc-style"> |
||
105 | |||
106 | <?php if(!empty($takeOffPlaces)): ?> |
||
107 | <datalist id="take_off_places_id"> |
||
108 | <?php foreach ($takeOffPlaces as $takeOffPlace): ?> |
||
109 | <option value="<?php echo $takeOffPlace->getPlace(); ?>"></option> |
||
110 | <?php endforeach; ?> |
||
111 | </datalist> |
||
112 | <?php endif; ?> |
||
113 | |||
114 | <div class="errors error-messages"> |
||
115 | <?php |
||
116 | foreach ($validator->getErrors() as $errorMessage) { |
||
117 | print sprintf('<div class="error"><span>%s</span></div>', $errorMessage); |
||
118 | } |
||
119 | ?> |
||
120 | </div> |
||
121 | <form class="flight-form js-form" name='add' action="addFlight.php" method="post"> |
||
122 | <input type="hidden" name="action" value="add"/> |
||
123 | <input type="hidden" name="user_id" value="<?php echo $user->id; ?>"/> |
||
124 | <input type="hidden" name="token" value="<?php echo newToken();?>"/> |
||
125 | |||
126 | <!-- Date et heures --> |
||
127 | <section class="form-section"> |
||
128 | <h1 class="form-section-title"><?php echo $langs->trans('Date & heures'); ?></h1> |
||
129 | |||
130 | <div> |
||
131 | <div class="form-group"> |
||
132 | <label class="fieldrequired"> Type du vol</label> |
||
133 | |||
134 | <div class="inline-radio"> |
||
135 | <?php foreach (fetchBbcFlightTypes() as $flightType) : ?> |
||
136 | <label class=""> |
||
137 | <input type="radio" class="js-flight-type" name="type" value="<?php echo $flightType->id ?>" <?php echo $flightType->numero == $_POST['type'] ? 'checked' : '' ?>> |
||
138 | <span class="text-bold"><?php echo "T" . $flightType->numero ?></span> |
||
139 | <span class="font-italic hide-sm"><?php echo $flightType->nom; ?></span> |
||
140 | </label> |
||
141 | <?php endforeach; ?> |
||
142 | </div> |
||
143 | |||
144 | </div> |
||
145 | |||
146 | <div class="form-group"> |
||
147 | <label class="fieldrequired"> Date du vol</label> |
||
148 | <input |
||
149 | type="date" |
||
150 | name="flight_date" |
||
151 | value="<?php print (new DateTimeImmutable())->format('Y-m-d')?>" |
||
152 | max="<?php print (new DateTimeImmutable())->format('Y-m-d')?>" |
||
153 | min="<?php print (new DateTimeImmutable())->sub(new DateInterval('P3M'))->format('Y-m-d')?>" |
||
154 | /> |
||
155 | </div> |
||
156 | |||
157 | <div class="form-group"> |
||
158 | <label class="fieldrequired">Heure de départ</label> |
||
159 | |||
160 | <input type="time" |
||
161 | name="heureD" |
||
162 | class="flat <?php echo($validator->hasError('heureD') ? 'error' : '') ?>" |
||
163 | value="<?php echo $_POST['heureD'] ?>"/> |
||
164 | |||
165 | </div> |
||
166 | |||
167 | <div class="form-group "> |
||
168 | <label class="fieldrequired">Heure d'arrivée</label> |
||
169 | <input type="time" |
||
170 | name="heureA" |
||
171 | class="flat <?php echo($validator->hasError('heureA') ? 'error' : '') ?>" |
||
172 | value="<?php echo $_POST['heureA'] ?>"/> |
||
173 | </div> |
||
174 | |||
175 | |||
176 | </div> |
||
177 | </section> |
||
178 | |||
179 | <!-- Pilote et Ballon --> |
||
180 | <section class="form-section"> |
||
181 | <h1 class="form-section-title"><?php echo $langs->trans('Vol') ?></h1> |
||
182 | <div > |
||
183 | <div class="form-group"> |
||
184 | <label class="fieldrequired"> Pilote</label> |
||
185 | <?php print $html->select_dolusers($_POST["pilot"] ? $_POST["pilot"] : $user->id, 'pilot', 0, null, 0, '', '', 0,0,0,'',0,'','', true); ?> |
||
186 | </div> |
||
187 | |||
188 | <div class="form-group "> |
||
189 | <label class="fieldrequired"> |
||
190 | <span class="js-organisator-field">Organisateur</span> |
||
191 | <span class="js-instructor-field">Instructeur</span> |
||
192 | </label> |
||
193 | <?php |
||
194 | //organisateur |
||
195 | print $html->select_dolusers($_POST["orga"] ? $_POST["orga"] : $user->id, 'orga', 0, null, 0, '', '', 0,0,0,'',0,'','', true); |
||
196 | ?> |
||
197 | </div> |
||
198 | |||
199 | <div class="form-group"> |
||
200 | <label class="fieldrequired">Lieu de départ </label> |
||
201 | <input type="text" name="lieuD" list="take_off_places_id" class="flat" value="<?php print $_POST['lieuD'] ?>"/> |
||
202 | </div> |
||
203 | |||
204 | <div class="form-group "> |
||
205 | <label class="fieldrequired">Lieu d'arrivée </label> |
||
206 | <input type="text" name="lieuA" class="flat" value="<?php print $_POST['lieuA'] ?>"/> |
||
207 | </div> |
||
208 | |||
209 | <div class="form-group"> |
||
210 | <label class="fieldrequired">Ballon</label> |
||
211 | <?php select_balloons($_POST['ballon']?: ($mostUsedBalloon ? $mostUsedBalloon->getId() : ''), 'ballon', 0, false, true); ?> |
||
0 ignored issues
–
show
|
|||
212 | </div> |
||
213 | |||
214 | <div class="form-group"> |
||
215 | <label>Il y'avait-il plusieurs ballons ?</label> |
||
216 | <input type="checkbox" value="1" name="grouped_flight"/> - Oui |
||
217 | </div> |
||
218 | </div> |
||
219 | </section> |
||
220 | |||
221 | <!-- Movements --> |
||
222 | <section class="form-section js-expensable-field"> |
||
223 | <h1 class="form-section-title"><?php echo $langs->trans('Déplacements') ?></h1> |
||
224 | <div > |
||
225 | <!-- number of kilometers done for the flight --> |
||
226 | <div class="form-group"> |
||
227 | <label class="fieldrequired">Nombre de kilometres effectués pour le vol</label> |
||
228 | <input type="number" name="kilometers" class="flat <?php echo($validator->hasError('kilometers') ? 'error' : '') ?>" value="<?php echo $_POST['kilometers'] ?>"/> |
||
229 | </div> |
||
230 | |||
231 | <!-- Justif Kilometers --> |
||
232 | <div class="form-group"> |
||
233 | |||
234 | <label class="fieldrequired">Justificatif des KM </label> |
||
235 | <textarea name="justif_kilometers" rows="2" cols="60" class="flat <?php echo($validator->hasError('justif_kilometers') ? 'error' : '') ?>"><?php echo $_POST['justif_kilometers'] ?></textarea> |
||
236 | </div> |
||
237 | </div> |
||
238 | </section> |
||
239 | |||
240 | <!-- Passagers --> |
||
241 | <section class="form-section"> |
||
242 | <h1 class="form-section-title"><?php echo $langs->trans('Passagers') ?></h1> |
||
243 | <div > |
||
244 | <div class="form-group"> |
||
245 | <label class="fieldrequired"><?php echo $langs->trans('Nombre de passagers'); ?></label> |
||
246 | <input type="number" |
||
247 | name="nbrPax" |
||
248 | min="0" |
||
249 | max="5" |
||
250 | class="flat <?php echo $validator->hasError('nbrPax') ? 'error' : '' ?>" |
||
251 | value="<?php echo $_POST['nbrPax']?: 0 ?>"/> |
||
252 | </div> |
||
253 | |||
254 | <!-- passenger names --> |
||
255 | <div class="form-group"> |
||
256 | <label class="fieldrequired"><?php echo $langs->trans('Noms des passagers'); ?><br/>(Séparé par des ; )</label> |
||
257 | <textarea name="passenger_names" cols="60" rows="2" class="flat <?php echo $validator->hasError('passenger_names') ? 'error' : '' ?>"><?php echo $_POST['passenger_names'] ?></textarea> |
||
258 | </div> |
||
259 | </div> |
||
260 | </section> |
||
261 | |||
262 | <!-- billing information --> |
||
263 | <section class="form-section js-billable-field"> |
||
264 | <h1 class="form-section-title"><?php echo $langs->trans('Facturation') ?></h1> |
||
265 | |||
266 | <div> |
||
267 | <p class="text-muted"> |
||
268 | Le bloc sur la facturation permet de savoir où retrouver l'argent du vol. Sur des commandes, au près d'un membre, ... <br/> |
||
269 | Il est donc normal de devoir réencoder le nombre de passagers. |
||
270 | </p> |
||
271 | |||
272 | <!-- Order --> |
||
273 | <div id="list_order" class="js-base-form js-billable-field form-group"> |
||
274 | <!-- BASE form --> |
||
275 | <table class="bill style-default"> |
||
276 | <!-- Cash --> |
||
277 | <tr> |
||
278 | <th colspan="2">A. Cash <small>(ou virement)</small></th> |
||
279 | </tr> |
||
280 | |||
281 | <tr> |
||
282 | <td colspan="2"> |
||
283 | A compléter si de l'argent a été perçu par un membre du Belgian Balloon Club. |
||
284 | </td> |
||
285 | </tr> |
||
286 | |||
287 | <tr> |
||
288 | <td class="js-receiver" data-user-id="<?php echo $user->id;?>"> |
||
289 | <label class=""><?php echo $langs->trans('Membre ayant perçu l\'argent')?>?</label> |
||
290 | <?php print $html->select_dolusers( |
||
291 | $_POST["fk_receiver"] ? $_POST["fk_receiver"] : -1, |
||
292 | 'fk_receiver', true, null, 0, '', '', 0,0,0,'',0,'','', true); ?> |
||
293 | </td> |
||
294 | <td> |
||
295 | <label> </label> |
||
296 | <div class="input-group"> |
||
297 | <input type="number" name="cost" step="1" min="0" class="flat js-cost" disabled value="<?php echo $_POST['cost']?:0 ?>"/> |
||
298 | <span class="input-symbol">€</span> |
||
299 | </div> |
||
300 | </td> |
||
301 | </tr> |
||
302 | |||
303 | <!-- Order --> |
||
304 | <tr> |
||
305 | <th>B. Commande(s)</th> |
||
306 | <th>Nombre de passagers.</th> |
||
307 | </tr> |
||
308 | <?php if(is_array($_POST['order_passengers_count']) && !empty($_POST['order_passengers_count'])): ?> |
||
309 | <?php foreach($_POST['order_passengers_count'] as $order => $orderQuantity): ?> |
||
310 | <tr class="order-row"> |
||
311 | <td> |
||
312 | <span class="fa fa-trash remove js-remove" data-order-id="<?php echo $order; ?>"></span> |
||
313 | <span class="js-order-ref"><?php echo $orders[$order]?></span> |
||
314 | </td> |
||
315 | <td><input type="number" value="<?php echo $orderQuantity; ?>" min="1" max="5" name="order_passengers_count[<?php echo $order; ?>]" class="js-nbr-pax" /></td> |
||
316 | </tr> |
||
317 | <?php endforeach; ?> |
||
318 | <?php endif; ?> |
||
319 | |||
320 | <tr class="js-order"> |
||
321 | <td> |
||
322 | <?php |
||
323 | echo $html::selectarray( |
||
324 | 'order_id', |
||
325 | $orders, |
||
326 | $_POST['order_id'], |
||
327 | 1, |
||
328 | 0, |
||
329 | $validator->hasError('order_id') ? 'error' : '', |
||
330 | 0, |
||
331 | '100%', |
||
332 | 0, |
||
333 | 0, |
||
334 | '', |
||
335 | 'js-order-select', |
||
336 | true |
||
337 | ); |
||
338 | ?> |
||
339 | <span class="text-muted">Sélection de la commande réalisée en totalité (ou en partie)</span> |
||
340 | </td> |
||
341 | |||
342 | <td > </td> |
||
343 | </tr> |
||
344 | |||
345 | </table> |
||
346 | </div> |
||
347 | </div> |
||
348 | </section> |
||
349 | |||
350 | <!-- Comments --> |
||
351 | <section class="form-section"> |
||
352 | <h1 class="form-section-title"><?php echo $langs->trans('Commentaires') ?></h1> |
||
353 | <div> |
||
354 | <!-- commentaires --> |
||
355 | <div class=" form-group"> |
||
356 | <label class="fieldrequired"> Note sur le vol </label> |
||
357 | <textarea rows="2" cols="60" class="flat" name="comm" placeholder="RAS"><?php print $_POST['comm']; ?></textarea> |
||
358 | </div> |
||
359 | |||
360 | <!-- incidents --> |
||
361 | <div class=" form-group"> |
||
362 | <label class="fieldrequired"> Incidents, Brulure, ...</label> |
||
363 | <textarea rows="2" cols="60" class="flat" name="inci" placeholder="RAS"><?php print $_POST['inci']; ?></textarea> |
||
364 | <p class="text-muted">Incidents ou dégâts constatés au ballon.</p> |
||
365 | </div> |
||
366 | </div> |
||
367 | </section> |
||
368 | |||
369 | <div class="d-grid"> |
||
370 | <div class="grid-col grid-col-6"> |
||
371 | <button class="button _info" type="button" name="cancel" ><?php print $langs->trans("Cancel") ?></button> |
||
372 | </div> |
||
373 | |||
374 | <div class="grid-col grid-col-6"> |
||
375 | <button class="button _success" type="submit" ><span class="fa fa-check"></span> <?php print $langs->trans("Save") ?></button> |
||
376 | </div> |
||
377 | </div> |
||
378 | </form> |
||
379 | <?php |
||
380 | |||
381 | $db->close(); |
||
382 | ?> |
||
383 | |||
384 | <script type="text/html" id="orderRow"> |
||
385 | |||
386 | <tr class="order-row"> |
||
387 | <td><span class="fa fa-trash remove js-remove"></span> <span class="js-order-ref"></span></td> |
||
388 | <td><input type="number" value="1" min="1" max="5" name="" class="js-nbr-pax" /></td> |
||
389 | </tr> |
||
390 | </script> |
||
391 | |||
392 | <script type="application/javascript"> |
||
393 | |||
394 | /** |
||
395 | * get the flight type object from an id. |
||
396 | */ |
||
397 | function getFlightType(flightTypeId){ |
||
398 | var types = { |
||
399 | 1:{ |
||
400 | 'billable' : 1, |
||
401 | 'expensable' : 1, |
||
402 | 'id' : 1 |
||
403 | }, |
||
404 | 2:{ |
||
405 | 'billable' : 1, |
||
406 | 'expensable' : 1, |
||
407 | 'id' : 2 |
||
408 | }, |
||
409 | 3:{ |
||
410 | 'billable' : 0, |
||
411 | 'expensable' : 0, |
||
412 | 'id' : 3 |
||
413 | }, |
||
414 | 4:{ |
||
415 | 'billable' : 0, |
||
416 | 'expensable' : 0, |
||
417 | 'id' : 4 |
||
418 | }, |
||
419 | 5:{ |
||
420 | 'billable' : 0, |
||
421 | 'expensable' : 0, |
||
422 | 'id' : 5 |
||
423 | }, |
||
424 | 6:{ |
||
425 | 'billable' : 0, |
||
426 | 'expensable' : 0, |
||
427 | 'id' : 6 |
||
428 | }, |
||
429 | 7:{ |
||
430 | 'billable' : 0, |
||
431 | 'expensable' : 0, |
||
432 | 'id' : 7 |
||
433 | } |
||
434 | }; |
||
435 | |||
436 | var flightTypeNull = { |
||
437 | 'billable' : 0, |
||
438 | 'expensable' : 0, |
||
439 | 'id' : 0 |
||
440 | }; |
||
441 | |||
442 | return typeof types[flightTypeId] === 'undefined' ? flightTypeNull : types[flightTypeId]; |
||
443 | } |
||
444 | |||
445 | function flightTypeChanged($this){ |
||
446 | var typeId = $this.val(); |
||
447 | var flightType = getFlightType(typeId); |
||
448 | |||
449 | if(flightType.billable === 1){ |
||
450 | $('.js-form .js-billable-field').removeClass('hidden'); |
||
451 | }else{ |
||
452 | $('.js-form .js-billable-field').addClass('hidden'); |
||
453 | } |
||
454 | |||
455 | if(flightType.expensable === 1){ |
||
456 | $('.js-form .js-expensable-field').removeClass('hidden'); |
||
457 | }else{ |
||
458 | $('.js-form .js-expensable-field').addClass('hidden'); |
||
459 | } |
||
460 | |||
461 | if(flightType.id === 6){ |
||
462 | //instruction flight |
||
463 | $('.js-form .js-instructor-field').removeClass('hidden'); |
||
464 | $('.js-form .js-organisator-field').addClass('hidden'); |
||
465 | } else { |
||
466 | $('.js-form .js-instructor-field').addClass('hidden'); |
||
467 | $('.js-form .js-organisator-field').removeClass('hidden'); |
||
468 | } |
||
469 | |||
470 | } |
||
471 | |||
472 | function removeOrderLine(){ |
||
473 | var $this = $(this); |
||
474 | $('.js-base-form .js-order select option[value="'+$this.data('orderId')+'"]').attr('disabled', false); |
||
475 | $this.parents('tr').remove(); |
||
476 | } |
||
477 | |||
478 | function addOrder(){ |
||
479 | var orderId = parseInt($('.js-base-form .js-order select').val(), 10); |
||
480 | var $option = $('.js-base-form .js-order select option[value="'+orderId+'"]'); |
||
481 | var orderRef = $option.html(); |
||
482 | var $addingElement = $($('#orderRow').html()); |
||
483 | var $removeButton = $addingElement.find('.js-remove'); |
||
484 | var nbrPax = 1; |
||
485 | |||
486 | if(orderId <= 0){ |
||
487 | return; |
||
488 | } |
||
489 | |||
490 | // Manage remove button |
||
491 | $removeButton.data('orderId', orderId); |
||
492 | $removeButton.on('click', removeOrderLine); |
||
493 | |||
494 | // Add the reference |
||
495 | $addingElement.find('.js-order-ref').html(orderRef); |
||
496 | |||
497 | // Add the number of pax |
||
498 | $addingElement.find('.js-nbr-pax').html(nbrPax); |
||
499 | $addingElement.find('input.js-nbr-pax').val(nbrPax); |
||
500 | $addingElement.find('input.js-nbr-pax').attr('name', 'order_passengers_count['+orderId+']'); |
||
501 | |||
502 | // disable the option |
||
503 | $option.attr('disabled', true); |
||
504 | |||
505 | $('.js-base-form .js-order').before($addingElement); |
||
506 | |||
507 | } |
||
508 | |||
509 | function changeReceiver(){ |
||
510 | var $select = $(this); |
||
511 | var userId = parseInt($select.val(), 10); |
||
512 | var currentUserId = parseInt($select.parents('.js-receiver').data('userId'), 10); |
||
513 | var $cost = $('input.js-cost'); |
||
514 | |||
515 | $cost.val(0); |
||
516 | $cost.prop('disabled', true); |
||
517 | if(userId === currentUserId){ |
||
518 | $cost.val(0); |
||
519 | $cost.prop('disabled', false); |
||
520 | } |
||
521 | } |
||
522 | |||
523 | $(function(){ |
||
524 | $('.js-base-form .js-order select').on('change', addOrder); |
||
525 | $('.js-base-form .js-receiver select').on('change', changeReceiver); |
||
526 | |||
527 | $('.js-flight-type').on('change', function(){ |
||
528 | var $this = $(this); |
||
529 | flightTypeChanged($this); |
||
530 | }); |
||
531 | $('.js-remove').on('click', removeOrderLine); |
||
532 | flightTypeChanged($('.js-flight-type:checked')); |
||
533 | |||
534 | }); |
||
535 | </script> |
||
536 | |||
537 | </section> |
||
538 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: