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/flightLog.inc.php'); |
||
| 47 | dol_include_once('/flightlog/class/bbcvols.class.php'); |
||
| 48 | dol_include_once('/flightlog/class/bbctypes.class.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 | |||
| 295 | <?php |
||
| 296 | $formFlight = new \flightlog\form\FlightForm(new FlightValidator($langs, $db, $conf->global->BBC_FLIGHT_TYPE_CUSTOMER), $object); |
||
|
0 ignored issues
–
show
|
|||
| 297 | $formFlight->bind($object); |
||
| 298 | ?> |
||
| 299 | |||
| 300 | |||
| 301 | <?php $renderer = new \flightlog\form\SimpleFormRenderer(); ?> |
||
| 302 | |||
| 303 | <div class="errors error-messages"> |
||
| 304 | <?php |
||
| 305 | foreach ([] as $errorMessage) { |
||
| 306 | print sprintf('<div class="error"><span>%s</span></div>', $errorMessage); |
||
| 307 | } |
||
| 308 | ?> |
||
| 309 | </div> |
||
| 310 | |||
| 311 | <form class="flight-form js-form" name='add' action="addFlight.php" method="post"> |
||
| 312 | <input type="hidden" name="action" value="update"/> |
||
| 313 | |||
| 314 | <!-- Date et heures --> |
||
| 315 | <section class="form-section"> |
||
| 316 | <h1 class="form-section-title"><?php echo $langs->trans('Date & heures'); ?></h1> |
||
| 317 | <table class="border" width="50%"> |
||
| 318 | |||
| 319 | <tr> |
||
| 320 | <td class="fieldrequired" width="25%"> Type du vol</td> |
||
| 321 | <td ><?php echo $renderer->render($formFlight->getElement('fk_type')); ?></td> |
||
| 322 | </tr> |
||
| 323 | </table> |
||
| 324 | </section> |
||
| 325 | |||
| 326 | <section class="form-section"> |
||
| 327 | <h1 class="form-section-title"><?php echo $langs->trans('Pilote & ballon') ?></h1> |
||
| 328 | <table class="border" width="50%"> |
||
| 329 | |||
| 330 | <tr> |
||
| 331 | <td class="fieldrequired"> Pilote </td> |
||
| 332 | <td><?php echo $renderer->render($formFlight->getElement('fk_pilot')); ?></td> |
||
| 333 | </tr> |
||
| 334 | |||
| 335 | <tr> |
||
| 336 | <td width="25%" class="fieldrequired">Ballon</td> |
||
| 337 | <td><?php echo $renderer->render($formFlight->getElement('BBC_ballons_idBBC_ballons')); ?></td> |
||
| 338 | </tr> |
||
| 339 | |||
| 340 | <tr> |
||
| 341 | <td>Il y'avait-il plusieurs ballons ?</td> |
||
| 342 | <td colspan="3"><input type="checkbox" value="1" name="grouped_flight"/> - Oui</td> |
||
| 343 | </tr> |
||
| 344 | </table> |
||
| 345 | </section> |
||
| 346 | |||
| 347 | <section class="form-section"> |
||
| 348 | <h1 class="form-section-title"><?php echo $langs->trans('Lieux') ?></h1> |
||
| 349 | <table class="border" width="100%"> |
||
| 350 | <?php |
||
| 351 | |||
| 352 | //place start |
||
| 353 | print "<tr>"; |
||
| 354 | print '<td class="fieldrequired">Lieu de départ </td><td width="25%" >'; |
||
| 355 | print $renderer->render($formFlight->getElement('lieuD')); |
||
| 356 | print '</td>'; |
||
| 357 | |||
| 358 | //place end |
||
| 359 | print '<td class="fieldrequired">Lieu d\'arrivée </td><td>'; |
||
| 360 | print $renderer->render($formFlight->getElement('lieuA')); |
||
| 361 | print '</td></tr>'; |
||
| 362 | |||
| 363 | ?> |
||
| 364 | |||
| 365 | </table> |
||
| 366 | </section> |
||
| 367 | |||
| 368 | <section class="form-section"> |
||
| 369 | <h1 class="form-section-title"><span class="js-organisator-field">Organisateur</span><span |
||
| 370 | class="js-instructor-field">Instructeur</span></h1> |
||
| 371 | <table class="border" width="50%"> |
||
| 372 | <tr> |
||
| 373 | <td class="fieldrequired"><span class="js-organisator-field">Organisateur</span><span |
||
| 374 | class="js-instructor-field">Instructeur</span></td> |
||
| 375 | <td> |
||
| 376 | <?php |
||
| 377 | //organisateur |
||
| 378 | print $renderer->render($formFlight->getElement('fk_organisateur')); |
||
| 379 | ?> |
||
| 380 | </td> |
||
| 381 | </tr> |
||
| 382 | </table> |
||
| 383 | </section> |
||
| 384 | |||
| 385 | |||
| 386 | <section class="form-section js-expensable-field"> |
||
| 387 | <h1 class="form-section-title"><?php echo $langs->trans('Déplacements') ?></h1> |
||
| 388 | <table class="border" width="50%"> |
||
| 389 | <!-- number of kilometers done for the flight --> |
||
| 390 | <tr> |
||
| 391 | <td class="fieldrequired">Nombre de kilometres effectués pour le vol</td> |
||
| 392 | <td> |
||
| 393 | <?php print $renderer->render($formFlight->getElement('kilometers')); ?> |
||
| 394 | </td> |
||
| 395 | </tr> |
||
| 396 | |||
| 397 | <!-- Justif Kilometers --> |
||
| 398 | <tr> |
||
| 399 | |||
| 400 | <td width="25%" class="fieldrequired">Justificatif des KM</td> |
||
| 401 | <td> |
||
| 402 | <?php print $renderer->render($formFlight->getElement('justif_kilometers')); ?> |
||
| 403 | </textarea> |
||
| 404 | </td> |
||
| 405 | </tr> |
||
| 406 | </table> |
||
| 407 | </section> |
||
| 408 | |||
| 409 | <!-- Passagers --> |
||
| 410 | <section class="form-section"> |
||
| 411 | <h1 class="form-section-title"><?php echo $langs->trans('Passager') ?></h1> |
||
| 412 | <table class="border" width="50%"> |
||
| 413 | <tr> |
||
| 414 | <td class="fieldrequired"><?php echo $langs->trans('Nombre de passagers'); ?></td> |
||
| 415 | <td> |
||
| 416 | <?php print $renderer->render($formFlight->getElement('nbrPax')); ?> |
||
| 417 | </td> |
||
| 418 | </tr> |
||
| 419 | |||
| 420 | <!-- passenger names --> |
||
| 421 | <tr> |
||
| 422 | <td width="25%" class="fieldrequired"><?php echo $langs->trans('Noms des passagers'); ?><br/>(Séparé |
||
| 423 | par des ; ) |
||
| 424 | </td> |
||
| 425 | <td> |
||
| 426 | <?php print $renderer->render($formFlight->getElement('passengerNames')); ?> |
||
| 427 | </td> |
||
| 428 | </tr> |
||
| 429 | </table> |
||
| 430 | </section> |
||
| 431 | |||
| 432 | <!-- billing information --> |
||
| 433 | <section class="form-section"> |
||
| 434 | <h1 class="form-section-title js-billable-field"><?php echo $langs->trans('Facturation') ?></h1> |
||
| 435 | <table class="border" width="50%"> |
||
| 436 | |||
| 437 | <!-- Money receiver --> |
||
| 438 | <tr class="js-hide-order js-billable-field"> |
||
| 439 | <td class="fieldrequired"><?php echo $langs->trans('Qui a perçu l\'argent') ?></td> |
||
| 440 | <td> |
||
| 441 | <?php print $renderer->render($formFlight->getElement('fk_receiver')); ?> |
||
| 442 | </td> |
||
| 443 | </tr> |
||
| 444 | |||
| 445 | <!-- Flight cost --> |
||
| 446 | <tr class="js-hide-order js-billable-field"> |
||
| 447 | <td class="fieldrequired">Montant perçu</td> |
||
| 448 | <td> |
||
| 449 | <?php print $renderer->render($formFlight->getElement('cost')); ?> |
||
| 450 | € |
||
| 451 | </td> |
||
| 452 | </tr> |
||
| 453 | </table> |
||
| 454 | </section> |
||
| 455 | |||
| 456 | <!-- comments --> |
||
| 457 | <section class="form-section"> |
||
| 458 | <h1 class="form-section-title"><?php echo $langs->trans('Commentaires') ?></h1> |
||
| 459 | <table class="border" width="50%"> |
||
| 460 | <!-- commentaires --> |
||
| 461 | <tr class=""> |
||
| 462 | <td class="fieldrequired"> Commentaire</td> |
||
| 463 | <td> |
||
| 464 | <?php print $renderer->render($formFlight->getElement('remarque')); ?> |
||
| 465 | </td> |
||
| 466 | </tr> |
||
| 467 | |||
| 468 | <!-- incidents --> |
||
| 469 | <tr class=""> |
||
| 470 | <td class="fieldrequired"> incidents</td> |
||
| 471 | <td> |
||
| 472 | <?php print $renderer->render($formFlight->getElement('incidents')); ?> |
||
| 473 | </td> |
||
| 474 | </tr> |
||
| 475 | </table> |
||
| 476 | </section> |
||
| 477 | </form> |
||
| 478 | |||
| 479 | <?php endif; |
||
| 480 | |||
| 481 | |||
| 482 | // Part to show record |
||
| 483 | if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { |
||
| 484 | $res = $object->fetch_optionals($object->id, $extralabels); |
||
| 485 | |||
| 486 | $head = prepareFlightTabs($object); |
||
| 487 | |||
| 488 | dol_fiche_head($head, 'general', $langs->trans("Vol")); |
||
| 489 | |||
| 490 | $linkback = '<a href="' . DOL_URL_ROOT . '/flightlog/list.php">' . $langs->trans("BackToList") . '</a>'; |
||
| 491 | print $form->showrefnav($object, "idBBC_vols", $linkback, true, "idBBC_vols"); |
||
| 492 | |||
| 493 | if ($action == 'delete') { |
||
| 494 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyOjbect'), |
||
| 495 | $langs->trans('êtes-vous sure de vouloir supprimer ce vol ?'), 'confirm_delete', '', 0, 1); |
||
| 496 | print $formconfirm; |
||
| 497 | } elseif ($user->rights->flightlog->vol->financial && !$object->isBilled() && $action == ACTION_FLAG_BILLED) { |
||
| 498 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, |
||
| 499 | $langs->trans('Marque comme facturé'), |
||
| 500 | $langs->trans('Ce vol va être marqué comme facturé, est-ce bien le cas ?'), ACTION_CONFIRM_FLAG_BILLED, '', |
||
| 501 | 0, 1); |
||
| 502 | print $formconfirm; |
||
| 503 | } |
||
| 504 | |||
| 505 | print '<table class="border centpercent">' . "\n"; |
||
| 506 | |||
| 507 | |||
| 508 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldidBBC_vols") . '</td><td>' . $object->idBBC_vols . '</td></tr>'; |
||
| 509 | print '<tr><td class="fieldrequired">' . $langs->trans("Fielddate") . '</td><td>' . dol_print_date($object->date) . '</td></tr>'; |
||
| 510 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldlieuD") . '</td><td>' . $object->lieuD . '</td></tr>'; |
||
| 511 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldlieuA") . '</td><td>' . $object->lieuA . '</td></tr>'; |
||
| 512 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldheureD") . '</td><td>' . $object->heureD . '</td></tr>'; |
||
| 513 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldheureA") . '</td><td>' . $object->heureA . '</td></tr>'; |
||
| 514 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldBBC_ballons_idBBC_ballons") . '</td><td>' . $balloon->immat . '</td></tr>'; |
||
| 515 | print '<tr><td class="fieldrequired">' . $langs->trans("FieldnbrPax") . '</td><td>' . $object->nbrPax . '</td></tr>'; |
||
| 516 | print '<tr><td class="fieldrequired">' . $langs->trans("Noms des passagers") . '</td><td>' . $object->getPassengerNames() . '</td></tr>'; |
||
| 517 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_type") . '</td><td>' . $object->fk_type . '</td></tr>'; |
||
| 518 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_pilot") . '</td><td>' . $pilot->getNomUrl(1) . '</td></tr>'; |
||
| 519 | print '<tr><td class="fieldrequired">' . $langs->trans("Fieldfk_organisateur") . '</td><td>' . $organisator->getNomUrl(1) . '</td></tr>'; |
||
| 520 | |||
| 521 | print '</table>'; |
||
| 522 | |||
| 523 | dol_fiche_end(); |
||
| 524 | |||
| 525 | // Buttons |
||
| 526 | print '<div class="tabsAction">' . "\n"; |
||
| 527 | $parameters = array(); |
||
| 528 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, |
||
| 529 | $action); // Note that $action and $object may have been modified by hook |
||
| 530 | if ($reshook < 0) { |
||
| 531 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
||
| 532 | } |
||
| 533 | |||
| 534 | View Code Duplication | if ($user->rights->flightlog->vol->edit || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id && !$object->isBilled())) { |
|
| 535 | print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit">' . $langs->trans("Modify") . '</a></div>' . "\n"; |
||
| 536 | } |
||
| 537 | |||
| 538 | View Code Duplication | if ($user->rights->flightlog->vol->delete || ($user->rights->flightlog->vol->add && $object->fk_pilot == $user->id && !$object->isBilled())) { |
|
| 539 | print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>' . "\n"; |
||
| 540 | } |
||
| 541 | |||
| 542 | View Code Duplication | if ($user->rights->flightlog->vol->financial && $object->fk_type == 2 && !$object->hasFacture() && $object->hasReceiver()) { |
|
| 543 | 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"; |
||
| 544 | } |
||
| 545 | ?> |
||
| 546 | |||
| 547 | <?php if ($user->rights->flightlog->vol->financial && !$object->isBilled()): ?> |
||
| 548 | <div class="inline-block divButAction"> |
||
| 549 | <a class="butAction" href="<?php echo sprintf('%s?id=%s&action=%s', $_SERVER["PHP_SELF"], $object->id, |
||
| 550 | ACTION_FLAG_BILLED); ?>"> |
||
| 551 | <?php echo $langs->trans("Marqué comme facturé ") ?> |
||
| 552 | </a> |
||
| 553 | </div> |
||
| 554 | <?php endif; ?> |
||
| 555 | |||
| 556 | </div> |
||
| 557 | <?php |
||
| 558 | if ($user->rights->flightlog->vol->financial) { |
||
| 559 | print '<div class="fichecenter"><div class="fichehalfleft">'; |
||
| 560 | $form->showLinkedObjectBlock($object); |
||
| 561 | print '</div></div>'; |
||
| 562 | } |
||
| 563 | |||
| 564 | } |
||
| 565 | |||
| 566 | |||
| 567 | // End of page |
||
| 568 | llxFooter(); |
||
| 569 | $db->close(); |
||
| 570 |
This check looks for function calls that miss required arguments.