Пример #1
0
 public function action_deactivate()
 {
     $id = $_GET['id'];
     $mode = $_GET['mode'];
     Card::deactivate($id, $mode);
     $this->action_one();
 }
Пример #2
0
Файл: Card.php Проект: ras263/lc
 public static function get_all($sort_query = ' ORDER BY serial, number')
 {
     $db = new DB();
     $query = 'SELECT c.card_id, s.name serial, c.number, c.release_date, c.end_date, c.status, (
         SELECT COUNT( bill_number )
         FROM bills
         WHERE card_id = c.card_id
         ) AS purchases
         FROM cards c
         NATURAL JOIN cards_series s WHERE s.serial_id <> ' . ADMCARDSERIAL . ' ' . $sort_query;
     $data = $db->query_all($query, 'Card') or die($sort_query);
     foreach ($data as $obj) {
         if ((string) $obj->end_date < ($current_date = (string) date('Y-m-d H:i:s'))) {
             $obj->status = 2;
             Card::deactivate($obj->card_id, 2);
         }
     }
     return $data;
 }