/var/www/doncode.com.ua/www/libs
NameSizeModeActions
class.ajax.php7940644editdlrm
class.Barcode.php459360644editdlrm
class.BarcodeEAN.php24320644editdlrm
class.BarcodeI25.php21710644editdlrm
class.barcode_code_39.php33610644editdlrm
class.bootstrap.php143400644editdlrm
class.command.php5680644editdlrm
class.controller.php11160644editdlrm
class.cron.php8440644editdlrm
class.database.php20650644editdlrm
class.dcu_api.php28050644editdlrm
class.form.php29100644editdlrm
class.gd.php89750644editdlrm
class.hash.php2100644editdlrm
class.mail.php52130644editdlrm
class.model.php39450644editdlrm
class.num_to_string.php40160644editdlrm
class.order.php46300644editdlrm
class.payment.php13800644editdlrm
class.session.php11780644editdlrm
class.transfer_scales.php106260644editdlrm
class.validate.php26140644editdlrm
class.view.php15620644editdlrm
Edit: /var/www/doncode.com.ua/www/libs/class.order.php (4630B)
database = new database(DB_TYPE,DB_HOST,DB_NAME,DB_USER,DB_PASS,ENCODE); $this->mail = new mail(); $this->count = 0; $this->def_order= array( 'id' => 0, 'ontime' => 0, 'createdate' => '', 'ontimedate' => '', 'ontimetime' => '' ); $this->def_json= array( 'fio' => '', 'phone' => '', 'adres' => '', 'house' => '', 'porch' => '', 'object' => 0, 'comment' => '', 'thecity' => 0, 'addcost' => 0, 'cost' => 0, 'options' => array(), 'adresX' => array(array( 'adres' => '', 'house' => '', 'object' => 0 )) ); } final public function cities($where=''){ try{ $sth = $this->database->prepare("SELECT do.city_id,co.country_name_ru as country,r.region_name_ru as region,c.city_name_ru as city FROM `".DB_PREFIX."orders` do INNER JOIN city_ c ON c.`id_city` = do.`city_id` INNER JOIN region_ r ON r.`id_region` = c.`id_region` INNER JOIN country_ co ON co.`id_country` = c.`id_country` WHERE ".$where." GROUP BY do.`city_id`"); $sth->execute(); $data = $sth->fetchAll(PDO::FETCH_ASSOC); }catch(PDOException $e){ return $e->getMessage(); } //var_export($data);exit; return $data; } final public function count ($where=''){ $sql = "SELECT count(do.id) FROM `".DB_PREFIX."orders` AS do WHERE ".$where; $sth= $this->database->prepare($sql); $sth->execute(); if ($sth->rowCount() > 0) { $row = $sth->fetch(); return $row['count(do.id)']; } return 0; } final public function select ($where=''){ $sql = "SELECT do.*, doa.json, so.name as status_name, so.color as status_color, so.id as status_code, c.city_name_ru as city, r.region_name_ru as region, co.country_name_ru as country, co.currency FROM `".DB_PREFIX."orders` AS do INNER JOIN `".DB_PREFIX."orders_adres` AS doa ON(do.id=doa.order_id) INNER JOIN `".DB_PREFIX."status_order` AS so ON(do.status_id=so.id) LEFT JOIN `city_` AS c ON(c.id_city=do.city_id) LEFT JOIN `region_` AS r ON(c.id_region=r.id_region) LEFT JOIN `country_` AS co ON(c.id_country=co.id_country) WHERE ".$where; $sth= $this->database->prepare($sql); $sth->execute(); if ($sth->rowCount() > 0) { $this->setCount($sth->rowCount()); while($row = $sth->fetch(PDO::FETCH_ASSOC)){ $order = $this->def_order; $json = $this->def_json; if(isset($row['json'])){$row_json = json_decode($row['json'],true);} $row['json'] = array_merge($json,$row_json); $result[] = array_merge($order,$row); } }else{ $order = $this->def_order; $order['json'] = $this->def_json; $result[] = $order; } return $result; } final public function select_one ($where=''){ $res = $this->select($where); return $res[0]; } final public function cancel ($order_id,$status_id){ $count = $this->database->update(DB_PREFIX.'orders',array( 'status' =>'cancel', 'status_id' => $status_id, 'complitedate' => date("Y-m-d H:i:s") ),"id={$order_id} AND status!='cancel' AND status!='complite'"); if($count>0){ $result['cmd'] = 'cancel_order'; $result['order_id'] = $order_id; command::send(json_encode($result)); return true; $message = '

Привет админ


У тебя '.$c.' новых заказов

Вход нажми здесь '; //$this->mail->send('g0502212339@gmail.com', "Крон", $message); }else{ return false; } } private function setCount($count){ $this->count = $count; } final public function getCount(){ return $this->count; } }