WIP Voicenumber Billing 2024-07-05

This commit is contained in:
Frank Schubert
2024-07-06 18:37:40 +02:00
parent 92edb9c812
commit 200af4802a
16 changed files with 417 additions and 220 deletions

View File

@@ -8,7 +8,36 @@ class Voiceplan extends mfBaseModel {
private $destinations;
public $import_errors;
public function getDestinationByNumber($number) {
if(!$number) return false;
$prefix = $number;
while(strlen($prefix)) {
$destination = VoiceplandestinationModel::getFirst(["prefix" => $prefix, "voiceplan_id" => $this->id]);
if($destination) {
break;
}
$prefix = substr($prefix, 0, strlen($prefix) - 1);
}
if(!$destination) return false;
return $destination;
}
public function getZoneByNumber($number) {
if(!$number) return false;
$destination = $this->getDestinationByNumber($number);
if(!$destination) return false;
return $destination->voiceplanzone;
}
public function importDestinationsFromCsv(File $file) {
if(!$this->id) {
return false;
@@ -169,7 +198,7 @@ class Voiceplan extends mfBaseModel {
return true;
}
public function getProperty($name) {
if($this->$name == null) {