Overhauled Address linking
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user