Fixed Voicenumber and Updated Voiceplan

This commit is contained in:
Frank Schubert
2023-11-14 20:15:06 +01:00
parent 003ab67145
commit cc4a751407
20 changed files with 232 additions and 662 deletions

View File

@@ -2,6 +2,7 @@
class VoiceplanzoneModel {
public $voiceplan_id;
public $extref;
public $name;
public $purchase_price;
public $price;
@@ -55,7 +56,7 @@ class VoiceplanzoneModel {
}
public static function getFirst() {
public static function getFirst($filter = []) {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
@@ -72,7 +73,7 @@ class VoiceplanzoneModel {
return null;
}
public static function count($filter) {
public static function count($filter = []) {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
@@ -88,7 +89,7 @@ class VoiceplanzoneModel {
return 0;
}
public static function search($filter) {
public static function search($filter = [], $limit = []) {
$items = [];
$db = FronkDB::singleton();
@@ -98,6 +99,14 @@ class VoiceplanzoneModel {
WHERE $where
ORDER BY voiceplan_id,name";
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)) {
$sql .= " LIMIT ".$limit['count'];
}
}
$res = $db->query($sql);
if($db->num_rows($res)) {
@@ -127,6 +136,13 @@ class VoiceplanzoneModel {
}
}
if(array_key_exists("extref", $filter)) {
$extref = FronkDB::singleton()->escape($filter['extref']);
if($extref) {
$where .= " AND extref='$extref'";
}
}
//var_dump($filter, $where);exit;
return $where;
}