public function init($deal_id) { $query = 'SELECT * FROM deal WHERE id = ' . (int) $deal_id; $array = array(); $array = $this->db->select($query); try { if ($array !== FALSE) { $row = $array[0]; $this->id = (int) $row['id']; $this->customer_id = (int) $row['customer_id']; $this->article_id = (int) $row['article_id']; $this->payment_id = (int) $row['payment_id']; $this->shipment_id = (int) $row['shipment_id']; $this->amount = (int) $row['amount']; $this->total_price = (double) $row['total_price']; $this->platform_name = $this->db->res($row['platform_name']); $this->commented = (int) $row['platform_name']; $this->status = (int) $row['status']; $this->extras = $this->db->res($row['extras']); } else { throw new CustomException(); } } catch (CustomException $e) { UtilFunctions::p($e->errorMessage('No deals are found.')); } }
public function init($contact_id = 0, $customer_id = 0) { $query = ''; if ($contact_id > 0) { $query = 'SELECT * FROM contact WHERE id = ' . (int) $contact_id; } else { if ($customer_id > 0) { $query = 'SELECT * FROM contact WHERE customer_id = ' . (int) $customer_id; } } $array = array(); $array = $this->db->select($query); try { if ($array !== FALSE) { $row = $array[0]; $this->id = (int) $row['id']; $this->customer_id = $row['customer_id']; $this->country = $row['country']; $this->zip_code = (int) $row['zip_code']; $this->city = $row['city']; $this->street = $row['street']; $this->street_number = (int) $row['street_number']; $this->street_number_extra = $row['street_number_extra']; $this->room_number = (int) $row['room_number']; $this->phone = $row['phone']; } else { throw new CustomException(); } } catch (CustomException $e) { UtilFunctions::p($e->errorMessage('No contacts are found.')); } }
public function init($article_id) { $query = 'SELECT * FROM article WHERE id = ' . (int) $article_id; $array = array(); $array = $this->db->select($query); try { if ($array !== FALSE) { $row = $array[0]; $this->id = (int) $row['id']; $this->name = $row['name']; $this->price = $row['price']; $this->extras = $row['extras']; } else { throw new CustomException(); } } catch (CustomException $e) { UtilFunctions::p($e->errorMessage('No articles are found.')); } }
public function init($payment_id) { $query = 'SELECT * FROM payment WHERE id = ' . (int) $payment_id; $array = array(); $array = $this->db->select($query); try { if ($array !== FALSE) { $row = $array[0]; $this->id = (int) $row['id']; $this->date = $row['date']; $this->paid_amount = $row['paid_amount']; $this->bank_name = (int) $row['bank_name']; $this->extras = $row['extras']; } else { throw new CustomException(); } } catch (CustomException $e) { UtilFunctions::p($e->errorMessage('No payments are found.')); } }
public function init($shipment_id) { $query = 'SELECT * FROM shipment WHERE id = ' . (int) $shipment_id; $array = array(); $array = $this->db->select($query); try { if ($array !== FALSE) { $row = $array[0]; $this->id = (int) $row['id']; $this->customer_id = (int) $row['customer_id']; $this->number = $row['number']; $this->date = (int) $row['date']; $this->transport_charge = (double) $row['transport_charge']; $this->extras = (double) $row['extras']; } else { throw new CustomException(); } } catch (CustomException $e) { UtilFunctions::p($e->errorMessage('No shipments are found.')); } }
public function init($customer_id) { $query = 'SELECT * FROM customer WHERE id = ' . (int) $customer_id; $array = array(); $array = $this->db->select($query); try { if ($array !== FALSE) { $row = $array[0]; $this->id = (int) $row['id']; $this->last_name = $row['last_name']; $this->first_name = $row['first_name']; $this->middle_name = (int) $row['middle_name']; $this->nick_name = $row['nick_name']; $this->email = $row['email']; $this->extras = $row['extras']; } else { throw new CustomException(); } } catch (CustomException $e) { UtilFunctions::p($e->errorMessage('No customers are found.')); } }
public function init($page_id) { $query = 'SELECT * FROM page WHERE id = ' . (int) $page_id; $array = array(); $array = $this->db->select($query); try { if ($array !== FALSE) { $row = $array[0]; $this->id = (int) $row['id']; $this->slug = $row['slug']; $this->name = $row['name']; $this->place = (int) $row['place']; $this->glyphicon = $row['glyphicon']; $this->class_name = $row['class_name']; $this->active = $row['active']; } else { // TODO throw new CustomException(); } } catch (CustomException $e) { UtilFunctions::p($e->errorMessage('No pages are found.')); } }