WIP Contracts 2024-06-05

This commit is contained in:
Frank Schubert
2024-06-05 16:26:19 +02:00
parent 2855a45208
commit 51d2f7717a
5 changed files with 104 additions and 43 deletions
@@ -15,7 +15,7 @@ class IvtCustomerProductModel {
$res = $db->select("customer_product", "*", "1=1 ORDER BY $order");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new IvtCustomerTelephoneNr($data);
$items[] = new IvtCustomerProduct($data);
}
}
return $items;
@@ -28,7 +28,7 @@ class IvtCustomerProductModel {
$res = $db->select("customer_product", "*", "$where ORDER BY id LIMIT 1");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new IvtCustomerTelephoneNr($data);
$item = new IvtCustomerProduct($data);
if($item->id) {
return $item;
} else {
@@ -63,7 +63,7 @@ class IvtCustomerProductModel {
if(is_array($limit) && count($limit)) {
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
} elseif(is_numeric($count)) {
} elseif(is_numeric($limit['count'])) {
$sql .= " LIMIT ".$limit['count'];
}
}
@@ -71,7 +71,7 @@ class IvtCustomerProductModel {
$res = $db->query($sql);
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new IvtCustomerTelephoneNr($data);
$items[] = new IvtCustomerProduct($data);
}
}
return $items;
@@ -79,24 +79,7 @@ class IvtCustomerProductModel {
private static function getSqlFilter($filter) {
$where = "1=1 ";
/*
if(array_key_exists("status_id", $filter)) {
$status_id = $filter['status_id'];
if(is_numeric($status_id)) {
$where .= " AND IvtCustomerProduct.status_id=$status_id";
}
}
if(array_key_exists("street", $filter)) {
$street = FronkDB::singleton()->escape($filter["street"]);
if($street) {
$where .= " AND street like '%$street%'";
}
}
*/
if(array_key_exists("cid", $filter)) {
$cid = $filter['cid'];
if(is_numeric($cid)) {
@@ -118,10 +101,11 @@ class IvtCustomerProductModel {
}
}
if(array_key_exists("last_date>", $filter)) {
$last_date = $filter['last_date>'];
if(is_numeric($last_date)) {
$where .= " AND last_date >=$last_date";
//var_dump($filter);exit;
if(array_key_exists("lastdate>", $filter)) {
$lastdate = $filter['lastdate>'];
if($lastdate) {
$where .= " AND lastdate >= $lastdate";
}
}