mischka Posted July 16, 2012 Report Share Posted July 16, 2012 Hello It has annoyed me for some time now that the schedule search results (in this add-on and the standard schedule find) is not sorted by departure time. Showing the schedules by deptime is important, because a pilot has a better overview of which flights depart in the near future. Setting the relevant option in the local config doesnt help because the deptime field is actually a varchar, so sorting on that is a no-no. Hence I did some googling and found a neat way to convert the varchar to an actual time. Here is the relevant pieces of code to be changed in /core/common/Frontschedulesdata.class.php, and to save you all a game of "seek the differences", the changed parts are marked bold: public function findschedules($arricao, $depicao, $airline, $aircraft) { $query = "SELECT phpvms_schedules.*, phpvms_aircraft.name AS aircraft, phpvms_aircraft.registration, time(str_to_date(deptime,'%H:%i')) newdeptime FROM phpvms_schedules, phpvms_aircraft WHERE phpvms_schedules.depicao LIKE '$depicao' AND phpvms_schedules.arricao LIKE '$arricao' AND phpvms_schedules.code LIKE '$airline' AND phpvms_schedules.aircraft LIKE '$aircraft' AND phpvms_aircraft.id LIKE '$aircraft' ORDER BY newdeptime"; return DB::get_results($query); } public function findschedule($arricao, $depicao, $airline) { $query = "SELECT phpvms_schedules.*, phpvms_aircraft.name AS aircraft, phpvms_aircraft.registration, time(str_to_date(deptime,'%H:%i')) newdeptime FROM phpvms_schedules, phpvms_aircraft WHERE phpvms_schedules.depicao LIKE '$depicao' AND phpvms_schedules.arricao LIKE '$arricao' AND phpvms_schedules.code LIKE '$airline' AND phpvms_aircraft.id LIKE phpvms_schedules.aircraft ORDER BY newdeptime"; return DB::get_results($query); } Maybe this can be integrated in the product, or else somebody will find it here and my nocturnal toiling is not just for my own benefit Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted July 23, 2012 Administrators Report Share Posted July 23, 2012 Thank you for the contributiuon. I will add a link to yoru post in the readme for the module for anyone that desires the same result. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.