Minor bug in cron.php

Report issues with Enuuk Auction Platform or Mods here - remember to raise a ticket with phpauction.net as well
Post Reply
RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

Minor bug in cron.php

Post by RWAP » Wed Mar 30, 2016 10:01 am

Just realised that the original Enuuk class\Cron.php file has a minor bug (does not affect operation of the site):

Code: Select all

    public static function openDatePendingOffers(MyPDO $DB, Core_Context $context)
    {
        $now = date("Y-m-d H:i:s"); //Used to get corrected time based on timezone settings
        $offers = Offer::getListFromDB(
            $DB,
            'where offers.active = 0 and offers.datePending = 1 and draft = 0
                and offers.startDate < "'.$now.'" and offers.endDate > "'.$now.'"
                and winner is null'
        );
        foreach ($offers as $v) {
            $o = Offer::getInstanceFromDB($DB, $v['id']);
            $o->active = 1;
            $o->saveToDB($DB);
        }
        return count($offers);
    }
Should strictly read:

Code: Select all

    public static function openDatePendingOffers(MyPDO $DB, Core_Context $context)
    {
        $now = date("Y-m-d H:i:s"); //Used to get corrected time based on timezone settings
        $offers = Offer::getListFromDB(
            $DB,
            'where offers.active = 0 and offers.datePending = 1 and draft = 0
                and offers.startDate < "'.$now.'" and offers.endDate > "'.$now.'"
                and winner is null'
        );
        foreach ($offers as $v) {
            $o = Offer::getInstanceFromDB($DB, $v['id']);            
            $o->datePending = 0;            
            $o->active = 1;
            $o->saveToDB($DB);
        }
        return count($offers);
    }
    

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest