Fixed Voicenumber and Updated Voiceplan
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user