|
|
@@ -9,13 +9,9 @@ class Priceset
|
|
|
$this->db = new Database();
|
|
|
}
|
|
|
|
|
|
- function create($priceset_id, $value)
|
|
|
+ function create($name, $netto)
|
|
|
{
|
|
|
- $query = "INSERT INTO ".$this->db->priceset_table." VALUES('".$priceset_id."'";
|
|
|
- for($i = 0; $i < count($value); $i++)
|
|
|
- $query .= ", '".str_replace("'", "\'", $value[$i])."'";
|
|
|
- $query .= ")";
|
|
|
-
|
|
|
+ $query = "INSERT INTO ".$this->db->priceset_table." (name, netto) VALUES ('".str_replace("'", "\'", $name)."', ".$netto.")";
|
|
|
$this->db->query($query);
|
|
|
}
|
|
|
|
|
|
@@ -23,23 +19,27 @@ class Priceset
|
|
|
{
|
|
|
$query = "UPDATE ".$this->db->priceset_table." SET ";
|
|
|
$query .= "name='".$value[0]."', ";
|
|
|
- $query .= "netto='".$value[1]."' ";
|
|
|
|
|
|
- $query .= "WHERE priceset_id='".$priceset_id."'";
|
|
|
+ if (!$value[1])
|
|
|
+ $query .= "netto=0 ";
|
|
|
+ else
|
|
|
+ $query .= "netto=1 ";
|
|
|
+
|
|
|
+ $query .= "WHERE priceset_id=".$priceset_id."";
|
|
|
|
|
|
$this->db->query($query);
|
|
|
}
|
|
|
|
|
|
function delete($priceset_id)
|
|
|
{
|
|
|
- $query = "DELETE FROM ".$this->db->priceset_table." WHERE priceset_id='$priceset_id'";
|
|
|
+ $query = "DELETE FROM ".$this->db->priceset_table." WHERE priceset_id=".$priceset_id."";
|
|
|
|
|
|
$this->db->query($query);
|
|
|
}
|
|
|
|
|
|
function exists($priceset_id)
|
|
|
{
|
|
|
- $query = "SELECT priceset_id FROM ".$this->db->priceset_table." WHERE priceset_id='".$priceset_id."'";
|
|
|
+ $query = "SELECT priceset_id FROM ".$this->db->priceset_table." WHERE priceset_id=".$priceset_id."";
|
|
|
|
|
|
$result = $this->db->fetchRows($this->db->query($query));
|
|
|
|
|
|
@@ -82,7 +82,7 @@ class Priceset
|
|
|
$query .= " FROM ".$this->db->priceset_table;
|
|
|
}
|
|
|
|
|
|
- $query .= " WHERE priceset_id='".$priceset_id."'";
|
|
|
+ $query .= " WHERE priceset_id=".$priceset_id."";
|
|
|
$query .= " ORDER BY priceset_id ASC";
|
|
|
|
|
|
return $this->db->fetchRows($this->db->query($query));
|