|
@@ -1,108 +0,0 @@
|
|
|
-<?php
|
|
|
|
|
-
|
|
|
|
|
-require_once("../DataBase/database.php");
|
|
|
|
|
-
|
|
|
|
|
-class Customer
|
|
|
|
|
-{
|
|
|
|
|
- function Customer()
|
|
|
|
|
- {
|
|
|
|
|
- $this->db = new Database();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function create($customer_id, $value)
|
|
|
|
|
- {
|
|
|
|
|
- $query = "INSERT INTO ".$this->db->customer_table." VALUES('".$customer_id."'";
|
|
|
|
|
- for($i = 0; $i < count($value); $i++)
|
|
|
|
|
- $query .= ", '".str_replace("'", "\'", $value[$i])."'";
|
|
|
|
|
- $query .= ")";
|
|
|
|
|
-
|
|
|
|
|
- $this->db->query($query);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function update($customer_id, $value)
|
|
|
|
|
- {
|
|
|
|
|
- $query = "UPDATE ".$this->db->customer_table." SET ";
|
|
|
|
|
- $query .= "password='".str_replace("'", "\'", $value[0])."', ";
|
|
|
|
|
- $query .= "prename='".str_replace("'", "\'", $value[1])."', ";
|
|
|
|
|
- $query .= "postname='".$value[2]."', ";
|
|
|
|
|
- $query .= "street='".$value[3]."', ";
|
|
|
|
|
- $query .= "streetnumber='".$value[4]."', ";
|
|
|
|
|
- $query .= "plz='".$value[5]."', ";
|
|
|
|
|
- $query .= "city='".$value[6]."', ";
|
|
|
|
|
- $query .= "telephone='".$value[7]."', ";
|
|
|
|
|
- $query .= "telefax='".$value[8]."', ";
|
|
|
|
|
- $query .= "email='".$value[9]."', ";
|
|
|
|
|
- $query .= "pricelist_id='".$value[10]."', ";
|
|
|
|
|
- $query .= "tour_id='".$value[11]."', ";
|
|
|
|
|
- $query .= "rabatt='".$value[12]."', ";
|
|
|
|
|
- $query .= "details='".$value[13]."', ";
|
|
|
|
|
- $query .= "bank_name='".$value[14]."', ";
|
|
|
|
|
- $query .= "bank_account='".$value[15]."', ";
|
|
|
|
|
- $query .= "blz='".$value[16]."' ";
|
|
|
|
|
-
|
|
|
|
|
- $query .= "WHERE customer_id='".$customer_id."'";
|
|
|
|
|
-
|
|
|
|
|
- $this->db->query($query);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function delete($customer_id)
|
|
|
|
|
- {
|
|
|
|
|
- $query = "DELETE FROM ".$this->db->customer_table." WHERE customer_id='$customer_id'";
|
|
|
|
|
-
|
|
|
|
|
- $this->db->query($query);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function exists($customer_id)
|
|
|
|
|
- {
|
|
|
|
|
- $query = "SELECT customer_id FROM ".$this->db->customer_table." WHERE customer_id='".$customer_id."'";
|
|
|
|
|
-
|
|
|
|
|
- $result = $this->db->fetchRows($this->db->query($query));
|
|
|
|
|
-
|
|
|
|
|
- if(count($result) > 0)
|
|
|
|
|
- return true;
|
|
|
|
|
- else
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function get($customer_id = "", $row_names = array(), $search = "")
|
|
|
|
|
- {
|
|
|
|
|
- if($customer_id == "")
|
|
|
|
|
- {
|
|
|
|
|
- if(count($row_names) == 0)
|
|
|
|
|
- $query = "SELECT * FROM ".$this->db->customer_table;
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- $query = "SELECT ".$row_names[0];
|
|
|
|
|
- for($i = 1; $i < count($row_names); $i++)
|
|
|
|
|
- $query .= ", ".$row_names[$i];
|
|
|
|
|
- $query .= " FROM ".$this->db->customer_table;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if($search != "")
|
|
|
|
|
- $query .= " WHERE ".$search;
|
|
|
|
|
-
|
|
|
|
|
- $query .= " ORDER BY customer_id ASC";
|
|
|
|
|
-
|
|
|
|
|
- return $this->db->fetchRows($this->db->query($query));
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- if(count($row_names) == 0)
|
|
|
|
|
- $query = "SELECT * FROM ".$this->db->customer_table;
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- $query = "SELECT ".$row_names[0];
|
|
|
|
|
- for($i = 1; $i < count($row_names); $i++)
|
|
|
|
|
- $query .= ", ".$row_names[$i];
|
|
|
|
|
- $query .= " FROM ".$this->db->customer_table;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $query .= " WHERE customer_id='".$customer_id."'";
|
|
|
|
|
- $query .= " ORDER BY customer_id ASC";
|
|
|
|
|
-
|
|
|
|
|
- return $this->db->fetchRows($this->db->query($query));
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-?>
|
|
|