Jump to content
thunder175

Email on bid expiration

Recommended Posts

Before I tackle this on my own, has anyone made a script to generate an email to the user upon bid expiration (using the maintenance.php cron job)? Asking since I don't want to reinvent the wheel if its already been done.

Share this post


Link to post
Share on other sites

In core/common/SchedulesData.class.php, somewhere near line 792, you can replace and try this, however I am not sure it may work or not.

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) {
                $pilotdet = PilotData::getPilotData($row->pilotid);
                $pilotname = $pilotdet->firstname.' '.$pilotdet->lastname;
                $pilotemail = $pilotdet->email;
                $subject = 'Vistara Virtual : Bid Deleted!';
                $message = 'Hello '.$pilotname.', your Bid having ID: '.$row->bidid.' has been deleted since it has crossed the minimum days required to fly!';
                mail($pilotemail,$subject,$message);
                $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);

    }

 

Edited by Yash
  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks for the help! I finally implemented this and it saved me a lot of time. The only change I did was instead of

mail($pilotemail,$subject,$message);

I used

Util::SendEmail($pilotemail,$subject,$message);

 

Share this post


Link to post
Share on other sites
On 4/19/2019 at 5:52 AM, thunder175 said:

Thanks for the help! I finally implemented this and it saved me a lot of time. The only change I did was instead of


mail($pilotemail,$subject,$message);

I used


Util::SendEmail($pilotemail,$subject,$message);

 

Your welcome! :D

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×