Voiceplan Import: Added price multiplicator

This commit is contained in:
Frank Schubert
2023-12-05 19:34:06 +01:00
parent 8272b82bc6
commit 171633b904
8 changed files with 54 additions and 7 deletions
+8 -4
View File
@@ -19,7 +19,7 @@ class Voiceplan extends mfBaseModel {
$i = 0;
$filename = $file->getFullPath();
$input = fopen($filename, "r");
while($csv = fgetcsv($input, 0, ";")) {
while($csv = fgetcsv($input, 0, ",")) {
$i++;
if($i == 1) continue;
@@ -95,14 +95,13 @@ class Voiceplan extends mfBaseModel {
$i = 0;
$filename = $file->getFullPath();
$input = fopen($filename, "r");
while($csv = fgetcsv($input, 0, ";")) {
while($csv = fgetcsv($input, 0, ",")) {
$i++;
if($i == 1) continue;
if(!trim($csv[0])) {
continue;
}
$name = trim($csv[0]);
$extref = trim($csv[1]);
$price_default = str_replace(",",".", trim($csv[4]));
@@ -113,6 +112,11 @@ class Voiceplan extends mfBaseModel {
$price_ek = $price_special;
}
$price_vk = 0;
if($price_ek && $this->price_multiplicator) {
$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;
@@ -123,7 +127,7 @@ class Voiceplan extends mfBaseModel {
"extref" => $extref,
"name" => $name,
"purchase_price" => $price_ek,
"price" => 0,
"price" => $price_vk,
"increment_first" => $this->increment_first,
"increment" => $this->increment
]);