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'); |
||
| 54 | $search_kilometers = GETPOST('search_kilometers', 'int'); |
||
| 55 | $search_cost = GETPOST('search_cost', 'alpha'); |
||
| 56 | $search_fk_receiver = GETPOST('search_fk_receiver', 'int'); |
||
| 57 | $search_justif_kilometers = GETPOST('search_justif_kilometers', 'alpha'); |
||
| 58 | |||
| 59 | |||
| 60 | |||
| 61 | $search_myfield = GETPOST('search_myfield'); |
||
| 62 | $optioncss = GETPOST('optioncss', 'alpha'); |
||
| 63 | |||
| 64 | // Load variable for pagination |
||
| 65 | $limit = GETPOST("limit") ? GETPOST("limit", "int") : $conf->liste_limit; |
||
| 66 | $sortfield = GETPOST('sortfield', 'alpha'); |
||
| 67 | $sortorder = GETPOST('sortorder', 'alpha'); |
||
| 68 | $page = GETPOST('page', 'int'); |
||
| 69 | if ($page == -1) { |
||
| 70 | $page = 0; |
||
| 71 | } |
||
| 72 | $offset = $limit * $page; |
||
| 73 | $pageprev = $page - 1; |
||
| 74 | $pagenext = $page + 1; |
||
| 75 | if (!$sortfield) { |
||
| 76 | $sortfield = "t.date"; |
||
| 77 | } // Set here default search field |
||
| 78 | if (!$sortorder) { |
||
| 79 | $sortorder = "DESC"; |
||
| 80 | } |
||
| 81 | |||
| 82 | // Protection if external user |
||
| 83 | $socid = 0; |
||
| 84 | if ($user->societe_id > 0) { |
||
| 85 | $socid = $user->societe_id; |
||
| 86 | //accessforbidden(); |
||
| 87 | } |
||
| 88 | |||
| 89 | // Initialize technical object to manage context to save list fields |
||
| 90 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'flightLoglist'; |
||
| 91 | |||
| 92 | // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array |
||
| 93 | $hookmanager->initHooks(array('flightLoglist')); |
||
| 94 | $extrafields = new ExtraFields($db); |
||
| 95 | |||
| 96 | // fetch optionals attributes and labels |
||
| 97 | $extralabels = $extrafields->fetch_name_optionals_label('flightLog'); |
||
| 98 | $search_array_options = $extrafields->getOptionalsFromPost($extralabels, '', 'search_'); |
||
| 99 | |||
| 100 | // List of fields to search into when doing a "search in all" |
||
| 101 | $fieldstosearchall = array( |
||
| 102 | 't.ref' => 'Ref', |
||
| 103 | 't.note_public' => 'NotePublic', |
||
| 104 | ); |
||
| 105 | if (empty($user->socid)) { |
||
| 106 | $fieldstosearchall["t.note_private"] = "NotePrivate"; |
||
| 107 | } |
||
| 108 | |||
| 109 | // Definition of fields for list |
||
| 110 | $arrayfields = array( |
||
| 111 | |||
| 112 | 't.idBBC_vols' => array('label' => $langs->trans("FieldidBBC_vols"), 'checked' => 1), |
||
| 113 | 't.date' => array('label' => $langs->trans("FieldDate"), 'checked' => 1), |
||
| 114 | 't.lieuD' => array('label' => $langs->trans("FieldlieuD"), 'checked' => 1), |
||
| 115 | 't.lieuA' => array('label' => $langs->trans("FieldlieuA"), 'checked' => 1), |
||
| 116 | 't.heureD' => array('label' => $langs->trans("FieldheureD"), 'checked' => 1), |
||
| 117 | 't.heureA' => array('label' => $langs->trans("FieldheureA"), 'checked' => 1), |
||
| 118 | 't.BBC_ballons_idBBC_ballons' => array('label' => $langs->trans("FieldBBC_ballons_idBBC_ballons"), 'checked' => 1), |
||
| 119 | 't.nbrPax' => array('label' => $langs->trans("FieldnbrPax"), 'checked' => 1), |
||
| 120 | //'t.remarque' => array('label' => $langs->trans("Fieldremarque"), 'checked' => 1), |
||
| 121 | //'t.incidents' => array('label' => $langs->trans("Fieldincidents"), 'checked' => 1), |
||
| 122 | 't.fk_type' => array('label' => $langs->trans("Fieldfk_type"), 'checked' => 1), |
||
| 123 | 't.fk_pilot' => array('label' => $langs->trans("Fieldfk_pilot"), 'checked' => 1), |
||
| 124 | 't.fk_organisateur' => array('label' => $langs->trans("Fieldfk_organisateur"), 'checked' => 1), |
||
| 125 | 't.is_facture' => array('label' => $langs->trans("Fieldis_facture"), 'checked' => 1), |
||
| 126 | //'t.kilometers' => array('label' => $langs->trans("Fieldkilometers"), 'checked' => 1), |
||
| 127 | //'t.cost' => array('label' => $langs->trans("Fieldcost"), 'checked' => 1), |
||
| 128 | //'t.fk_receiver' => array('label' => $langs->trans("Fieldfk_receiver"), 'checked' => 1), |
||
| 129 | //'t.justif_kilometers' => array('label' => $langs->trans("Fieldjustif_kilometers"), 'checked' => 1), |
||
| 130 | |||
| 131 | |||
| 132 | //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), |
||
| 133 | 't.datec' => array('label' => $langs->trans("DateCreationShort"), |
||
| 134 | 'checked' => 0, |
||
| 135 | 'position' => 500 |
||
| 136 | ), |
||
| 137 | 't.tms' => array('label' => $langs->trans("DateModificationShort"), |
||
| 138 | 'checked' => 0, |
||
| 139 | 'position' => 500 |
||
| 140 | ), |
||
| 141 | //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), |
||
| 142 | ); |
||
| 143 | // Extra fields |
||
| 144 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { |
||
| 145 | foreach ($extrafields->attribute_label as $key => $val) { |
||
| 146 | $arrayfields["ef." . $key] = array('label' => $extrafields->attribute_label[$key], |
||
| 147 | 'checked' => $extrafields->attribute_list[$key], |
||
| 148 | 'position' => $extrafields->attribute_pos[$key], |
||
| 149 | 'enabled' => $extrafields->attribute_perms[$key] |
||
| 150 | ); |
||
| 151 | } |
||
| 152 | } |
||
| 153 | |||
| 154 | |||
| 155 | // Load object if id or ref is provided as parameter |
||
| 156 | $object = new Bbcvols($db); |
||
| 157 | View Code Duplication | if (($id > 0 || !empty($ref)) && $action != 'add') { |
|
| 158 | $result = $object->fetch($id, $ref); |
||
| 159 | if ($result < 0) { |
||
| 160 | dol_print_error($db); |
||
| 161 | } |
||
| 162 | } |
||
| 163 | |||
| 164 | |||
| 165 | /******************************************************************* |
||
| 166 | * ACTIONS |
||
| 167 | * |
||
| 168 | * Put here all code to do according to value of "action" parameter |
||
| 169 | ********************************************************************/ |
||
| 170 | |||
| 171 | if (GETPOST('cancel')) { |
||
| 172 | $action = 'list'; |
||
| 173 | $massaction = ''; |
||
| 174 | } |
||
| 175 | if (!GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { |
||
| 176 | $massaction = ''; |
||
| 177 | } |
||
| 178 | |||
| 179 | $parameters = array(); |
||
| 180 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, |
||
| 181 | $action); // Note that $action and $object may have been modified by some hooks |
||
| 182 | if ($reshook < 0) { |
||
| 183 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
||
| 184 | } |
||
| 185 | |||
| 186 | if (empty($reshook)) { |
||
| 187 | // Selection of new fields |
||
| 188 | include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; |
||
| 189 | |||
| 190 | // Purge search criteria |
||
| 191 | if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers |
||
| 192 | { |
||
| 193 | |||
| 194 | $search_idBBC_vols = ''; |
||
| 195 | $search_date = ''; |
||
| 196 | $search_lieuD = ''; |
||
| 197 | $search_lieuA = ''; |
||
| 198 | $search_heureD = ''; |
||
| 199 | $search_heureA = ''; |
||
| 200 | $search_BBC_ballons_idBBC_ballons = ''; |
||
| 201 | $search_nbrPax = ''; |
||
| 202 | $search_remarque = ''; |
||
| 203 | $search_incidents = ''; |
||
| 204 | $search_fk_type = ''; |
||
| 205 | $search_fk_pilot = ''; |
||
| 206 | $search_fk_organisateur = ''; |
||
| 207 | $search_is_facture = ''; |
||
| 208 | $search_kilometers = ''; |
||
| 209 | $search_cost = ''; |
||
| 210 | $search_fk_receiver = ''; |
||
| 211 | $search_justif_kilometers = ''; |
||
| 212 | |||
| 213 | |||
| 214 | $search_date_creation = ''; |
||
| 215 | $search_date_update = ''; |
||
| 216 | $toselect = ''; |
||
| 217 | $search_array_options = array(); |
||
| 218 | } |
||
| 219 | |||
| 220 | // Mass actions |
||
| 221 | $objectclass = 'BbcVols'; |
||
| 222 | $objectlabel = 'Vol'; |
||
| 223 | $permtoread = $user->rights->bbcvols->read; |
||
| 224 | $permtodelete = $user->rights->bbcvols->delete; |
||
| 225 | $uploaddir = $conf->bbcvols->dir_output; |
||
| 226 | } |
||
| 227 | |||
| 228 | |||
| 229 | /*************************************************** |
||
| 230 | * VIEW |
||
| 231 | * |
||
| 232 | * Put here all code to build page |
||
| 233 | ****************************************************/ |
||
| 234 | |||
| 235 | $now = dol_now(); |
||
| 236 | |||
| 237 | $form = new Form($db); |
||
| 238 | |||
| 239 | //$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; |
||
| 240 | $help_url = ''; |
||
| 241 | $title = $langs->trans('MyModuleListTitle'); |
||
| 242 | |||
| 243 | // Put here content of your page |
||
| 244 | |||
| 245 | // Example : Adding jquery code |
||
| 246 | print '<script type="text/javascript" language="javascript"> |
||
| 247 | jQuery(document).ready(function() { |
||
| 248 | function init_myfunc() |
||
| 249 | { |
||
| 250 | jQuery("#myid").removeAttr(\'disabled\'); |
||
| 251 | jQuery("#myid").attr(\'disabled\',\'disabled\'); |
||
| 252 | } |
||
| 253 | init_myfunc(); |
||
| 254 | jQuery("#mybutton").click(function() { |
||
| 255 | init_myfunc(); |
||
| 256 | }); |
||
| 257 | }); |
||
| 258 | </script>'; |
||
| 259 | |||
| 260 | |||
| 261 | $sql = "SELECT"; |
||
| 262 | $sql .= " t.idBBC_vols,"; |
||
| 263 | $sql .= " t.date,"; |
||
| 264 | $sql .= " t.lieuD,"; |
||
| 265 | $sql .= " t.lieuA,"; |
||
| 266 | $sql .= " t.heureD,"; |
||
| 267 | $sql .= " t.heureA,"; |
||
| 268 | $sql .= " t.BBC_ballons_idBBC_ballons,"; |
||
| 269 | $sql .= " t.nbrPax,"; |
||
| 270 | $sql .= " t.remarque,"; |
||
| 271 | $sql .= " t.incidents,"; |
||
| 272 | $sql .= " t.fk_type,"; |
||
| 273 | $sql .= " t.fk_pilot,"; |
||
| 274 | $sql .= " t.fk_organisateur,"; |
||
| 275 | $sql .= " t.is_facture,"; |
||
| 276 | $sql .= " t.kilometers,"; |
||
| 277 | $sql .= " t.cost,"; |
||
| 278 | $sql .= " t.fk_receiver,"; |
||
| 279 | $sql .= " t.justif_kilometers, "; |
||
| 280 | $sql .= " balloon.immat as bal, "; |
||
| 281 | $sql .= " CONCAT_WS(' ', 'T', flightType.numero,'-', flightType.nom) as flight_type, "; |
||
| 282 | $sql .= " CONCAT_WS(' ', pilot.firstname, pilot.lastname) as pilot, "; |
||
| 283 | $sql .= " CONCAT_WS(' ', organisator.firstname, organisator.lastname) as organisator, "; |
||
| 284 | $sql .= " CONCAT_WS(' ', receiver.firstname , receiver.lastname) as receiver"; |
||
| 285 | |||
| 286 | // Add fields from extrafields |
||
| 287 | foreach ($extrafields->attribute_label as $key => $val) { |
||
| 288 | $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef." . $key . ' as options_' . $key : ''); |
||
| 289 | } |
||
| 290 | // Add fields from hooks |
||
| 291 | $parameters = array(); |
||
| 292 | $reshook = $hookmanager->executeHooks('printFieldListSelect', |
||
| 293 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 294 | $sql .= $hookmanager->resPrint; |
||
| 295 | $sql .= " FROM " . MAIN_DB_PREFIX . "bbc_vols as t"; |
||
| 296 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { |
||
| 297 | $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bbc_vols_extrafields as ef on (t.rowid = ef.fk_object)"; |
||
| 298 | } |
||
| 299 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bbc_ballons as balloon on (t.BBC_ballons_idBBC_ballons = balloon.rowid)'; |
||
| 300 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bbc_types as flightType on (t.fk_type = flightType.idType)'; |
||
| 301 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user as pilot on (t.fk_pilot = pilot.rowid)'; |
||
| 302 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user as organisator on (t.fk_organisateur = organisator.rowid)'; |
||
| 303 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user as receiver on (t.fk_receiver = receiver.rowid)'; |
||
| 304 | |||
| 305 | $sql .= " WHERE 1 = 1"; |
||
| 306 | |||
| 307 | if ($search_idBBC_vols) { |
||
| 308 | $sql .= natural_search("idBBC_vols", $search_idBBC_vols); |
||
| 309 | } |
||
| 310 | if ($search_date) { |
||
| 311 | $sql .= natural_search("date", $search_date); |
||
| 312 | } |
||
| 313 | if ($search_lieuD) { |
||
| 314 | $sql .= natural_search("lieuD", $search_lieuD); |
||
| 315 | } |
||
| 316 | if ($search_lieuA) { |
||
| 317 | $sql .= natural_search("lieuA", $search_lieuA); |
||
| 318 | } |
||
| 319 | if ($search_heureD) { |
||
| 320 | $sql .= natural_search("heureD", $search_heureD); |
||
| 321 | } |
||
| 322 | if ($search_heureA) { |
||
| 323 | $sql .= natural_search("heureA", $search_heureA); |
||
| 324 | } |
||
| 325 | if ($search_BBC_ballons_idBBC_ballons) { |
||
| 326 | $sql .= natural_search("BBC_ballons_idBBC_ballons", $search_BBC_ballons_idBBC_ballons); |
||
| 327 | } |
||
| 328 | if ($search_nbrPax) { |
||
| 329 | $sql .= natural_search("nbrPax", $search_nbrPax, 1); |
||
| 330 | } |
||
| 331 | if ($search_remarque) { |
||
| 332 | $sql .= natural_search("remarque", $search_remarque); |
||
| 333 | } |
||
| 334 | if ($search_incidents) { |
||
| 335 | $sql .= natural_search("incidents", $search_incidents); |
||
| 336 | } |
||
| 337 | if ($search_fk_type) { |
||
| 338 | $sql .= natural_search("fk_type", $search_fk_type); |
||
| 339 | } |
||
| 340 | if ($search_fk_pilot && $search_fk_pilot != -1) { |
||
| 341 | $sql .= natural_search("fk_pilot", $search_fk_pilot, 2); |
||
| 342 | } |
||
| 343 | if ($search_fk_organisateur && $search_fk_organisateur != -1) { |
||
| 344 | $sql .= natural_search("fk_organisateur", $search_fk_organisateur); |
||
| 345 | } |
||
| 346 | |||
| 347 | if ($search_is_facture) { |
||
| 348 | $sql .= natural_search("is_facture", $search_is_facture); |
||
| 349 | } |
||
| 350 | if ($search_kilometers) { |
||
| 351 | $sql .= natural_search("kilometers", $search_kilometers, 1); |
||
| 352 | } |
||
| 353 | if ($search_cost) { |
||
| 354 | $sql .= natural_search("cost", $search_cost, 1); |
||
| 355 | } |
||
| 356 | if ($search_fk_receiver) { |
||
| 357 | $sql .= natural_search("fk_receiver", $search_fk_receiver); |
||
| 358 | } |
||
| 359 | if ($search_justif_kilometers) { |
||
| 360 | $sql .= natural_search("justif_kilometers", $search_justif_kilometers); |
||
| 361 | } |
||
| 362 | |||
| 363 | |||
| 364 | if ($sall) { |
||
| 365 | $sql .= natural_search(array_keys($fieldstosearchall), $sall); |
||
| 366 | } |
||
| 367 | // Add where from extra fields |
||
| 368 | foreach ($search_array_options as $key => $val) { |
||
| 369 | $crit = $val; |
||
| 370 | $tmpkey = preg_replace('/search_options_/', '', $key); |
||
| 371 | $typ = $extrafields->attribute_type[$tmpkey]; |
||
| 372 | $mode = 0; |
||
| 373 | if (in_array($typ, array('int', 'double'))) { |
||
| 374 | $mode = 1; |
||
| 375 | } // Search on a numeric |
||
| 376 | if ($val && (($crit != '' && !in_array($typ, array('select'))) || !empty($crit))) { |
||
| 377 | $sql .= natural_search('ef.' . $tmpkey, $crit, $mode); |
||
| 378 | } |
||
| 379 | } |
||
| 380 | // Add where from hooks |
||
| 381 | $parameters = array(); |
||
| 382 | $reshook = $hookmanager->executeHooks('printFieldListWhere', |
||
| 383 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 384 | $sql .= $hookmanager->resPrint; |
||
| 385 | $sql .= $db->order($sortfield, $sortorder); |
||
| 386 | //$sql.= $db->plimit($conf->liste_limit+1, $offset); |
||
| 387 | |||
| 388 | // Count total nb of records |
||
| 389 | $nbtotalofrecords = ''; |
||
| 390 | if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { |
||
| 391 | $result = $db->query($sql); |
||
| 392 | $nbtotalofrecords = $db->num_rows($result); |
||
| 393 | } |
||
| 394 | |||
| 395 | $sql .= $db->plimit($limit + 1, $offset); |
||
| 396 | |||
| 397 | dol_syslog($script_file, LOG_DEBUG); |
||
| 398 | $resql = $db->query($sql); |
||
| 399 | if (!$resql) { |
||
| 400 | dol_print_error($db); |
||
| 401 | exit; |
||
| 402 | } |
||
| 403 | |||
| 404 | $num = $db->num_rows($resql); |
||
| 405 | |||
| 406 | // Direct jump if only one record found |
||
| 407 | if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { |
||
| 408 | $obj = $db->fetch_object($resql); |
||
| 409 | $id = $obj->idBBC_vols; |
||
| 410 | header("Location: " . DOL_URL_ROOT . '/bbcvols/card.php?id=' . $id); |
||
| 411 | exit; |
||
| 412 | } |
||
| 413 | |||
| 414 | llxHeader('', $title, $help_url); |
||
| 415 | |||
| 416 | $arrayofselected = is_array($toselect) ? $toselect : array(); |
||
| 417 | |||
| 418 | $param = ''; |
||
| 419 | if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { |
||
| 420 | $param .= '&contextpage=' . $contextpage; |
||
| 421 | } |
||
| 422 | if ($limit > 0 && $limit != $conf->liste_limit) { |
||
| 423 | $param .= '&limit=' . $limit; |
||
| 424 | } |
||
| 425 | if ($search_idBBC_vols != '') { |
||
| 426 | $param .= '&search_idBBC_vols=' . urlencode($search_idBBC_vols); |
||
| 427 | } |
||
| 428 | if ($search_date != '') { |
||
| 429 | $param .= '&search_date=' . urlencode($search_date); |
||
| 430 | } |
||
| 431 | if ($search_lieuD != '') { |
||
| 432 | $param .= '&search_lieuD=' . urlencode($search_lieuD); |
||
| 433 | } |
||
| 434 | if ($search_lieuA != '') { |
||
| 435 | $param .= '&search_lieuA=' . urlencode($search_lieuA); |
||
| 436 | } |
||
| 437 | if ($search_heureD != '') { |
||
| 438 | $param .= '&search_heureD=' . urlencode($search_heureD); |
||
| 439 | } |
||
| 440 | if ($search_heureA != '') { |
||
| 441 | $param .= '&search_heureA=' . urlencode($search_heureA); |
||
| 442 | } |
||
| 443 | if ($search_BBC_ballons_idBBC_ballons != '') { |
||
| 444 | $param .= '&search_BBC_ballons_idBBC_ballons=' . urlencode($search_BBC_ballons_idBBC_ballons); |
||
| 445 | } |
||
| 446 | if ($search_nbrPax != '') { |
||
| 447 | $param .= '&search_nbrPax=' . urlencode($search_nbrPax); |
||
| 448 | } |
||
| 449 | if ($search_remarque != '') { |
||
| 450 | $param .= '&search_remarque=' . urlencode($search_remarque); |
||
| 451 | } |
||
| 452 | if ($search_incidents != '') { |
||
| 453 | $param .= '&search_incidents=' . urlencode($search_incidents); |
||
| 454 | } |
||
| 455 | if ($search_fk_type != '') { |
||
| 456 | $param .= '&search_fk_type=' . urlencode($search_fk_type); |
||
| 457 | } |
||
| 458 | if ($search_fk_pilot != '') { |
||
| 459 | $param .= '&search_fk_pilot=' . urlencode($search_fk_pilot); |
||
| 460 | } |
||
| 461 | if ($search_fk_organisateur != '') { |
||
| 462 | $param .= '&search_fk_organisateur=' . urlencode($search_fk_organisateur); |
||
| 463 | } |
||
| 464 | if ($search_is_facture != '') { |
||
| 465 | $param .= '&search_is_facture=' . urlencode($search_is_facture); |
||
| 466 | } |
||
| 467 | if ($search_kilometers != '') { |
||
| 468 | $param .= '&search_kilometers=' . urlencode($search_kilometers); |
||
| 469 | } |
||
| 470 | if ($search_cost != '') { |
||
| 471 | $param .= '&search_cost=' . urlencode($search_cost); |
||
| 472 | } |
||
| 473 | if ($search_fk_receiver != '') { |
||
| 474 | $param .= '&search_fk_receiver=' . urlencode($search_fk_receiver); |
||
| 475 | } |
||
| 476 | if ($search_justif_kilometers != '') { |
||
| 477 | $param .= '&search_justif_kilometers=' . urlencode($search_justif_kilometers); |
||
| 478 | } |
||
| 479 | |||
| 480 | if ($optioncss != '') { |
||
| 481 | $param .= '&optioncss=' . $optioncss; |
||
| 482 | } |
||
| 483 | // Add $param from extra fields |
||
| 484 | foreach ($search_array_options as $key => $val) { |
||
| 485 | $crit = $val; |
||
| 486 | $tmpkey = preg_replace('/search_options_/', '', $key); |
||
| 487 | if ($val != '') { |
||
| 488 | $param .= '&search_options_' . $tmpkey . '=' . urlencode($val); |
||
| 489 | } |
||
| 490 | } |
||
| 491 | |||
| 492 | $arrayofmassactions = array( |
||
| 493 | 'presend' => $langs->trans("SendByMail"), |
||
| 494 | 'builddoc' => $langs->trans("PDFMerge"), |
||
| 495 | ); |
||
| 496 | if ($user->rights->flightLog->supprimer) { |
||
| 497 | $arrayofmassactions['delete'] = $langs->trans("Delete"); |
||
| 498 | } |
||
| 499 | if ($massaction == 'presend') { |
||
| 500 | $arrayofmassactions = array(); |
||
| 501 | } |
||
| 502 | $massactionbutton = $form->selectMassAction('', $arrayofmassactions); |
||
| 503 | |||
| 504 | print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">'; |
||
| 505 | if ($optioncss != '') { |
||
| 506 | print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
||
| 507 | } |
||
| 508 | print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
||
| 509 | print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; |
||
| 510 | print '<input type="hidden" name="action" value="list">'; |
||
| 511 | print '<input type="hidden" name="sortfield" value="' . $sortfield . '">'; |
||
| 512 | print '<input type="hidden" name="sortorder" value="' . $sortorder . '">'; |
||
| 513 | print '<input type="hidden" name="contextpage" value="' . $contextpage . '">'; |
||
| 514 | |||
| 515 | print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, |
||
| 516 | 'title_companies', 0, '', '', $limit); |
||
| 517 | |||
| 518 | if ($sall) { |
||
| 519 | foreach ($fieldstosearchall as $key => $val) { |
||
| 520 | $fieldstosearchall[$key] = $langs->trans($val); |
||
| 521 | } |
||
| 522 | print $langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall); |
||
| 523 | } |
||
| 524 | |||
| 525 | $moreforfilter = ''; |
||
| 526 | $moreforfilter .= '<div class="divsearchfield">'; |
||
| 527 | //$moreforfilter .= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="' . dol_escape_htmltag($search_myfield) . '">'; |
||
| 528 | $moreforfilter .= '</div>'; |
||
| 529 | |||
| 530 | $parameters = array(); |
||
| 531 | $reshook = $hookmanager->executeHooks('printFieldPreListTitle', |
||
| 532 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 533 | if (empty($reshook)) { |
||
| 534 | $moreforfilter .= $hookmanager->resPrint; |
||
| 535 | } else { |
||
| 536 | $moreforfilter = $hookmanager->resPrint; |
||
| 537 | } |
||
| 538 | |||
| 539 | if (!empty($moreforfilter)) { |
||
| 540 | print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
||
| 541 | print $moreforfilter; |
||
| 542 | print '</div>'; |
||
| 543 | } |
||
| 544 | |||
| 545 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
||
| 546 | $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, |
||
| 547 | $varpage); // This also change content of $arrayfields |
||
| 548 | |||
| 549 | print '<div class="div-table-responsive">'; |
||
| 550 | print '<table class="tagtable liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n"; |
||
| 551 | |||
| 552 | // Fields title |
||
| 553 | print '<tr class="liste_titre">'; |
||
| 554 | // |
||
| 555 | View Code Duplication | if (!empty($arrayfields['t.idBBC_vols']['checked'])) { |
|
|
0 ignored issues
–
show
|
|||
| 556 | print_liste_field_titre($arrayfields['t.idBBC_vols']['label'], $_SERVER['PHP_SELF'], 't.idBBC_vols', '', $params, |
||
| 557 | '', $sortfield, $sortorder); |
||
| 558 | } |
||
| 559 | View Code Duplication | if (!empty($arrayfields['t.date']['checked'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 560 | print_liste_field_titre($arrayfields['t.date']['label'], $_SERVER['PHP_SELF'], 't.date', '', $params, |
||
| 561 | '', $sortfield, $sortorder); |
||
| 562 | } |
||
| 563 | View Code Duplication | if (!empty($arrayfields['t.lieuD']['checked'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 564 | print_liste_field_titre($arrayfields['t.lieuD']['label'], $_SERVER['PHP_SELF'], 't.lieuD', '', $params, '', |
||
| 565 | $sortfield, $sortorder); |
||
| 566 | } |
||
| 567 | View Code Duplication | if (!empty($arrayfields['t.lieuA']['checked'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 568 | print_liste_field_titre($arrayfields['t.lieuA']['label'], $_SERVER['PHP_SELF'], 't.lieuA', '', $params, '', |
||
| 569 | $sortfield, $sortorder); |
||
| 570 | } |
||
| 571 | View Code Duplication | if (!empty($arrayfields['t.heureD']['checked'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 572 | print_liste_field_titre($arrayfields['t.heureD']['label'], $_SERVER['PHP_SELF'], 't.heureD', '', $params, '', |
||
| 573 | $sortfield, $sortorder); |
||
| 574 | } |
||
| 575 | View Code Duplication | if (!empty($arrayfields['t.heureA']['checked'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 576 | print_liste_field_titre($arrayfields['t.heureA']['label'], $_SERVER['PHP_SELF'], 't.heureA', '', $params, '', |
||
| 577 | $sortfield, $sortorder); |
||
| 578 | } |
||
| 579 | View Code Duplication | if (!empty($arrayfields['t.BBC_ballons_idBBC_ballons']['checked'])) { |
|
| 580 | print_liste_field_titre($arrayfields['t.BBC_ballons_idBBC_ballons']['label'], $_SERVER['PHP_SELF'], |
||
| 581 | 't.BBC_ballons_idBBC_ballons', '', $params, '', $sortfield, $sortorder); |
||
| 582 | } |
||
| 583 | View Code Duplication | if (!empty($arrayfields['t.nbrPax']['checked'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 584 | print_liste_field_titre($arrayfields['t.nbrPax']['label'], $_SERVER['PHP_SELF'], 't.nbrPax', '', $params, '', |
||
| 585 | $sortfield, $sortorder); |
||
| 586 | } |
||
| 587 | /*if (!empty($arrayfields['t.remarque']['checked'])) { |
||
| 588 | print_liste_field_titre($arrayfields['t.remarque']['label'], $_SERVER['PHP_SELF'], 't.remarque', '', $params, '', |
||
| 589 | $sortfield, $sortorder); |
||
| 590 | } |
||
| 591 | if (!empty($arrayfields['t.incidents']['checked'])) { |
||
| 592 | print_liste_field_titre($arrayfields['t.incidents']['label'], $_SERVER['PHP_SELF'], 't.incidents', '', $params, '', |
||
| 593 | $sortfield, $sortorder); |
||
| 594 | }*/ |
||
| 595 | View Code Duplication | if (!empty($arrayfields['t.fk_type']['checked'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 596 | print_liste_field_titre($arrayfields['t.fk_type']['label'], $_SERVER['PHP_SELF'], 't.fk_type', '', $params, '', |
||
| 597 | $sortfield, $sortorder); |
||
| 598 | } |
||
| 599 | View Code Duplication | if (!empty($arrayfields['t.fk_pilot']['checked'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 600 | print_liste_field_titre($arrayfields['t.fk_pilot']['label'], $_SERVER['PHP_SELF'], 't.fk_pilot', '', $params, '', |
||
| 601 | $sortfield, $sortorder); |
||
| 602 | } |
||
| 603 | View Code Duplication | if (!empty($arrayfields['t.fk_organisateur']['checked'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 604 | print_liste_field_titre($arrayfields['t.fk_organisateur']['label'], $_SERVER['PHP_SELF'], 't.fk_organisateur', '', |
||
| 605 | $params, '', $sortfield, $sortorder); |
||
| 606 | } |
||
| 607 | |||
| 608 | View Code Duplication | if (!empty($arrayfields['t.is_facture']['checked'])) { |
|
| 609 | print_liste_field_titre($arrayfields['t.is_facture']['label'], $_SERVER['PHP_SELF'], 't.is_facture', '', $params, |
||
| 610 | '', $sortfield, $sortorder); |
||
| 611 | } |
||
| 612 | /*if (!empty($arrayfields['t.kilometers']['checked'])) { |
||
| 613 | print_liste_field_titre($arrayfields['t.kilometers']['label'], $_SERVER['PHP_SELF'], 't.kilometers', '', $params, |
||
| 614 | '', $sortfield, $sortorder); |
||
| 615 | } |
||
| 616 | if (!empty($arrayfields['t.cost']['checked'])) { |
||
| 617 | print_liste_field_titre($arrayfields['t.cost']['label'], $_SERVER['PHP_SELF'], 't.cost', '', $params, '', |
||
| 618 | $sortfield, $sortorder); |
||
| 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'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 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'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 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); |
||
| 696 | print '</td>'; |
||
| 697 | } |
||
| 698 | 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); |
||
| 701 | print '</td>'; |
||
| 702 | } |
||
| 703 | 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); |
||
| 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=""></option><option value="1">Facturé</option><option value="0">Ouvert</option></select>'; |
||
| 712 | print '</td>'; |
||
| 713 | } |
||
| 714 | /* |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
64% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 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 | |||
| 794 | // Show here line of result |
||
| 795 | print '<tr ' . $bc[$var] . '>'; |
||
| 796 | |||
| 797 | View Code Duplication | if (! empty($arrayfields['t.idBBC_vols']['checked'])) |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 798 | { |
||
| 799 | print '<td>'.$flight->getNomUrl(0).'</td>'; |
||
| 800 | |||
| 801 | if (! $i) $totalarray['nbfield']++; |
||
| 802 | } |
||
| 803 | View Code Duplication | if (! empty($arrayfields['t.date']['checked'])) |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 804 | { |
||
| 805 | print '<td>'; |
||
| 806 | print dol_print_date($db->jdate($obj->date), '%d-%m-%y'); |
||
| 807 | print '</td>'; |
||
| 808 | |||
| 809 | if (! $i) $totalarray['nbfield']++; |
||
| 810 | } |
||
| 811 | View Code Duplication | if (! empty($arrayfields['t.lieuD']['checked'])) |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 812 | { |
||
| 813 | print '<td>'.$obj->lieuD.'</td>'; |
||
| 814 | |||
| 815 | if (! $i) $totalarray['nbfield']++; |
||
| 816 | } |
||
| 817 | View Code Duplication | if (! empty($arrayfields['t.lieuA']['checked'])) |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 818 | { |
||
| 819 | print '<td>'.$obj->lieuA.'</td>'; |
||
| 820 | |||
| 821 | if (! $i) $totalarray['nbfield']++; |
||
| 822 | } |
||
| 823 | View Code Duplication | if (! empty($arrayfields['t.heureD']['checked'])) |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 824 | { |
||
| 825 | print '<td>'.$obj->heureD.'</td>'; |
||
| 826 | |||
| 827 | if (! $i) $totalarray['nbfield']++; |
||
| 828 | } |
||
| 829 | View Code Duplication | if (! empty($arrayfields['t.heureA']['checked'])) |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 830 | { |
||
| 831 | print '<td>'.$obj->heureA.'</td>'; |
||
| 832 | |||
| 833 | if (! $i) $totalarray['nbfield']++; |
||
| 834 | } |
||
| 835 | View Code Duplication | if (! empty($arrayfields['t.BBC_ballons_idBBC_ballons']['checked'])) |
|
| 836 | { |
||
| 837 | print '<td>'.$obj->bal.'</td>'; |
||
| 838 | |||
| 839 | if (! $i) $totalarray['nbfield']++; |
||
| 840 | } |
||
| 841 | View Code Duplication | if (! empty($arrayfields['t.nbrPax']['checked'])) |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 842 | { |
||
| 843 | print '<td>'.$obj->nbrPax.'</td>'; |
||
| 844 | |||
| 845 | if (! $i) $totalarray['nbfield']++; |
||
| 846 | } |
||
| 847 | View Code Duplication | if (! empty($arrayfields['t.remarque']['checked'])) |
|
| 848 | { |
||
| 849 | print '<td>'.$obj->remarque.'</td>'; |
||
| 850 | |||
| 851 | if (! $i) $totalarray['nbfield']++; |
||
| 852 | } |
||
| 853 | View Code Duplication | if (! empty($arrayfields['t.incidents']['checked'])) |
|
| 854 | { |
||
| 855 | print '<td>'.$obj->incidents.'</td>'; |
||
| 856 | |||
| 857 | if (! $i) $totalarray['nbfield']++; |
||
| 858 | } |
||
| 859 | View Code Duplication | if (! empty($arrayfields['t.fk_type']['checked'])) |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 860 | { |
||
| 861 | print '<td>'.$obj->flight_type.'</td>'; |
||
| 862 | |||
| 863 | if (! $i) $totalarray['nbfield']++; |
||
| 864 | } |
||
| 865 | View Code Duplication | if (! empty($arrayfields['t.fk_pilot']['checked'])) |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 866 | { |
||
| 867 | print '<td>'.$obj->pilot.'</td>'; |
||
| 868 | |||
| 869 | if (! $i) $totalarray['nbfield']++; |
||
| 870 | } |
||
| 871 | View Code Duplication | if (! empty($arrayfields['t.fk_organisateur']['checked'])) |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 872 | { |
||
| 873 | print '<td>'.$obj->organisator.'</td>'; |
||
| 874 | |||
| 875 | if (! $i) $totalarray['nbfield']++; |
||
| 876 | } |
||
| 877 | if (! empty($arrayfields['t.is_facture']['checked'])) |
||
| 878 | { |
||
| 879 | $flight->is_facture = $obj->is_facture; |
||
| 880 | print '<td>'.$flight->getLibStatut(3).'</td>'; |
||
| 881 | |||
| 882 | if (! $i) $totalarray['nbfield']++; |
||
| 883 | } |
||
| 884 | View Code Duplication | if (! empty($arrayfields['t.kilometers']['checked'])) |
|
| 885 | { |
||
| 886 | print '<td>'.$obj->kilometers.'</td>'; |
||
| 887 | |||
| 888 | if (! $i) $totalarray['nbfield']++; |
||
| 889 | } |
||
| 890 | View Code Duplication | if (! empty($arrayfields['t.cost']['checked'])) |
|
| 891 | { |
||
| 892 | print '<td>'.$obj->cost.'</td>'; |
||
| 893 | |||
| 894 | if (! $i) $totalarray['nbfield']++; |
||
| 895 | } |
||
| 896 | View Code Duplication | if (! empty($arrayfields['t.fk_receiver']['checked'])) |
|
| 897 | { |
||
| 898 | print '<td>'.$obj->receiver.'</td>'; |
||
| 899 | |||
| 900 | if (! $i) $totalarray['nbfield']++; |
||
| 901 | } |
||
| 902 | View Code Duplication | if (! empty($arrayfields['t.justif_kilometers']['checked'])) |
|
| 903 | { |
||
| 904 | print '<td>'.$obj->justif_kilometers.'</td>'; |
||
| 905 | |||
| 906 | if (! $i) $totalarray['nbfield']++; |
||
| 907 | } |
||
| 908 | |||
| 909 | // Extra fields |
||
| 910 | if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { |
||
| 911 | foreach ($extrafields->attribute_label as $key => $val) { |
||
| 912 | if (!empty($arrayfields["ef." . $key]['checked'])) { |
||
| 913 | print '<td'; |
||
| 914 | $align = $extrafields->getAlignFlag($key); |
||
| 915 | if ($align) { |
||
| 916 | print ' align="' . $align . '"'; |
||
| 917 | } |
||
| 918 | print '>'; |
||
| 919 | $tmpkey = 'options_' . $key; |
||
| 920 | print $extrafields->showOutputField($key, $obj->$tmpkey); |
||
| 921 | print '</td>'; |
||
| 922 | if (!$i) { |
||
| 923 | $totalarray['nbfield']++; |
||
| 924 | } |
||
| 925 | } |
||
| 926 | } |
||
| 927 | } |
||
| 928 | // Fields from hook |
||
| 929 | $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj); |
||
| 930 | $reshook = $hookmanager->executeHooks('printFieldListValue', |
||
| 931 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 932 | print $hookmanager->resPrint; |
||
| 933 | // Date creation |
||
| 934 | View Code Duplication | if (!empty($arrayfields['t.datec']['checked'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 935 | print '<td align="center">'; |
||
| 936 | print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); |
||
| 937 | print '</td>'; |
||
| 938 | if (!$i) { |
||
| 939 | $totalarray['nbfield']++; |
||
| 940 | } |
||
| 941 | } |
||
| 942 | // Date modification |
||
| 943 | View Code Duplication | if (!empty($arrayfields['t.tms']['checked'])) { |
|
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 944 | print '<td align="center">'; |
||
| 945 | print dol_print_date($db->jdate($obj->date_update), 'dayhour'); |
||
| 946 | print '</td>'; |
||
| 947 | if (!$i) { |
||
| 948 | $totalarray['nbfield']++; |
||
| 949 | } |
||
| 950 | } |
||
| 951 | // Status |
||
| 952 | /* |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
69% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 953 | if (! empty($arrayfields['u.statut']['checked'])) |
||
| 954 | { |
||
| 955 | $userstatic->statut=$obj->statut; |
||
| 956 | print '<td align="center">'.$userstatic->getLibStatut(3).'</td>'; |
||
| 957 | }*/ |
||
| 958 | |||
| 959 | // Action column |
||
| 960 | print '<td class="nowrap" align="center">'; |
||
| 961 | if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined |
||
| 962 | { |
||
| 963 | $selected = 0; |
||
| 964 | if (in_array($obj->idBBC_vols, $arrayofselected)) { |
||
| 965 | $selected = 1; |
||
| 966 | } |
||
| 967 | print '<input id="cb' . $obj->idBBC_vols . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj->idBBC_vols . '"' . ($selected ? ' checked="checked"' : '') . '>'; |
||
| 968 | } |
||
| 969 | print '</td>'; |
||
| 970 | if (!$i) { |
||
| 971 | $totalarray['nbfield']++; |
||
| 972 | } |
||
| 973 | |||
| 974 | print '</tr>'; |
||
| 975 | } |
||
| 976 | $i++; |
||
| 977 | } |
||
| 978 | |||
| 979 | // Show total line |
||
| 980 | if (isset($totalarray['totalhtfield'])) { |
||
| 981 | print '<tr class="liste_total">'; |
||
| 982 | $i = 0; |
||
| 983 | while ($i < $totalarray['nbfield']) { |
||
| 984 | $i++; |
||
| 985 | if ($i == 1) { |
||
| 986 | if ($num < $limit) { |
||
| 987 | print '<td align="left">' . $langs->trans("Total") . '</td>'; |
||
| 988 | } else { |
||
| 989 | print '<td align="left">' . $langs->trans("Totalforthispage") . '</td>'; |
||
| 990 | } |
||
| 991 | } elseif ($totalarray['totalhtfield'] == $i) { |
||
| 992 | print '<td align="right">' . price($totalarray['totalht']) . '</td>'; |
||
| 993 | } elseif ($totalarray['totalvatfield'] == $i) { |
||
| 994 | print '<td align="right">' . price($totalarray['totalvat']) . '</td>'; |
||
| 995 | } elseif ($totalarray['totalttcfield'] == $i) { |
||
| 996 | print '<td align="right">' . price($totalarray['totalttc']) . '</td>'; |
||
| 997 | } else { |
||
| 998 | print '<td></td>'; |
||
| 999 | } |
||
| 1000 | } |
||
| 1001 | print '</tr>'; |
||
| 1002 | } |
||
| 1003 | |||
| 1004 | $db->free($resql); |
||
| 1005 | |||
| 1006 | $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); |
||
| 1007 | $reshook = $hookmanager->executeHooks('printFieldListFooter', |
||
| 1008 | $parameters); // Note that $action and $object may have been modified by hook |
||
| 1009 | print $hookmanager->resPrint; |
||
| 1010 | |||
| 1011 | print '</table>' . "\n"; |
||
| 1012 | print '</div>' . "\n"; |
||
| 1013 | |||
| 1014 | print '</form>' . "\n"; |
||
| 1015 | |||
| 1016 | |||
| 1017 | // End of page |
||
| 1018 | llxFooter(); |
||
| 1019 | $db->close(); |
||
| 1020 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.