mseiwald Posted July 8, 2012 Report Share Posted July 8, 2012 Hey guys, I have got a problem with the close bids after expire function. The CRON job removes the bid so it`s no longer displayed under the recentbids but as i have disable SCHED on BIDS active it doesn`t show up in my schedules again after the cron job has removed the bid. I have to delete the flight completely from the schedules and add it as a new flight in order to make it show up again. So in the maintenance.php i just find this: if(Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === true) { SchedulesData::deleteExpiredBids(); CronData::set_lastupdate('check_expired_bids'); } but where can i find the code for what actually is happening then so that i can take a look and find out what`s going wrong there. ok i found it in SchedulesData public static function deleteExpiredBids() { $cache_time = Config::Get('BID_EXPIRE_TIME'); if($cache_time == '') { return; } $sql = 'DELETE FROM '.TABLE_PREFIX."bids WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()"; DB::query($sql); } if i get it right it deletes the bid from the _bids table..... but does it also update the bidid column in the schedules table to 0 again?!? i think that is the reason why it doesn`t show up...is that possible? Quote Link to comment Share on other sites More sharing options...
mseiwald Posted July 9, 2012 Author Report Share Posted July 9, 2012 No ideas? (null) Quote Link to comment Share on other sites More sharing options...
mseiwald Posted August 25, 2012 Author Report Share Posted August 25, 2012 Ok i know now for sure that the problem is that the bidid in the schedules table isn't updated to 0. Could someone be so kind to show me what i need to add to the function in my first post to not only delete the bids from the bids table but also Update the bidid column for that flight to 0 in the schedules table? kind regards Manuel Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted August 25, 2012 Moderators Report Share Posted August 25, 2012 Manuel, I found the bug. (smacks bug with hand!) Head to SchedulesData.class.php and go to line 861. Look for the function... public static function deleteExpiredBids() Inside of the function, replace the whole function with this... my modification. public static function deleteExpiredBids() { $cache_time = Config::Get('BID_EXPIRE_TIME'); if ($cache_time == '') { return; } /* Make sure the schedule bidids */ $sql = 'SELECT * FROM ' . TABLE_PREFIX . "bids WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()"; $results = DB::get_results($sql); if (count($results) > 0) { foreach ($results as $row) { $sql = 'UPDATE ' . TABLE_PREFIX . "schedules SET `bidid`=0 WHERE `id`={$row->routeid}"; DB::query($sql); } } And that issue should not be a pain again. 1 Quote Link to comment Share on other sites More sharing options...
mseiwald Posted August 25, 2012 Author Report Share Posted August 25, 2012 Wow once again thanks a lot Kyle. That issue really was a pain. Especially in the beginning when I didn't know why my flights don't reappear in the schedules hehe Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted August 25, 2012 Moderators Report Share Posted August 25, 2012 Not a problem! Quote Link to comment Share on other sites More sharing options...
Moderators Kyle Posted August 25, 2012 Moderators Report Share Posted August 25, 2012 It was bug in the VMS, it was fixed in the BETA. I updated the code in my post. Quote Link to comment Share on other sites More sharing options...
mseiwald Posted August 25, 2012 Author Report Share Posted August 25, 2012 hm i pasted it exactly like in your post now but it gives me Warning: Invalid argument supplied for foreach() in /var/html/eco1005016/html/core/common/SchedulesData.class.php on line 913 when i run maintenance.php Quote Link to comment Share on other sites More sharing options...
Felipe Posted October 31, 2012 Report Share Posted October 31, 2012 I tried this one from Piuozorio... http://forum.phpvms....p-bids-removal/ ... and it did not work for me. Now I'm gonna try Kyle's. I hope I get it to work. Quote Link to comment Share on other sites More sharing options...
loplo Posted December 25, 2012 Report Share Posted December 25, 2012 (edited) I'm getting Parse error: syntax error, unexpected T_PUBLIC in /home/taromvir/public_html/core/common/SchedulesData.class.php on line 886 line 886 is public static function removeBid($bidid) - the next function. Any solution!? LE there was a missing closing bracket } LE2 It's not working. I've also created a cronjob to run "maintenance" every hour and still no joy. Anyone?! Edited December 26, 2012 by loplo Quote Link to comment Share on other sites More sharing options...
Kapitan Posted April 4, 2013 Report Share Posted April 4, 2013 Anyone ??? Quote Link to comment Share on other sites More sharing options...
Kapitan Posted April 4, 2013 Report Share Posted April 4, 2013 Oh come on people stop posting things if you dont know they are working ... Quote Link to comment Share on other sites More sharing options...
Ephendi Posted July 18, 2016 Report Share Posted July 18, 2016 Easy solution: public static function deleteExpiredBids() { $cache_time = Config::Get('BID_EXPIRE_TIME'); if ($cache_time == '') { return; } /* Make sure the schedule bidids */ $sql = 'SELECT * FROM ' . TABLE_PREFIX . "bids WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()"; $results = DB::get_results($sql); if (count($results) > 0) { foreach ($results as $row) { $sql = 'UPDATE ' . TABLE_PREFIX . "schedules SET `bidid`=0 WHERE `id`={$row->routeid}"; DB::query($sql); } } $sql = 'DELETE FROM '.TABLE_PREFIX."bids WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()"; DB::query($sql); } Quote Link to comment Share on other sites More sharing options...
Felipe Posted March 28, 2017 Report Share Posted March 28, 2017 On 25/08/2012 at 0:11 PM, Kyle said: Manuel, I found the bug. (smacks bug with hand!) Head to SchedulesData.class.php and go to line 861. Look for the function... public static function deleteExpiredBids() Inside of the function, replace the whole function with this... my modification. public static function deleteExpiredBids() { $cache_time = Config::Get('BID_EXPIRE_TIME'); if ($cache_time == '') { return; } /* Make sure the schedule bidids */ $sql = 'SELECT * FROM ' . TABLE_PREFIX . "bids WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()"; $results = DB::get_results($sql); if (count($results) > 0) { foreach ($results as $row) { $sql = 'UPDATE ' . TABLE_PREFIX . "schedules SET `bidid`=0 WHERE `id`={$row->routeid}"; DB::query($sql); } } And that issue should not be a pain again. I tried Kyle's suggestion above and still was getting an error. So I made some changes on it and now it's working fine. Finally I don't need an extra script on my server just to remove expired bids... Thanks Kyle for the great help! public static function deleteExpiredBids(){ $cache_time = Config::Get('BID_EXPIRE_TIME'); if($cache_time == ''){ return; } $selectbids = 'SELECT * FROM ' . TABLE_PREFIX . "bids WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()"; $results = DB::get_results($selectbids); $deletebids = 'DELETE FROM '.TABLE_PREFIX."bids WHERE `dateadded` + INTERVAL {$cache_time} HOUR < NOW()"; if(count($results) > 0){ foreach ($results as $row){ DB::query($deletebids); $updateschedules = 'UPDATE ' . TABLE_PREFIX . "schedules SET `bidid`=0 WHERE `id`={$row->routeid}"; DB::query($updateschedules); } } } 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.