diff --git a/Layout/default/Voicenumberblock/Index.php b/Layout/default/Voicenumberblock/Index.php index b6f6b8c16..53c6bc609 100644 --- a/Layout/default/Voicenumberblock/Index.php +++ b/Layout/default/Voicenumberblock/Index.php @@ -113,10 +113,9 @@
| ID | Name | -Country Code | -Area Code | +Landeskennzahl | +Ortskennzahl | Anfang | Ende | Kommentar | @@ -124,12 +123,11 @@|
|---|---|---|---|---|---|---|---|---|---|
| =$block->id?> | =$block->name?> | =$block->countrycode?> | =$block->areacode?> | -=$block->first?> | -=$block->last?> | +=$block->getFirst()?> | +=$block->getLast()?> | =$block->comment?> | $block->id])?>"> diff --git a/application/Voicenumberblock/Voicenumberblock.php b/application/Voicenumberblock/Voicenumberblock.php index b6ceb3a57..35d20085e 100644 --- a/application/Voicenumberblock/Voicenumberblock.php +++ b/application/Voicenumberblock/Voicenumberblock.php @@ -9,15 +9,29 @@ class Voicenumberblock extends mfBaseModel { private function getFullNumber($last = false) { if($last) { - $number = $this->countrycode.$this->areacode.$this->last; + $number = $this->countrycode.$this->areacode.$this->getLast(); } else { - $number = $this->countrycode.$this->areacode.$this->first; + $number = $this->countrycode.$this->areacode.$this->getFirst(); } return $number; - } + public function getFirst() { + if($this->number_add_zero) { + return "0".$this->first; + } + return $this->first; + } + + public function getLast() { + if($this->number_add_zero) { + return "0".$this->last; + } + return $this->last; + } + + public function getProperty($name) { if($this->$name == null) { diff --git a/application/Voicenumberblock/VoicenumberblockController.php b/application/Voicenumberblock/VoicenumberblockController.php index 2afb7f2d3..2d534e621 100644 --- a/application/Voicenumberblock/VoicenumberblockController.php +++ b/application/Voicenumberblock/VoicenumberblockController.php @@ -97,8 +97,15 @@ class VoicenumberblockController extends mfBaseController { $data['name'] = $r->name; $data['countrycode'] = $r->countrycode; $data['areacode'] = $r->areacode; + + if(substr($r->first,0,1) === "0") { + $data['number_add_zero'] = 1; + } else { + $data['number_add_zero'] = 0; + } $data['first'] = $r->first; $data['last'] = $r->last; + $data['comment'] = $r->comment; $data['edit_by'] = $this->me->id; diff --git a/application/Voicenumberblock/VoicenumberblockModel.php b/application/Voicenumberblock/VoicenumberblockModel.php index a0bfed784..37396d897 100644 --- a/application/Voicenumberblock/VoicenumberblockModel.php +++ b/application/Voicenumberblock/VoicenumberblockModel.php @@ -6,6 +6,7 @@ class VoicenumberblockModel { public $areacode; public $first; public $last; + public $number_add_zero; public $comment; public $create_by; @@ -89,6 +90,7 @@ class VoicenumberblockModel { $db = FronkDB::singleton(); $where = self::getSqlFilter($filter); + mfLoghandler::singleton()->debug($where); //mfLoghandler::singleton()->log->debug($where); $res = $db->select("Voicenumberblock", "*", "$where ORDER BY countrycode, areacode, first, last"); if($db->num_rows($res)) { @@ -123,23 +125,56 @@ class VoicenumberblockModel { } if(array_key_exists("first", $filter)) { + $add_zero = false; $first = $filter['first']; + + mfLoghandler::singleton()->debug($first); + + if(substr($first,0, 1) === "0") { + $add_zero = true; + $first = substr($first, 1); + } + if(is_numeric($first)) { $where .= " AND first like '%$first%'"; + if($add_zero) { + $where .= " AND number_add_zero = 1"; + } } } if(array_key_exists("last", $filter)) { + $add_zero = false; $last = $filter['last']; + + mfLoghandler::singleton()->debug($last); + + if(substr($last,0, 1) === "0") { + $add_zero = true; + $last = substr($last, 1); + } + if(is_numeric($last)) { - $where .= " AND last= like '%$last%'"; + $where .= " AND last like '%$last%'"; } } if(array_key_exists("number", $filter)) { + $add_zero = false; $number = $filter['number']; + + mfLoghandler::singleton()->debug($number); + + if(substr($number,0, 1) === "0") { + $add_zero = true; + $number = substr($number, 1); + } if(is_numeric($number)) { $where .= " AND first <= $number AND last >= $number"; + + if($add_zero) { + $where .= " AND number_add_zero = 1"; + } } } |