Overhauled Address linking

This commit is contained in:
Frank Schubert
2022-06-29 17:16:14 +02:00
parent bbfc6c6eb5
commit 2d09924372
12 changed files with 637 additions and 74 deletions

View File

@@ -36,7 +36,8 @@ class AddressLinkModel {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("AddressLink", "*", "$where ORDER BY address_id,`create`,origin_address_idLIMIT 1");
$res = $db->select("AddressLink", "*", "$where ORDER BY address_id,`create`,origin_address_id LIMIT 1");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new AddressLink($data);
@@ -125,6 +126,23 @@ class AddressLinkModel {
}
}
if(array_key_exists("type", $filter)) {
switch($filter['type']) {
case "employee":
$where .= " AND type='employee'";
break;
case "billing":
$where .= " AND type='billing'";
break;
case "contact":
$where .= " AND type='contact'";
break;
case "techcontact":
$where .= " AND type='techcontact'";
break;
}
}
return $where;
}