Order: Save Voicenumber when saving Order and check if number exists

This commit is contained in:
Frank Schubert
2025-04-22 20:55:49 +02:00
parent eb197ac266
commit 1ad771f527
6 changed files with 124 additions and 4 deletions

View File

@@ -315,7 +315,35 @@ class ContractModel {
return $items;
}
public static function getFirstActive($filter) {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$sql = "SELECT Contract.* FROM Contract
LEFT JOIN Address ON (Contract.owner_id = Address.id)
LEFT JOIN OrderProduct ON (Contract.orderproduct_id = OrderProduct.id)
LEFT JOIN `Order` ON (OrderProduct.order_id = `Order`.id)
LEFT JOIN Product ON (Contract.product_id = Product.id)
WHERE $where
AND (cancel_date IS NULL OR cancel_date > UNIX_TIMESTAMP())
GROUP BY Contract.id
ORDER BY Contract.`create`,Contract.id
LIMIT 1";
//var_dump($sql);exit;
$res = $db->query($sql);
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new Contract($data);
if($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function getFirst($filter) {
$db = FronkDB::singleton();