WIP Contract/Billing 2024-06-20

This commit is contained in:
Frank Schubert
2024-06-21 12:10:04 +02:00
parent 92724ca6b5
commit da52a802ef
11 changed files with 752 additions and 29 deletions

View File

@@ -34,28 +34,14 @@ class AddresstypeModel {
return $model;
}
public static function getOne($id) {
if(!is_numeric($id) || !$id) {
throw new Exception("Invalid number", 400);
}
$item = [];
$db = FronkDB::singleton();
$res = $db->select($this->table, "*", "id=$id LIMIT 1");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new Addresstype($data);
}
return $item;
}
public static function getAll() {
$items = [];
$db = FronkDB::singleton();
$res = $db->select($this->table, "*");
$res = $db->select("Addresstype", "*");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new Addresstype($data);