-
Kunden pro Provider
+
Kunden je Partner
diff --git a/application/Voiceplan/Voiceplan.php b/application/Voiceplan/Voiceplan.php
index dcf4a610e..3850fbfd2 100644
--- a/application/Voiceplan/Voiceplan.php
+++ b/application/Voiceplan/Voiceplan.php
@@ -19,7 +19,8 @@ class Voiceplan extends mfBaseModel {
$i = 0;
$filename = $file->getFullPath();
$input = fopen($filename, "r");
- while($csv = fgetcsv($input, 0, ";")) {
+ //while($csv = fgetcsv($input, 0, ";")) {
+ while($csv = fgetcsv($input, 0, ",")) {
$i++;
if($i == 1) continue;
@@ -74,6 +75,8 @@ class Voiceplan extends mfBaseModel {
}
}
+ $this->checkFixpriceZones();
+
if($errors) {
$this->import_errors = $errors;
}
@@ -95,7 +98,8 @@ class Voiceplan extends mfBaseModel {
$i = 0;
$filename = $file->getFullPath();
$input = fopen($filename, "r");
- while($csv = fgetcsv($input, 0, ";")) {
+ //while($csv = fgetcsv($input, 0, ";")) {
+ while($csv = fgetcsv($input, 0, ",")) {
$i++;
if($i == 1) continue;
@@ -117,6 +121,8 @@ class Voiceplan extends mfBaseModel {
$price_vk = (float)$price_ek * (float)$this->price_multiplicator;
}
+
+
if((!$name || !$price_ek) && $extref != "900") {
$this->log->warning(__METHOD__.": not importing Voiceplanzone with empty value: name: $name | ek: $price_ek");
continue;
@@ -145,6 +151,27 @@ class Voiceplan extends mfBaseModel {
}
}
+ public function checkFixpriceZones() {
+ $destinations = [];
+ foreach(VoiceplandestinationModel::search(["voiceplan_id" => $this->id, "prefix" => "438%"]) as $dest) {
+ if(!preg_match('/^4386/', $dest->prefix)) {
+ $destinations[] = $dest;
+ }
+ }
+ foreach(VoiceplandestinationModel::search(["voiceplan_id" => $this->id, "prefix" => "439%"]) as $dest) {
+ $destinations[] = $dest;
+ }
+
+ foreach($destinations as $dest) {
+ if($dest->voiceplanzone->purchase_price != $dest->voiceplanzone->price) {
+ $dest->voiceplanzone->price = $dest->voiceplanzone->purchase_price;
+ $dest->voiceplanzone->save();
+ }
+ }
+
+ return true;
+ }
+
public function getProperty($name) {
if($this->$name == null) {
diff --git a/application/Voiceplandestination/Voiceplandestination.php b/application/Voiceplandestination/Voiceplandestination.php
index 1b23dc441..d140c6367 100644
--- a/application/Voiceplandestination/Voiceplandestination.php
+++ b/application/Voiceplandestination/Voiceplandestination.php
@@ -4,6 +4,7 @@ class Voiceplandestination extends mfBaseModel {
protected $forcestr = ["name", "destination", "prefix"];
private $voiceplan;
+ private $voiceplanzone;
public function getProperty($name) {
if($this->$name == null) {
diff --git a/application/Voiceplandestination/VoiceplandestinationModel.php b/application/Voiceplandestination/VoiceplandestinationModel.php
index 29132541e..fe9b88164 100644
--- a/application/Voiceplandestination/VoiceplandestinationModel.php
+++ b/application/Voiceplandestination/VoiceplandestinationModel.php
@@ -106,7 +106,7 @@ class VoiceplandestinationModel {
$res = $db->query($sql);
- //mfLoghandler::singleton()->debug($sql);
+ mfLoghandler::singleton()->debug($sql);
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {