function b1n_regLoadLeg($sql, &$ret_msgs, &$reg_data, &$reg_config) { $d = date('Y'); $reg_config['KeepTrack'] = array('reg_data' => 'leg_keeptrack_dt', 'db' => 'leg_keeptrack_dt', 'check' => 'none', 'type' => 'select', 'extra' => array('seltype' => 'date_hour', 'year_start' => $d, 'year_end' => $d + b1n_DEFAULT_DATE_INC), 'load' => 'true'); $ret = b1n_regLoad($sql, $ret_msgs, $reg_data, $reg_config, "leg"); unset($reg_config["KeepTrack"]); $reg_data["paxs"] = array(); // Pax List $query = "SELECT DISTINCT pax_id FROM \"leg_pax\" WHERE leg_id = '" . b1n_inBd($reg_data['id']) . "'"; $rs = $sql->query($query); if ($rs && is_array($rs)) { foreach ($rs as $i) { array_push($reg_data['paxs'], $i['pax_id']); } } // ETD = KeepTrack $reg_data["leg_etd_dt"] = $reg_data["leg_keeptrack_dt"]; // ETE $reg_data["leg_ete_i"] = b1n_formatHourFromDb($reg_data["leg_ete_i"]); return $ret; }
} // Default GroundTime is 45 minutes $reg_data['leg_groundtime_i'] = '00:45'; // 'No Break' on purpose to get throught and get similar leg data :) // break; // 'No Break' on purpose to get throught and get similar leg data :) // break; case 'similarleg': if ($reg_data['apt_id_depart'] && $reg_data['apt_id_arrive']) { $aux = b1n_regDefaultLegSearchSimilar($sql, $reg_data['apt_id_depart'], $reg_data['apt_id_arrive']); if ($aux) { list($reg_data['leg_ete_i'], $reg_data['leg_distance'], $reg_data['leg_fuel']) = explode('|', $aux); if ($reg_data['leg_fuel'] == 0) { $reg_data['leg_fuel'] = ''; } $reg_data['leg_ete_i'] = b1n_formatHourFromDb($reg_data['leg_ete_i']); } } break; } if ($rs && is_array($rs)) { // If we do have groundtime in last leg we should disable Depart Date input. $disable_etd_dt = $rs['leg_groundtime_i'] == 't'; // Default Depart date is keeptrack $reg_data['leg_etd_dt'] = b1n_formatDateHourFromDb($rs['leg_keeptrack_dt']); } } ?> <script language="JavaScript"> function b1n_verifyAirports(f) {
function b1n_regChange($sql, &$ret_msgs, $reg_data, $reg_config, $table, $msg, $module_function = "") { $rs = $sql->query("BEGIN TRANSACTION"); if ($rs) { $query = "SELECT * FROM \"" . $table . "\" WHERE " . $reg_config["ID"]["db"] . " = '" . b1n_inBd($reg_data['id']) . "'"; $update = ""; $old_values = $sql->singleQuery($query); foreach ($reg_config as $t => $r) { $value = $reg_data[$r['reg_data']]; $aux = ""; // Fields if ($r['db'] == 'none') { continue; } // Values switch ($r['type']) { case "select": switch ($r['extra']['seltype']) { case "date": case "date_check_exp": case "date_check_dob": $aux = b1n_formatDate($value); $old_values[$r['db']] = b1n_formatDate(b1n_formatDateFromDb($old_values[$r['db']])); break; case "date_hour": $aux = b1n_formatDateHour($value); $old_values[$r['db']] = b1n_formatDateHour(b1n_formatDateHourFromDb($old_values[$r['db']])); break; case "hour": $aux = b1n_formatHour($value); $old_values[$r['db']] = b1n_formatHour(b1n_formatHourFromDb($old_values[$r['db']])); break; default: $aux = $value; break; } break; case "password": if (empty($value)) { // For some reason, switch counts as a loop, so we need to use 'continue(2)' instead of just 'continue' continue 2; } $aux = b1n_crypt($value); break; default: $aux = $value; break; } // Only update if the values changed ($aux != $old...) if ($aux != $old_values[$r['db']]) { if (b1n_checkFilled($aux)) { $aux = $r['db'] . " = '" . b1n_inBd($aux) . "'"; } else { $aux = $r['db'] . " = NULL"; } // Setting update array $update[] = $aux; } } if (is_array($update)) { $update = implode(", ", $update); $query = "UPDATE \"" . $table . "\" SET " . $update . " WHERE " . $reg_config['ID']['db'] . " = '" . b1n_inBd($reg_data['id']) . "'"; $rs = $sql->query($query); } else { $rs = true; } if ($rs) { $aux = true; if (!empty($module_function)) { $reg_data['old_values'] = $old_values; $aux = $module_function($sql, $ret_msgs, $reg_data, $reg_config); } if ($aux) { b1n_retMsg($ret_msgs, b1n_SUCCESS, $msg . ' changed successfully!'); return $sql->query('COMMIT TRANSACTION'); } } } else { b1n_retMsg($ret_msgs, b1n_FIZZLES, 'Could not begin transaction.'); } $sql->query('ROLLBACK TRANSACTION'); return false; }