CEO North Air Posted February 25, 2010 Report Share Posted February 25, 2010 Hi, are there any possibilities that all bids that won´t be flight at the end of 24 hours past creating that bid, will be cancelled automatically? Thanks four your help! Tobi Quote Link to comment Share on other sites More sharing options...
Strider Posted February 25, 2010 Report Share Posted February 25, 2010 That should be a simple if else statement, I dont know what it would be, but shouldn't be that hard to find out. Cheers Dan C Quote Link to comment Share on other sites More sharing options...
Kieran Posted February 25, 2010 Report Share Posted February 25, 2010 There would be some sort of cron job involved I think... Quote Link to comment Share on other sites More sharing options...
Administrators simpilot Posted February 26, 2010 Administrators Report Share Posted February 26, 2010 Hey guys, the date for bids is stored simply as a date so it is tough to comapre a 24 hour period but you can comapre if it is the next day or not. If you put this code at the start of your schedule_results.tpl file it will to see how old any filed bids are. Having the time comparison set at 86400 (1 day in seconds) will erase any bid that was filed two days ago. ie - any bid made on 2-20-2010 will be erased on 2-22-2010, so you could have an active bid for 47 hours.. You can change that number to 0, but that may not be desireable either. An example using 0 - any bid made on 2-20-2010 would be erased on 2-21-2010. so a bid could only last 1 second, if it were to be filed right before midnight on 2-20-2010 it would be erased the next time the script ran on 2-21-2010. <?php $bids = SchedulesData::getAllBids(); $today = date("Y-m-d"); if(isset($bids)) { foreach($bids as $bid) { $date1 = $bid->dateadded; $date2 = strtotime($today); $dateArr = explode("-",$date1); $date1Int = mktime(0,0,0,$dateArr[1],$dateArr[2],$dateArr[0]) ; $diff = ($date1Int-$date2); if ($diff < -86400) {SchedulesData::removeBid($bid->bidid);} } } ?> This code would be better placed in the index function of the Schedules.php file but you would have to replace it every time you updated..... good luck! - 1 Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted February 26, 2010 Administrators Report Share Posted February 26, 2010 Simplify this up there for ya: $bids = SchedulesData::getAllBids(); if(isset($bids)) { foreach($bids as $bid) { $bid_time = strtotime($bid->dateadded); $diff = abs(time() - $bid_time); if ($diff > 60*60*24*2) /* two days, in seconds */ { SchedulesData::removeBid($bid->bidid); } } } 1 Quote Link to comment Share on other sites More sharing options...
stuartpb Posted February 26, 2010 Report Share Posted February 26, 2010 Thanks Nabeel and Simpilot, this is just what I have been tryin to do myself (with no luck). So where is it best to put the code? I looked in the schedules.php file but wasn't sure exactly where to place it? Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted February 27, 2010 Administrators Report Share Posted February 27, 2010 schedule_results.tpl inside that foreach loop, you'll see there are other checks there for the schedules Quote Link to comment Share on other sites More sharing options...
stuartpb Posted February 28, 2010 Report Share Posted February 28, 2010 Thanks for that, much appreciated! Quote Link to comment Share on other sites More sharing options...
Artjom Posted March 19, 2010 Report Share Posted March 19, 2010 where I want to add this code in schedule_results.tpl? on what line? Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 19, 2010 Administrators Report Share Posted March 19, 2010 There's a loop in there (foreach(...) {), it would be inside that. I can't look at the exact code ATM Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted March 19, 2010 Moderators Report Share Posted March 19, 2010 Thats good actually as i have for some reason a few bids that i have to manually cancel from the admin side at times, maybe this could be in a further release with the setting in the local config? Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 19, 2010 Administrators Report Share Posted March 19, 2010 Can you add it to the tracker? I can add it as part of the maintenance script/cron Quote Link to comment Share on other sites More sharing options...
Moderators mark1million Posted March 19, 2010 Moderators Report Share Posted March 19, 2010 Done, Cheers! Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted March 19, 2010 Administrators Report Share Posted March 19, 2010 Done, Cheers! Thanks. That list isn't getting any smaller, haha 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.