WIP Voicenumber Billing 2024-07-05
This commit is contained in:
@@ -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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user