These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * \file flightlog/bbcvols_list.php |
||
| 4 | * \ingroup flightlog |
||
| 5 | * \brief This file is an example of a php page |
||
| 6 | * Initialy built by build_class_from_table on 2017-02-10 16:55 |
||
| 7 | */ |
||
| 8 | |||
| 9 | // Load Dolibarr environment |
||
| 10 | if (false === (@include '../main.inc.php')) { // From htdocs directory |
||
| 11 | require '../../documents/custom/main.inc.php'; // From "custom" directory |
||
| 12 | } |
||
| 13 | |||
| 14 | // Change this following line to use the correct relative path from htdocs |
||
| 15 | require_once(DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'); |
||
| 16 | require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
||
| 17 | require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
||
| 18 | dol_include_once('/flightballoon/bbc_ballons.class.php'); |
||
| 19 | dol_include_once('/flightlog/class/bbcvols.class.php'); |
||
| 20 | dol_include_once('/flightlog/class/bbctypes.class.php'); |
||
| 21 | dol_include_once('/flightlog/lib/flightLog.lib.php'); |
||
| 22 | |||
| 23 | // Load traductions files requiredby by page |
||
| 24 | global $user, $langs, $conf; |
||
| 25 | |||
| 26 | $langs->load("mymodule@flightlog"); |
||
| 27 | $langs->load("other"); |
||
| 28 | |||
| 29 | $action = GETPOST('action', 'alpha'); |
||
| 30 | $massaction = GETPOST('massaction', 'alpha'); |
||
| 31 | $show_files = GETPOST('show_files', 'int'); |
||
| 32 | $confirm = GETPOST('confirm', 'alpha'); |
||
| 33 | $toselect = GETPOST('toselect', 'array'); |
||
| 34 | |||
| 35 | $id = GETPOST('id', 'int'); |
||
| 36 | $backtopage = GETPOST('backtopage'); |
||
| 37 | $myparam = GETPOST('myparam', 'alpha'); |
||
| 38 | |||
| 39 | $search_all = trim(GETPOST("sall")); |
||
| 40 | $search_idBBC_vols = GETPOST('search_idBBC_vols', 'int'); |
||
| 41 | $search_date = GETPOST('search_date', 'alpha'); |
||
| 42 | $search_lieuD = GETPOST('search_lieuD', 'alpha'); |
||
| 43 | $search_lieuA = GETPOST('search_lieuA', 'alpha'); |
||
| 44 | $search_heureD = GETPOST('search_heureD', 'alpha'); |
||
| 45 | $search_heureA = GETPOST('search_heureA', 'alpha'); |
||
| 46 | $search_BBC_ballons_idBBC_ballons = GETPOST('search_BBC_ballons_idBBC_ballons', 'int'); |
||
| 47 | $search_nbrPax = GETPOST('search_nbrPax', 'alpha'); |
||
| 48 | $search_remarque = GETPOST('search_remarque', 'alpha'); |
||
| 49 | $search_incidents = GETPOST('search_incidents', 'alpha'); |
||
| 50 | $search_fk_type = GETPOST('search_fk_type', 'int'); |
||
| 51 | $search_fk_pilot = GETPOST('search_fk_pilot', 'int') ?: ($user->admin ? '' : $user->id); |
||
| 52 | $search_fk_organisateur = GETPOST('search_fk_organisateur', 'int'); |
||
| 53 | $search_is_facture = GETPOST('search_is_facture', 'int') === ''? -1 : (int)GETPOST('search_is_facture', 'int'); |
||
| 54 | if($search_is_facture === 0){ |
||
| 55 | $search_is_facture = '<=0'; |
||
| 56 | } |
||
| 57 | $search_kilometers = GETPOST('search_kilometers', 'alpha'); |
||
| 58 | $search_cost = GETPOST('search_cost', 'alpha'); |
||
| 59 | $search_fk_receiver = GETPOST('search_fk_receiver', 'int'); |
||
| 60 | $search_justif_kilometers = GETPOST('search_justif_kilometers', 'alpha'); |
||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | $search_myfield = GETPOST('search_myfield'); |
||
| 65 | $optioncss = GETPOST('optioncss', 'alpha'); |
||
| 66 | |||
| 67 | // Load variable for pagination |
||
| 68 | $limit = GETPOST("limit") ? GETPOST("limit", "int") : $conf->liste_limit; |
||
| 69 | $sortfield = GETPOST('sortfield', 'alpha'); |
||
| 70 | $sortorder = GETPOST('sortorder', 'alpha'); |
||
| 71 | $page = GETPOST('page', 'int'); |
||
| 72 | if ($page == -1) { |
||
| 73 | $page = 0; |
||
| 74 | } |
||
| 75 | $offset = $limit * $page; |
||
| 76 | $pageprev = $page - 1; |
||
| 77 | $pagenext = $page + 1; |
||
| 78 | if (!$sortfield) { |
||
| 79 | $sortfield = "t.date, t.heureD"; |
||
| 80 | } // Set here default search field |
||
| 81 | if (!$sortorder) { |
||
| 82 | $sortorder = "DESC"; |
||
| 83 | } |
||
| 84 | |||
| 85 | // Protection if external user |
||
| 86 | $socid = 0; |
||
| 87 | if ($user->societe_id > 0) { |
||
| 88 | $socid = $user->societe_id; |
||
| 89 | //accessforbidden(); |
||
| 90 | } |
||
| 91 | |||
| 92 | // Initialize technical object to manage context to save list fields |
||
| 93 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'flightLoglist'; |
||
| 94 | |||
| 95 | // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array |
||
| 96 | $hookmanager->initHooks(array('flightLoglist')); |
||
| 97 | $extrafields = new ExtraFields($db); |
||
| 98 | |||
| 99 | // fetch optionals attributes and labels |
||
| 100 | $extralabels = $extrafields->fetch_name_optionals_label('flightlog'); |
||
| 101 | $search_array_options = $extrafields->getOptionalsFromPost($extralabels, '', 'search_'); |
||
| 102 | |||
| 103 | // List of fields to search into when doing a "search in all" |
||
| 104 | $fieldstosearchall = array( |
||
| 105 | 't.ref' => 'Ref', |
||
| 106 | 't.note_public' => 'NotePublic', |
||
| 107 | ); |
||
| 108 | if (empty($user->socid)) { |
||
| 109 | $fieldstosearchall["t.note_private"] = "NotePrivate"; |
||
| 110 | } |
||
| 111 | |||
| 112 | // Definition of fields for list |
||
| 113 | $arrayfields = array( |
||
| 114 | |||
| 115 | 't.idBBC_vols' => array('label' => $langs->trans("FieldidBBC_vols"), 'checked' => 1), |
||
| 116 | 't.date' => array('label' => $langs->trans("FieldDate"), 'checked' => 1), |
||
| 117 | 't.lieuD' => array('label' => $langs->trans("FieldlieuD"), 'checked' => 1), |
||
| 118 | 't.lieuA' => array('label' => $langs->trans("FieldlieuA"), 'checked' => 1), |
||
| 119 | 't.heureD' => array('label' => $langs->trans("FieldheureD"), 'checked' => 1), |
||
| 120 | 't.heureA' => array('label' => $langs->trans("FieldheureA"), 'checked' => 1), |
||
| 121 | 't.BBC_ballons_idBBC_ballons' => array('label' => $langs->trans("FieldBBC_ballons_idBBC_ballons"), 'checked' => 1), |
||
| 122 | 't.nbrPax' => array('label' => $langs->trans("FieldnbrPax"), 'checked' => 1), |
||
| 123 | //'t.remarque' => array('label' => $langs->trans("Fieldremarque"), 'checked' => 1), |
||
| 124 | //'t.incidents' => array('label' => $langs->trans("Fieldincidents"), 'checked' => 1), |
||
| 125 | 't.fk_type' => array('label' => $langs->trans("Fieldfk_type"), 'checked' => 1), |
||
| 126 | 't.fk_pilot' => array('label' => $langs->trans("Fieldfk_pilot"), 'checked' => 1), |
||
| 127 | 't.fk_organisateur' => array('label' => $langs->trans("Fieldfk_organisateur"), 'checked' => 1), |
||
| 128 | 't.is_facture' => array('label' => $langs->trans("Fieldis_facture"), 'checked' => 1), |
||
| 129 | 't.kilometers' => array('label' => $langs->trans("Fieldkilometers"), 'checked' => 0), |
||
| 130 | 't.cost' => array('label' => $langs->trans("Fieldcost"), 'checked' => 0), |
||
| 131 | //'t.fk_receiver' => array('label' => $langs->trans("Fieldfk_receiver"), 'checked' => 1), |
||
| 132 | //'t.justif_kilometers' => array('label' => $langs->trans("Fieldjustif_kilometers"), 'checked' => 1), |
||
| 133 | //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), |
||
| 134 | 't.datec' => array('label' => $langs->trans("DateCreationShort"), |
||
| 135 | 'checked' => 0, |
||
| 136 | 'position' => 500 |
||
| 137 | ), |
||
| 138 | 't.tms' => array('label' => $langs->trans("DateModificationShort"), |
||
| 139 | 'checked' => 0, |
||
| 140 | 'position' => 500 |
||
| 141 | ), |
||
| 142 | //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), |
||
| 143 | ); |
||
| 144 | // Extra fields |
||
| 145 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { |
||
| 146 | foreach ($extrafields->attribute_label as $key => $val) { |
||
| 147 | $arrayfields["ef." . $key] = array('label' => $extrafields->attribute_label[$key], |
||
| 148 | 'checked' => $extrafields->attribute_list[$key], |
||
| 149 | 'position' => $extrafields->attribute_pos[$key], |
||
| 150 | 'enabled' => $extrafields->attribute_perms[$key] |
||
| 151 | ); |
||
| 152 | } |
||
| 153 | } |
||
| 154 | |||
| 155 | |||
| 156 | // Load object if id or ref is provided as parameter |
||
| 157 | $object = new Bbcvols($db); |
||
| 158 | View Code Duplication | if (($id > 0 || !empty($ref)) && $action != 'add') { |
|
| 159 | $result = $object->fetch($id, $ref); |
||
| 160 | if ($result < 0) { |
||
| 161 | dol_print_error($db); |
||
| 162 | } |
||
| 163 | } |
||
| 164 | |||
| 165 | |||
| 166 | /******************************************************************* |
||
| 167 | * ACTIONS |
||
| 168 | * |
||
| 169 | * Put here all code to do according to value of "action" parameter |
||
| 170 | ********************************************************************/ |
||
| 171 | |||
| 172 | if (GETPOST('cancel')) { |
||
| 173 | $action = 'list'; |
||
| 174 | $massaction = ''; |
||
| 175 | } |
||
| 176 | if (!GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { |
||
| 177 | $massaction = ''; |
||
| 178 | } |
||
| 179 | |||
| 180 | $parameters = array(); |
||
| 181 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, |
||
| 182 | $action); // Note that $action and $object may have been modified by some hooks |
||
| 183 | if ($reshook < 0) { |
||
| 184 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
||
| 185 | } |
||
| 186 | |||
| 187 | if (empty($reshook)) { |
||
| 188 | // Selection of new fields |
||
| 189 | include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; |
||
| 190 | |||
| 191 | // Purge search criteria |
||
| 192 | if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers |
||
| 193 | { |
||
| 194 | |||
| 195 | $search_idBBC_vols = ''; |
||
| 196 | $search_date = ''; |
||
| 197 | $search_lieuD = ''; |
||
| 198 | $search_lieuA = ''; |
||
| 199 | $search_heureD = ''; |
||
| 200 | $search_heureA = ''; |
||
| 201 | $search_BBC_ballons_idBBC_ballons = ''; |
||
| 202 | $search_nbrPax = ''; |
||
| 203 | $search_remarque = ''; |
||
| 204 | $search_incidents = ''; |
||
| 205 | $search_fk_type = ''; |
||
| 206 | $search_fk_pilot = ''; |
||
| 207 | $search_fk_organisateur = ''; |
||
| 208 | $search_is_facture = -1; |
||
| 209 | $search_kilometers = ''; |
||
| 210 | $search_cost = ''; |
||
| 211 | $search_fk_receiver = ''; |
||
| 212 | $search_justif_kilometers = ''; |
||
| 213 | |||
| 214 | |||
| 215 | $search_date_creation = ''; |
||
| 216 | $search_date_update = ''; |
||
| 217 | $toselect = ''; |
||
| 218 | $search_array_options = array(); |
||
| 219 | } |
||
| 220 | |||
| 221 | // Mass actions |
||
| 222 | $objectclass = 'BbcVols'; |
||
| 223 | $objectlabel = 'Vol'; |
||
| 224 | $permtoread = $user->rights->bbcvols->read; |
||
| 225 | $permtodelete = $user->rights->bbcvols->delete; |
||
| 226 | $uploaddir = $conf->bbcvols->dir_output; |
||
| 227 | } |
||
| 228 | |||
| 229 | |||
| 230 | /*************************************************** |
||
| 231 | * VIEW |
||
| 232 | * |
||
| 233 | * Put here all code to build page |
||
| 234 | ****************************************************/ |
||
| 235 | |||
| 236 | $now = dol_now(); |
||
| 237 | |||
| 238 | $form = new Form($db); |
||
| 239 | |||
| 240 | //$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; |
||
| 241 | $help_url = ''; |
||
| 242 | $title = $langs->trans('MyModuleListTitle'); |
||
| 243 | |||
| 244 | // Put here content of your page |
||
| 245 | |||
| 246 | |||
| 247 | $sql = "SELECT"; |
||
| 248 | $sql .= " t.idBBC_vols,"; |
||
| 249 | $sql .= " t.date,"; |
||
| 250 | $sql .= " t.lieuD,"; |
||
| 251 | $sql .= " t.lieuA,"; |
||
| 252 | $sql .= " t.heureD,"; |
||
| 253 | $sql .= " t.heureA,"; |
||
| 254 | $sql .= " t.BBC_ballons_idBBC_ballons,"; |
||
| 255 | $sql .= " t.nbrPax,"; |
||
| 256 | $sql .= " t.remarque,"; |
||
| 257 | $sql .= " t.incidents,"; |
||
| 258 | $sql .= " t.fk_type,"; |
||
| 259 | $sql .= " t.fk_pilot,"; |
||
| 260 | $sql .= " t.fk_organisateur,"; |
||
| 261 | $sql .= " t.is_facture,"; |
||
| 262 | $sql .= " t.kilometers,"; |
||
| 263 | $sql .= " t.cost,"; |
||
| 264 | $sql .= " t.fk_receiver,"; |
||
| 265 | $sql .= " t.justif_kilometers, "; |
||
| 266 | $sql .= " balloon.immat as bal, "; |
||
| 267 | $sql .= " CONCAT_WS(' ', 'T', flightType.numero,'-', flightType.nom) as flight_type, "; |
||
| 268 | $sql .= " CONCAT_WS(' ', pilot.firstname, pilot.lastname) as pilot, "; |
||
| 269 | $sql .= " CONCAT_WS(' ', organisator.firstname, organisator.lastname) as organisator, "; |
||
| 270 | $sql .= " CONCAT_WS(' ', receiver.firstname , receiver.lastname) as receiver"; |
||
| 271 | |||
| 272 | // Add fields from extrafields |
||
| 273 | foreach ($extrafields->attribute_label as $key => $val) { |
||
| 274 | $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef." . $key . ' as options_' . $key : ''); |
||
| 275 | } |
||
| 276 | // Add fields from hooks |
||
| 277 | $parameters = array(); |
||
| 278 | $reshook = $hookmanager->executeHooks('printFieldListSelect', |
||
| 279 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 280 | $sql .= $hookmanager->resPrint; |
||
| 281 | $sql .= " FROM " . MAIN_DB_PREFIX . "bbc_vols as t"; |
||
| 282 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { |
||
| 283 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bbc_vols_extrafields as ef on (t.rowid = ef.fk_object)"; |
||
| 284 | } |
||
| 285 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bbc_ballons as balloon on (t.BBC_ballons_idBBC_ballons = balloon.rowid)'; |
||
| 286 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bbc_types as flightType on (t.fk_type = flightType.idType)'; |
||
| 287 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user as pilot on (t.fk_pilot = pilot.rowid)'; |
||
| 288 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user as organisator on (t.fk_organisateur = organisator.rowid)'; |
||
| 289 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user as receiver on (t.fk_receiver = receiver.rowid)'; |
||
| 290 | |||
| 291 | $sql .= " WHERE 1 = 1"; |
||
| 292 | |||
| 293 | if($search_all){ |
||
| 294 | $sql .= natural_search(["idBBC_vols", "lieuD", "lieuA", "pilot.lastname", "pilot.firstname", "balloon.immat"], $search_all); |
||
| 295 | } |
||
| 296 | |||
| 297 | if ($search_idBBC_vols) { |
||
| 298 | $sql .= natural_search("idBBC_vols", $search_idBBC_vols); |
||
| 299 | } |
||
| 300 | if ($search_date) { |
||
| 301 | $sql .= natural_search("date", $search_date); |
||
| 302 | } |
||
| 303 | if ($search_lieuD) { |
||
| 304 | $sql .= natural_search("lieuD", $search_lieuD); |
||
| 305 | } |
||
| 306 | if ($search_lieuA) { |
||
| 307 | $sql .= natural_search("lieuA", $search_lieuA); |
||
| 308 | } |
||
| 309 | if ($search_heureD) { |
||
| 310 | $sql .= natural_search("heureD", $search_heureD); |
||
| 311 | } |
||
| 312 | if ($search_heureA) { |
||
| 313 | $sql .= natural_search("heureA", $search_heureA); |
||
| 314 | } |
||
| 315 | if ($search_BBC_ballons_idBBC_ballons) { |
||
| 316 | $sql .= natural_search("BBC_ballons_idBBC_ballons", $search_BBC_ballons_idBBC_ballons); |
||
| 317 | } |
||
| 318 | if ($search_nbrPax) { |
||
| 319 | $sql .= natural_search("nbrPax", $search_nbrPax, 1); |
||
| 320 | } |
||
| 321 | if ($search_remarque) { |
||
| 322 | $sql .= natural_search("remarque", $search_remarque); |
||
| 323 | } |
||
| 324 | if ($search_incidents) { |
||
| 325 | $sql .= natural_search("incidents", $search_incidents); |
||
| 326 | } |
||
| 327 | if ($search_fk_type) { |
||
| 328 | $sql .= natural_search("fk_type", $search_fk_type); |
||
| 329 | } |
||
| 330 | if ($search_fk_pilot && $search_fk_pilot != -1) { |
||
| 331 | $sql .= natural_search("fk_pilot", $search_fk_pilot, 2); |
||
| 332 | } |
||
| 333 | if ($search_fk_organisateur && $search_fk_organisateur != -1) { |
||
| 334 | $sql .= natural_search("fk_organisateur", $search_fk_organisateur); |
||
| 335 | } |
||
| 336 | |||
| 337 | if ($search_is_facture != -1) { |
||
| 338 | $sql .= natural_search("is_facture", $search_is_facture,1); |
||
| 339 | } |
||
| 340 | if ($search_kilometers) { |
||
| 341 | $sql .= natural_search("kilometers", $search_kilometers, 1); |
||
| 342 | } |
||
| 343 | if ($search_cost) { |
||
| 344 | $sql .= natural_search("cost", $search_cost, 1); |
||
| 345 | } |
||
| 346 | if ($search_fk_receiver) { |
||
| 347 | $sql .= natural_search("fk_receiver", $search_fk_receiver); |
||
| 348 | } |
||
| 349 | if ($search_justif_kilometers) { |
||
| 350 | $sql .= natural_search("justif_kilometers", $search_justif_kilometers); |
||
| 351 | } |
||
| 352 | |||
| 353 | |||
| 354 | if ($sall) { |
||
| 355 | $sql .= natural_search(array_keys($fieldstosearchall), $sall); |
||
| 356 | } |
||
| 357 | // Add where from extra fields |
||
| 358 | foreach ($search_array_options as $key => $val) { |
||
| 359 | $crit = $val; |
||
| 360 | $tmpkey = preg_replace('/search_options_/', '', $key); |
||
| 361 | $typ = $extrafields->attribute_type[$tmpkey]; |
||
| 362 | $mode = 0; |
||
| 363 | if (in_array($typ, array('int', 'double'))) { |
||
| 364 | $mode = 1; |
||
| 365 | } // Search on a numeric |
||
| 366 | if ($val && (($crit != '' && !in_array($typ, array('select'))) || !empty($crit))) { |
||
| 367 | $sql .= natural_search('ef.' . $tmpkey, $crit, $mode); |
||
| 368 | } |
||
| 369 | } |
||
| 370 | // Add where from hooks |
||
| 371 | $parameters = array(); |
||
| 372 | $reshook = $hookmanager->executeHooks('printFieldListWhere', |
||
| 373 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 374 | $sql .= $hookmanager->resPrint; |
||
| 375 | $sql .= $db->order($sortfield, $sortorder); |
||
| 376 | //$sql.= $db->plimit($conf->liste_limit+1, $offset); |
||
| 377 | |||
| 378 | // Count total nb of records |
||
| 379 | $nbtotalofrecords = ''; |
||
| 380 | if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { |
||
| 381 | $result = $db->query($sql); |
||
| 382 | $nbtotalofrecords = $db->num_rows($result); |
||
| 383 | } |
||
| 384 | |||
| 385 | $sql .= $db->plimit($limit + 1, $offset); |
||
| 386 | |||
| 387 | dol_syslog($script_file, LOG_DEBUG); |
||
| 388 | $resql = $db->query($sql); |
||
| 389 | if (!$resql) { |
||
| 390 | dol_print_error($db); |
||
| 391 | exit; |
||
| 392 | } |
||
| 393 | |||
| 394 | $num = $db->num_rows($resql); |
||
| 395 | |||
| 396 | // Direct jump if only one record found |
||
| 397 | if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { |
||
| 398 | $obj = $db->fetch_object($resql); |
||
| 399 | $id = $obj->idBBC_vols; |
||
| 400 | header("Location: " . DOL_URL_ROOT . '/flightlog/card.php?id=' . $id); |
||
| 401 | exit; |
||
| 402 | } |
||
| 403 | |||
| 404 | llxHeader('', $title, $help_url); |
||
| 405 | |||
| 406 | $arrayofselected = is_array($toselect) ? $toselect : array(); |
||
| 407 | |||
| 408 | $param = ''; |
||
| 409 | if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
||
| 410 | $param .= '&contextpage=' . $contextpage; |
||
| 411 | } |
||
| 412 | if ($limit > 0 && $limit != $conf->liste_limit) { |
||
| 413 | $param .= '&limit=' . $limit; |
||
| 414 | } |
||
| 415 | if ($search_idBBC_vols != '') { |
||
| 416 | $param .= '&search_idBBC_vols=' . urlencode($search_idBBC_vols); |
||
| 417 | } |
||
| 418 | if ($search_date != '') { |
||
| 419 | $param .= '&search_date=' . urlencode($search_date); |
||
| 420 | } |
||
| 421 | if ($search_lieuD != '') { |
||
| 422 | $param .= '&search_lieuD=' . urlencode($search_lieuD); |
||
| 423 | } |
||
| 424 | if ($search_lieuA != '') { |
||
| 425 | $param .= '&search_lieuA=' . urlencode($search_lieuA); |
||
| 426 | } |
||
| 427 | if ($search_heureD != '') { |
||
| 428 | $param .= '&search_heureD=' . urlencode($search_heureD); |
||
| 429 | } |
||
| 430 | if ($search_heureA != '') { |
||
| 431 | $param .= '&search_heureA=' . urlencode($search_heureA); |
||
| 432 | } |
||
| 433 | if ($search_BBC_ballons_idBBC_ballons != '') { |
||
| 434 | $param .= '&search_BBC_ballons_idBBC_ballons=' . urlencode($search_BBC_ballons_idBBC_ballons); |
||
| 435 | } |
||
| 436 | if ($search_nbrPax != '') { |
||
| 437 | $param .= '&search_nbrPax=' . urlencode($search_nbrPax); |
||
| 438 | } |
||
| 439 | if ($search_remarque != '') { |
||
| 440 | $param .= '&search_remarque=' . urlencode($search_remarque); |
||
| 441 | } |
||
| 442 | if ($search_incidents != '') { |
||
| 443 | $param .= '&search_incidents=' . urlencode($search_incidents); |
||
| 444 | } |
||
| 445 | if ($search_fk_type != '') { |
||
| 446 | $param .= '&search_fk_type=' . urlencode($search_fk_type); |
||
| 447 | } |
||
| 448 | if ($search_fk_pilot != '') { |
||
| 449 | $param .= '&search_fk_pilot=' . urlencode($search_fk_pilot); |
||
| 450 | } |
||
| 451 | if ($search_fk_organisateur != '') { |
||
| 452 | $param .= '&search_fk_organisateur=' . urlencode($search_fk_organisateur); |
||
| 453 | } |
||
| 454 | if ($search_is_facture != -1) { |
||
| 455 | $param .= '&search_is_facture=' . urlencode($search_is_facture); |
||
| 456 | } |
||
| 457 | if ($search_kilometers != '') { |
||
| 458 | $param .= '&search_kilometers=' . urlencode($search_kilometers); |
||
| 459 | } |
||
| 460 | if ($search_cost != '') { |
||
| 461 | $param .= '&search_cost=' . urlencode($search_cost); |
||
| 462 | } |
||
| 463 | if ($search_fk_receiver != '') { |
||
| 464 | $param .= '&search_fk_receiver=' . urlencode($search_fk_receiver); |
||
| 465 | } |
||
| 466 | if ($search_justif_kilometers != '') { |
||
| 467 | $param .= '&search_justif_kilometers=' . urlencode($search_justif_kilometers); |
||
| 468 | } |
||
| 469 | if ($search_all != '') { |
||
| 470 | $param .= '&sall=' . urlencode($search_all); |
||
| 471 | } |
||
| 472 | |||
| 473 | if ($optioncss != '') { |
||
| 474 | $param .= '&optioncss=' . $optioncss; |
||
| 475 | } |
||
| 476 | // Add $param from extra fields |
||
| 477 | foreach ($search_array_options as $key => $val) { |
||
| 478 | $crit = $val; |
||
| 479 | $tmpkey = preg_replace('/search_options_/', '', $key); |
||
| 480 | if ($val != '') { |
||
| 481 | $param .= '&search_options_' . $tmpkey . '=' . urlencode($val); |
||
| 482 | } |
||
| 483 | } |
||
| 484 | |||
| 485 | $arrayofmassactions = array( |
||
| 486 | 'presend' => $langs->trans("SendByMail"), |
||
| 487 | 'builddoc' => $langs->trans("PDFMerge"), |
||
| 488 | ); |
||
| 489 | if ($user->rights->flightlog->supprimer) { |
||
| 490 | $arrayofmassactions['delete'] = $langs->trans("Delete"); |
||
| 491 | } |
||
| 492 | if ($massaction == 'presend') { |
||
| 493 | $arrayofmassactions = array(); |
||
| 494 | } |
||
| 495 | $massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
||
| 496 | |||
| 497 | print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">'; |
||
| 498 | if ($optioncss != '') { |
||
| 499 | print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
||
| 500 | } |
||
| 501 | print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
||
| 502 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
||
| 503 | print '<input type="hidden" name="action" value="list">'; |
||
| 504 | print '<input type="hidden" name="sortfield" value="' . $sortfield . '">'; |
||
| 505 | print '<input type="hidden" name="sortorder" value="' . $sortorder . '">'; |
||
| 506 | print '<input type="hidden" name="contextpage" value="' . $contextpage . '">'; |
||
| 507 | |||
| 508 | |||
| 509 | $moreHtml = ""; |
||
| 510 | if($search_all !== ""){ |
||
| 511 | $moreHtml = "<p>".$langs->trans(sprintf("La liste est en recherche globale sur : l'identifiant du vol, le nom du pilote, l'immat du ballon, le lieu de Décollage et le lieu d'atterissage : %s", $search_all))."</p>"; |
||
| 512 | } |
||
| 513 | |||
| 514 | print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, |
||
| 515 | 'title_companies', 0, "", '', $limit); |
||
| 516 | echo $moreHtml; |
||
| 517 | if ($sall) { |
||
| 518 | foreach ($fieldstosearchall as $key => $val) { |
||
| 519 | $fieldstosearchall[$key] = $langs->trans($val); |
||
| 520 | } |
||
| 521 | print $langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall); |
||
| 522 | } |
||
| 523 | |||
| 524 | $moreforfilter = ''; |
||
| 525 | $moreforfilter .= '<div class="divsearchfield">'; |
||
| 526 | //$moreforfilter .= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="' . dol_escape_htmltag($search_myfield) . '">'; |
||
| 527 | $moreforfilter .= '</div>'; |
||
| 528 | |||
| 529 | $parameters = array(); |
||
| 530 | $reshook = $hookmanager->executeHooks('printFieldPreListTitle', |
||
| 531 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 532 | if (empty($reshook)) { |
||
| 533 | $moreforfilter .= $hookmanager->resPrint; |
||
| 534 | } else { |
||
| 535 | $moreforfilter = $hookmanager->resPrint; |
||
| 536 | } |
||
| 537 | |||
| 538 | if (!empty($moreforfilter)) { |
||
| 539 | print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
||
| 540 | print $moreforfilter; |
||
| 541 | print '</div>'; |
||
| 542 | } |
||
| 543 | |||
| 544 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
||
| 545 | $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, |
||
| 546 | $varpage); // This also change content of $arrayfields |
||
| 547 | |||
| 548 | print '<div class="div-table-responsive">'; |
||
| 549 | print '<table class="tagtable liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n"; |
||
| 550 | |||
| 551 | // Fields title |
||
| 552 | print '<tr class="liste_titre">'; |
||
| 553 | // |
||
| 554 | View Code Duplication | if (!empty($arrayfields['t.idBBC_vols']['checked'])) { |
|
| 555 | print_liste_field_titre($arrayfields['t.idBBC_vols']['label'], $_SERVER['PHP_SELF'], 't.idBBC_vols', '', $params, |
||
| 556 | '', $sortfield, $sortorder); |
||
| 557 | } |
||
| 558 | View Code Duplication | if (!empty($arrayfields['t.date']['checked'])) { |
|
| 559 | print_liste_field_titre($arrayfields['t.date']['label'], $_SERVER['PHP_SELF'], 't.date', '', $params, |
||
| 560 | '', $sortfield, $sortorder); |
||
| 561 | } |
||
| 562 | View Code Duplication | if (!empty($arrayfields['t.lieuD']['checked'])) { |
|
| 563 | print_liste_field_titre($arrayfields['t.lieuD']['label'], $_SERVER['PHP_SELF'], 't.lieuD', '', $params, '', |
||
| 564 | $sortfield, $sortorder); |
||
| 565 | } |
||
| 566 | View Code Duplication | if (!empty($arrayfields['t.lieuA']['checked'])) { |
|
| 567 | print_liste_field_titre($arrayfields['t.lieuA']['label'], $_SERVER['PHP_SELF'], 't.lieuA', '', $params, '', |
||
| 568 | $sortfield, $sortorder); |
||
| 569 | } |
||
| 570 | View Code Duplication | if (!empty($arrayfields['t.heureD']['checked'])) { |
|
| 571 | print_liste_field_titre($arrayfields['t.heureD']['label'], $_SERVER['PHP_SELF'], 't.heureD', '', $params, '', |
||
| 572 | $sortfield, $sortorder); |
||
| 573 | } |
||
| 574 | View Code Duplication | if (!empty($arrayfields['t.heureA']['checked'])) { |
|
| 575 | print_liste_field_titre($arrayfields['t.heureA']['label'], $_SERVER['PHP_SELF'], 't.heureA', '', $params, '', |
||
| 576 | $sortfield, $sortorder); |
||
| 577 | } |
||
| 578 | View Code Duplication | if (!empty($arrayfields['t.BBC_ballons_idBBC_ballons']['checked'])) { |
|
| 579 | print_liste_field_titre($arrayfields['t.BBC_ballons_idBBC_ballons']['label'], $_SERVER['PHP_SELF'], |
||
| 580 | 't.BBC_ballons_idBBC_ballons', '', $params, '', $sortfield, $sortorder); |
||
| 581 | } |
||
| 582 | View Code Duplication | if (!empty($arrayfields['t.nbrPax']['checked'])) { |
|
| 583 | print_liste_field_titre($arrayfields['t.nbrPax']['label'], $_SERVER['PHP_SELF'], 't.nbrPax', '', $params, '', |
||
| 584 | $sortfield, $sortorder); |
||
| 585 | } |
||
| 586 | /*if (!empty($arrayfields['t.remarque']['checked'])) { |
||
| 587 | print_liste_field_titre($arrayfields['t.remarque']['label'], $_SERVER['PHP_SELF'], 't.remarque', '', $params, '', |
||
| 588 | $sortfield, $sortorder); |
||
| 589 | } |
||
| 590 | if (!empty($arrayfields['t.incidents']['checked'])) { |
||
| 591 | print_liste_field_titre($arrayfields['t.incidents']['label'], $_SERVER['PHP_SELF'], 't.incidents', '', $params, '', |
||
| 592 | $sortfield, $sortorder); |
||
| 593 | }*/ |
||
| 594 | View Code Duplication | if (!empty($arrayfields['t.fk_type']['checked'])) { |
|
| 595 | print_liste_field_titre($arrayfields['t.fk_type']['label'], $_SERVER['PHP_SELF'], 't.fk_type', '', $params, '', |
||
| 596 | $sortfield, $sortorder); |
||
| 597 | } |
||
| 598 | View Code Duplication | if (!empty($arrayfields['t.fk_pilot']['checked'])) { |
|
| 599 | print_liste_field_titre($arrayfields['t.fk_pilot']['label'], $_SERVER['PHP_SELF'], 't.fk_pilot', '', $params, '', |
||
| 600 | $sortfield, $sortorder); |
||
| 601 | } |
||
| 602 | View Code Duplication | if (!empty($arrayfields['t.fk_organisateur']['checked'])) { |
|
| 603 | print_liste_field_titre($arrayfields['t.fk_organisateur']['label'], $_SERVER['PHP_SELF'], 't.fk_organisateur', '', |
||
| 604 | $params, '', $sortfield, $sortorder); |
||
| 605 | } |
||
| 606 | |||
| 607 | View Code Duplication | if (!empty($arrayfields['t.is_facture']['checked'])) { |
|
| 608 | print_liste_field_titre($arrayfields['t.is_facture']['label'], $_SERVER['PHP_SELF'], 't.is_facture', '', $params, |
||
| 609 | '', $sortfield, $sortorder); |
||
| 610 | } |
||
| 611 | View Code Duplication | if (!empty($arrayfields['t.kilometers']['checked'])) { |
|
| 612 | print_liste_field_titre($arrayfields['t.kilometers']['label'], $_SERVER['PHP_SELF'], 't.kilometers', '', $params, |
||
| 613 | '', $sortfield, $sortorder); |
||
| 614 | } |
||
| 615 | View Code Duplication | if (!empty($arrayfields['t.cost']['checked'])) { |
|
| 616 | print_liste_field_titre($arrayfields['t.cost']['label'], $_SERVER['PHP_SELF'], 't.cost', '', $params, '', |
||
| 617 | $sortfield, $sortorder); |
||
| 618 | } |
||
| 619 | /* |
||
| 620 | if (!empty($arrayfields['t.fk_receiver']['checked'])) { |
||
| 621 | print_liste_field_titre($arrayfields['t.fk_receiver']['label'], $_SERVER['PHP_SELF'], 't.fk_receiver', '', $params, |
||
| 622 | '', $sortfield, $sortorder); |
||
| 623 | } |
||
| 624 | if (!empty($arrayfields['t.justif_kilometers']['checked'])) { |
||
| 625 | print_liste_field_titre($arrayfields['t.justif_kilometers']['label'], $_SERVER['PHP_SELF'], 't.justif_kilometers', |
||
| 626 | '', $params, '', $sortfield, $sortorder); |
||
| 627 | }*/ |
||
| 628 | |||
| 629 | // Extra fields |
||
| 630 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { |
||
| 631 | foreach ($extrafields->attribute_label as $key => $val) { |
||
| 632 | if (!empty($arrayfields["ef." . $key]['checked'])) { |
||
| 633 | $align = $extrafields->getAlignFlag($key); |
||
| 634 | print_liste_field_titre($extralabels[$key], $_SERVER["PHP_SELF"], "ef." . $key, "", $param, |
||
| 635 | ($align ? 'align="' . $align . '"' : ''), $sortfield, $sortorder); |
||
| 636 | } |
||
| 637 | } |
||
| 638 | } |
||
| 639 | // Hook fields |
||
| 640 | $parameters = array('arrayfields' => $arrayfields); |
||
| 641 | $reshook = $hookmanager->executeHooks('printFieldListTitle', |
||
| 642 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 643 | print $hookmanager->resPrint; |
||
| 644 | View Code Duplication | if (!empty($arrayfields['t.datec']['checked'])) { |
|
| 645 | print_liste_field_titre($arrayfields['t.datec']['label'], $_SERVER["PHP_SELF"], "t.datec", "", $param, |
||
| 646 | 'align="center" class="nowrap"', $sortfield, $sortorder); |
||
| 647 | } |
||
| 648 | View Code Duplication | if (!empty($arrayfields['t.tms']['checked'])) { |
|
| 649 | print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER["PHP_SELF"], "t.tms", "", $param, |
||
| 650 | 'align="center" class="nowrap"', $sortfield, $sortorder); |
||
| 651 | } |
||
| 652 | //if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder); |
||
| 653 | print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="right"', $sortfield, $sortorder, |
||
| 654 | 'maxwidthsearch '); |
||
| 655 | print '</tr>' . "\n"; |
||
| 656 | |||
| 657 | // Fields title search |
||
| 658 | print '<tr class="liste_titre">'; |
||
| 659 | // |
||
| 660 | if (!empty($arrayfields['t.idBBC_vols']['checked'])) { |
||
| 661 | print '<td class="liste_titre"><input type="text" class="flat" name="search_idBBC_vols" value="' . $search_idBBC_vols . '" size="10"></td>'; |
||
| 662 | } |
||
| 663 | if (!empty($arrayfields['t.date']['checked'])) { |
||
| 664 | print '<td class="liste_titre"><input type="text" class="flat" name="search_date" value="' . $search_date . '" size="10"></td>'; |
||
| 665 | } |
||
| 666 | if (!empty($arrayfields['t.lieuD']['checked'])) { |
||
| 667 | print '<td class="liste_titre"><input type="text" class="flat" name="search_lieuD" value="' . $search_lieuD . '" size="10"></td>'; |
||
| 668 | } |
||
| 669 | if (!empty($arrayfields['t.lieuA']['checked'])) { |
||
| 670 | print '<td class="liste_titre"><input type="text" class="flat" name="search_lieuA" value="' . $search_lieuA . '" size="10"></td>'; |
||
| 671 | } |
||
| 672 | if (!empty($arrayfields['t.heureD']['checked'])) { |
||
| 673 | print '<td class="liste_titre"><input type="text" class="flat" name="search_heureD" value="' . $search_heureD . '" size="10"></td>'; |
||
| 674 | } |
||
| 675 | if (!empty($arrayfields['t.heureA']['checked'])) { |
||
| 676 | print '<td class="liste_titre"><input type="text" class="flat" name="search_heureA" value="' . $search_heureA . '" size="10"></td>'; |
||
| 677 | } |
||
| 678 | if (!empty($arrayfields['t.BBC_ballons_idBBC_ballons']['checked'])) { |
||
| 679 | |||
| 680 | print '<td class="liste_titre">'; |
||
| 681 | select_balloons($search_BBC_ballons_idBBC_ballons, "search_BBC_ballons_idBBC_ballons"); |
||
| 682 | print '</td>'; |
||
| 683 | } |
||
| 684 | if (!empty($arrayfields['t.nbrPax']['checked'])) { |
||
| 685 | print '<td class="liste_titre"><input type="text" class="flat" name="search_nbrPax" value="' . $search_nbrPax . '" size="10"></td>'; |
||
| 686 | } |
||
| 687 | /*if (!empty($arrayfields['t.remarque']['checked'])) { |
||
| 688 | print '<td class="liste_titre"><input type="text" class="flat" name="search_remarque" value="' . $search_remarque . '" size="10"></td>'; |
||
| 689 | } |
||
| 690 | if (!empty($arrayfields['t.incidents']['checked'])) { |
||
| 691 | print '<td class="liste_titre"><input type="text" class="flat" name="search_incidents" value="' . $search_incidents . '" size="10"></td>'; |
||
| 692 | }*/ |
||
| 693 | if (!empty($arrayfields['t.fk_type']['checked'])) { |
||
| 694 | print '<td class="liste_titre fk_type">'; |
||
| 695 | select_flight_type($search_fk_type, 'search_fk_type', true); |
||
|
0 ignored issues
–
show
|
|||
| 696 | print '</td>'; |
||
| 697 | } |
||
| 698 | View Code Duplication | if (!empty($arrayfields['t.fk_pilot']['checked'])) { |
|
| 699 | print '<td class="liste_titre">'; |
||
| 700 | print $form->select_dolusers($search_fk_pilot, "search_fk_pilot", true, null, 0, '', '', 0,0,0,'',0,'','', true); |
||
| 701 | print '</td>'; |
||
| 702 | } |
||
| 703 | View Code Duplication | if (!empty($arrayfields['t.fk_organisateur']['checked'])) { |
|
| 704 | print '<td class="liste_titre">'; |
||
| 705 | print $form->select_dolusers($search_fk_organisateur, "search_fk_organisateur", true, null, 0, '', '', 0,0,0,'',0,'','', true); |
||
| 706 | print '</td>'; |
||
| 707 | } |
||
| 708 | |||
| 709 | if (!empty($arrayfields['t.is_facture']['checked'])) { |
||
| 710 | print '<td class="liste_titre">'; |
||
| 711 | print '<select name="search_is_facture"><option value="-1" '.($search_is_facture != 1 && $search_is_facture != 0 && $search_is_facture != '<=0'? 'selected' : '' ).'></option><option value="1" '.($search_is_facture == 1 ? 'selected' : '' ).'>Facturé</option><option value="0" '.($search_is_facture == 0 || $search_is_facture == '<=0' ? 'selected' : '' ).'>Ouvert</option></select>'; |
||
| 712 | print '</td>'; |
||
| 713 | } |
||
| 714 | |||
| 715 | if (!empty($arrayfields['t.kilometers']['checked'])) { |
||
| 716 | print '<td class="liste_titre"><input type="text" class="flat" name="search_kilometers" value="' . $search_kilometers . '" size="10"></td>'; |
||
| 717 | } |
||
| 718 | if (!empty($arrayfields['t.cost']['checked'])) { |
||
| 719 | print '<td class="liste_titre"><input type="text" class="flat" name="search_cost" value="' . $search_cost . '" size="10"></td>'; |
||
| 720 | } |
||
| 721 | /*if (!empty($arrayfields['t.fk_receiver']['checked'])) { |
||
| 722 | print '<td class="liste_titre"><input type="text" class="flat" name="search_fk_receiver" value="' . $search_fk_receiver . '" size="10"></td>'; |
||
| 723 | } |
||
| 724 | if (!empty($arrayfields['t.justif_kilometers']['checked'])) { |
||
| 725 | print '<td class="liste_titre"><input type="text" class="flat" name="search_justif_kilometers" value="' . $search_justif_kilometers . '" size="10"></td>'; |
||
| 726 | }*/ |
||
| 727 | |||
| 728 | // Extra fields |
||
| 729 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { |
||
| 730 | foreach ($extrafields->attribute_label as $key => $val) { |
||
| 731 | if (!empty($arrayfields["ef." . $key]['checked'])) { |
||
| 732 | $align = $extrafields->getAlignFlag($key); |
||
| 733 | $typeofextrafield = $extrafields->attribute_type[$key]; |
||
| 734 | print '<td class="liste_titre' . ($align ? ' ' . $align : '') . '">'; |
||
| 735 | if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) { |
||
| 736 | $crit = $val; |
||
| 737 | $tmpkey = preg_replace('/search_options_/', '', $key); |
||
| 738 | $searchclass = ''; |
||
| 739 | if (in_array($typeofextrafield, array('varchar', 'select'))) { |
||
| 740 | $searchclass = 'searchstring'; |
||
| 741 | } |
||
| 742 | if (in_array($typeofextrafield, array('int', 'double'))) { |
||
| 743 | $searchclass = 'searchnum'; |
||
| 744 | } |
||
| 745 | print '<input class="flat' . ($searchclass ? ' ' . $searchclass : '') . '" size="4" type="text" name="search_options_' . $tmpkey . '" value="' . dol_escape_htmltag($search_array_options['search_options_' . $tmpkey]) . '">'; |
||
| 746 | } |
||
| 747 | print '</td>'; |
||
| 748 | } |
||
| 749 | } |
||
| 750 | } |
||
| 751 | |||
| 752 | |||
| 753 | // Fields from hook |
||
| 754 | $parameters = array('arrayfields' => $arrayfields); |
||
| 755 | $reshook = $hookmanager->executeHooks('printFieldListOption', |
||
| 756 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 757 | print $hookmanager->resPrint; |
||
| 758 | if (!empty($arrayfields['t.datec']['checked'])) { |
||
| 759 | // Date creation |
||
| 760 | print '<td class="liste_titre">'; |
||
| 761 | print '</td>'; |
||
| 762 | } |
||
| 763 | if (!empty($arrayfields['t.tms']['checked'])) { |
||
| 764 | // Date modification |
||
| 765 | print '<td class="liste_titre">'; |
||
| 766 | print '</td>'; |
||
| 767 | } |
||
| 768 | |||
| 769 | |||
| 770 | // Action column |
||
| 771 | print '<td class="liste_titre" align="right">'; |
||
| 772 | $searchpitco = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); |
||
| 773 | print $searchpitco; |
||
| 774 | print '</td>'; |
||
| 775 | print '</tr>' . "\n"; |
||
| 776 | |||
| 777 | |||
| 778 | $i = 0; |
||
| 779 | $var = true; |
||
| 780 | $totalarray = array(); |
||
| 781 | $flight = new Bbcvols($db); |
||
| 782 | while ($i < min($num, $limit)) { |
||
| 783 | $obj = $db->fetch_object($resql); |
||
| 784 | |||
| 785 | if ($obj) { |
||
| 786 | $var = !$var; |
||
| 787 | |||
| 788 | $flight->idBBC_vols = $obj->idBBC_vols; |
||
| 789 | $flight->date = $obj->date; |
||
| 790 | $flight->heureA = $obj->heureA; |
||
| 791 | $flight->heureD = $obj->heureD; |
||
| 792 | $flight->setRef($obj->idBBC_vols); |
||
| 793 | $flight->fk_pilot = $obj->pilot; |
||
| 794 | |||
| 795 | // Show here line of result |
||
| 796 | print '<tr ' . $bc[$var] . '>'; |
||
| 797 | |||
| 798 | View Code Duplication | if (! empty($arrayfields['t.idBBC_vols']['checked'])) |
|
| 799 | { |
||
| 800 | print '<td>'.$flight->getNomUrl(0).'</td>'; |
||
| 801 | |||
| 802 | if (! $i) $totalarray['nbfield']++; |
||
| 803 | } |
||
| 804 | View Code Duplication | if (! empty($arrayfields['t.date']['checked'])) |
|
| 805 | { |
||
| 806 | print '<td>'; |
||
| 807 | print dol_print_date($db->jdate($obj->date), '%d-%m-%y'); |
||
| 808 | print '</td>'; |
||
| 809 | |||
| 810 | if (! $i) $totalarray['nbfield']++; |
||
| 811 | } |
||
| 812 | View Code Duplication | if (! empty($arrayfields['t.lieuD']['checked'])) |
|
| 813 | { |
||
| 814 | print '<td>'.$obj->lieuD.'</td>'; |
||
| 815 | |||
| 816 | if (! $i) $totalarray['nbfield']++; |
||
| 817 | } |
||
| 818 | View Code Duplication | if (! empty($arrayfields['t.lieuA']['checked'])) |
|
| 819 | { |
||
| 820 | print '<td>'.$obj->lieuA.'</td>'; |
||
| 821 | |||
| 822 | if (! $i) $totalarray['nbfield']++; |
||
| 823 | } |
||
| 824 | View Code Duplication | if (! empty($arrayfields['t.heureD']['checked'])) |
|
| 825 | { |
||
| 826 | print '<td>'.$obj->heureD.'</td>'; |
||
| 827 | |||
| 828 | if (! $i) $totalarray['nbfield']++; |
||
| 829 | } |
||
| 830 | View Code Duplication | if (! empty($arrayfields['t.heureA']['checked'])) |
|
| 831 | { |
||
| 832 | print '<td>'.$obj->heureA.'</td>'; |
||
| 833 | |||
| 834 | if (! $i) $totalarray['nbfield']++; |
||
| 835 | } |
||
| 836 | if (! empty($arrayfields['t.BBC_ballons_idBBC_ballons']['checked'])) |
||
| 837 | { |
||
| 838 | print '<td>'.$obj->bal.'</td>'; |
||
| 839 | |||
| 840 | if (! $i) $totalarray['nbfield']++; |
||
| 841 | } |
||
| 842 | View Code Duplication | if (! empty($arrayfields['t.nbrPax']['checked'])) |
|
| 843 | { |
||
| 844 | print '<td>'.$obj->nbrPax.'</td>'; |
||
| 845 | |||
| 846 | if (! $i) $totalarray['nbfield']++; |
||
| 847 | } |
||
| 848 | View Code Duplication | if (! empty($arrayfields['t.remarque']['checked'])) |
|
| 849 | { |
||
| 850 | print '<td>'.$obj->remarque.'</td>'; |
||
| 851 | |||
| 852 | if (! $i) $totalarray['nbfield']++; |
||
| 853 | } |
||
| 854 | View Code Duplication | if (! empty($arrayfields['t.incidents']['checked'])) |
|
| 855 | { |
||
| 856 | print '<td>'.$obj->incidents.'</td>'; |
||
| 857 | |||
| 858 | if (! $i) $totalarray['nbfield']++; |
||
| 859 | } |
||
| 860 | View Code Duplication | if (! empty($arrayfields['t.fk_type']['checked'])) |
|
| 861 | { |
||
| 862 | print '<td>'.$obj->flight_type.'</td>'; |
||
| 863 | |||
| 864 | if (! $i) $totalarray['nbfield']++; |
||
| 865 | } |
||
| 866 | View Code Duplication | if (! empty($arrayfields['t.fk_pilot']['checked'])) |
|
| 867 | { |
||
| 868 | print '<td>'.$obj->pilot.'</td>'; |
||
| 869 | |||
| 870 | if (! $i) $totalarray['nbfield']++; |
||
| 871 | } |
||
| 872 | View Code Duplication | if (! empty($arrayfields['t.fk_organisateur']['checked'])) |
|
| 873 | { |
||
| 874 | print '<td>'.$obj->organisator.'</td>'; |
||
| 875 | |||
| 876 | if (! $i) $totalarray['nbfield']++; |
||
| 877 | } |
||
| 878 | if (! empty($arrayfields['t.is_facture']['checked'])) |
||
| 879 | { |
||
| 880 | $flight->is_facture = $obj->is_facture; |
||
| 881 | print '<td>'.$flight->getLibStatut(3).'</td>'; |
||
| 882 | |||
| 883 | if (! $i) $totalarray['nbfield']++; |
||
| 884 | } |
||
| 885 | if (! empty($arrayfields['t.kilometers']['checked'])) |
||
| 886 | { |
||
| 887 | if($user->rights->flightlog->vol->financial || $user->id == $flight->fk_pilot){ |
||
| 888 | print '<td>'.$obj->kilometers.' KM</td>'; |
||
| 889 | }else{ |
||
| 890 | print '<td> - Km</td>'; |
||
| 891 | } |
||
| 892 | |||
| 893 | if (! $i) $totalarray['nbfield']++; |
||
| 894 | } |
||
| 895 | if (! empty($arrayfields['t.cost']['checked'])) |
||
| 896 | { |
||
| 897 | if(($user->rights->flightlog->vol->financial || $user->id == $flight->fk_pilot) && $obj->cost > 0){ |
||
| 898 | $nbrPax = $obj->nbrPax > 0 ? $obj->nbrPax : 1; |
||
| 899 | print sprintf('<td>%s - (%s/pax)</td>', price($obj->cost, 0, $langs, 0, 0, -1, $conf->currency), price($obj->cost/$nbrPax, 0, $langs, -1, -1, -1, $conf->currency)); |
||
| 900 | }else{ |
||
| 901 | print '<td> - €</td>'; |
||
| 902 | } |
||
| 903 | |||
| 904 | if (! $i) $totalarray['nbfield']++; |
||
| 905 | } |
||
| 906 | View Code Duplication | if (! empty($arrayfields['t.fk_receiver']['checked'])) |
|
| 907 | { |
||
| 908 | print '<td>'.$obj->receiver.'</td>'; |
||
| 909 | |||
| 910 | if (! $i) $totalarray['nbfield']++; |
||
| 911 | } |
||
| 912 | View Code Duplication | if (! empty($arrayfields['t.justif_kilometers']['checked'])) |
|
| 913 | { |
||
| 914 | print '<td>'.$obj->justif_kilometers.'</td>'; |
||
| 915 | |||
| 916 | if (! $i) $totalarray['nbfield']++; |
||
| 917 | } |
||
| 918 | |||
| 919 | // Extra fields |
||
| 920 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { |
||
| 921 | foreach ($extrafields->attribute_label as $key => $val) { |
||
| 922 | if (!empty($arrayfields["ef." . $key]['checked'])) { |
||
| 923 | print '<td'; |
||
| 924 | $align = $extrafields->getAlignFlag($key); |
||
| 925 | if ($align) { |
||
| 926 | print ' align="' . $align . '"'; |
||
| 927 | } |
||
| 928 | print '>'; |
||
| 929 | $tmpkey = 'options_' . $key; |
||
| 930 | print $extrafields->showOutputField($key, $obj->$tmpkey); |
||
| 931 | print '</td>'; |
||
| 932 | if (!$i) { |
||
| 933 | $totalarray['nbfield']++; |
||
| 934 | } |
||
| 935 | } |
||
| 936 | } |
||
| 937 | } |
||
| 938 | // Fields from hook |
||
| 939 | $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj); |
||
| 940 | $reshook = $hookmanager->executeHooks('printFieldListValue', |
||
| 941 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 942 | print $hookmanager->resPrint; |
||
| 943 | // Date creation |
||
| 944 | View Code Duplication | if (!empty($arrayfields['t.datec']['checked'])) { |
|
| 945 | print '<td align="center">'; |
||
| 946 | print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); |
||
| 947 | print '</td>'; |
||
| 948 | if (!$i) { |
||
| 949 | $totalarray['nbfield']++; |
||
| 950 | } |
||
| 951 | } |
||
| 952 | // Date modification |
||
| 953 | View Code Duplication | if (!empty($arrayfields['t.tms']['checked'])) { |
|
| 954 | print '<td align="center">'; |
||
| 955 | print dol_print_date($db->jdate($obj->date_update), 'dayhour'); |
||
| 956 | print '</td>'; |
||
| 957 | if (!$i) { |
||
| 958 | $totalarray['nbfield']++; |
||
| 959 | } |
||
| 960 | } |
||
| 961 | |||
| 962 | // Action column |
||
| 963 | print '<td class="nowrap" align="center">'; |
||
| 964 | if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
||
| 965 | { |
||
| 966 | $selected = 0; |
||
| 967 | if (in_array($obj->idBBC_vols, $arrayofselected)) { |
||
| 968 | $selected = 1; |
||
| 969 | } |
||
| 970 | print '<input id="cb' . $obj->idBBC_vols . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj->idBBC_vols . '"' . ($selected ? ' checked="checked"' : '') . '>'; |
||
| 971 | } |
||
| 972 | print '</td>'; |
||
| 973 | if (!$i) { |
||
| 974 | $totalarray['nbfield']++; |
||
| 975 | } |
||
| 976 | |||
| 977 | print '</tr>'; |
||
| 978 | } |
||
| 979 | $i++; |
||
| 980 | } |
||
| 981 | |||
| 982 | // Show total line |
||
| 983 | if (isset($totalarray['totalhtfield'])) { |
||
| 984 | print '<tr class="liste_total">'; |
||
| 985 | $i = 0; |
||
| 986 | while ($i < $totalarray['nbfield']) { |
||
| 987 | $i++; |
||
| 988 | if ($i == 1) { |
||
| 989 | if ($num < $limit) { |
||
| 990 | print '<td align="left">' . $langs->trans("Total") . '</td>'; |
||
| 991 | } else { |
||
| 992 | print '<td align="left">' . $langs->trans("Totalforthispage") . '</td>'; |
||
| 993 | } |
||
| 994 | } elseif ($totalarray['totalhtfield'] == $i) { |
||
| 995 | print '<td align="right">' . price($totalarray['totalht']) . '</td>'; |
||
| 996 | } elseif ($totalarray['totalvatfield'] == $i) { |
||
| 997 | print '<td align="right">' . price($totalarray['totalvat']) . '</td>'; |
||
| 998 | } elseif ($totalarray['totalttcfield'] == $i) { |
||
| 999 | print '<td align="right">' . price($totalarray['totalttc']) . '</td>'; |
||
| 1000 | } else { |
||
| 1001 | print '<td></td>'; |
||
| 1002 | } |
||
| 1003 | } |
||
| 1004 | print '</tr>'; |
||
| 1005 | } |
||
| 1006 | |||
| 1007 | $db->free($resql); |
||
| 1008 | |||
| 1009 | $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); |
||
| 1010 | $reshook = $hookmanager->executeHooks('printFieldListFooter', |
||
| 1011 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 1012 | print $hookmanager->resPrint; |
||
| 1013 | |||
| 1014 | print '</table>' . "\n"; |
||
| 1015 | print '</div>' . "\n"; |
||
| 1016 | |||
| 1017 | print '</form>' . "\n"; |
||
| 1018 | |||
| 1019 | |||
| 1020 | // End of page |
||
| 1021 | llxFooter(); |
||
| 1022 | $db->close(); |
||
| 1023 |
This function has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.