Preorder: Status can now be changed manually

This commit is contained in:
Frank Schubert
2023-11-07 13:00:29 +01:00
parent bd3489f6e4
commit 79fe0aa00e
18 changed files with 367 additions and 69 deletions
+38
View File
@@ -65,6 +65,44 @@ class Voiceplan extends mfBaseModel {
}
}
public function importZonesFromCsv(File $file) {
if(!$this->id) {
return false;
}
try {
$i = 0;
$filename = $file->getFullPath();
$input = fopen($filename, "r");
while($csv = fgetcsv($input, 0, ",")) {
$i++;
if($i == 1) continue;
if(!trim($csv[0])) {
continue;
}
$name = trim($csv[0]);
$prefix = trim($csv[1]);
$price_ek = str_replace(",",".", trim($csv[2]));
$price_vk = str_replace(",",".", trim($csv[3]));
if(!$name || !$prefix || !$price_ek || !$price_vk) {
$this->log->warning("not Importing Voiceplandestination with empty value: destination: $name | prefix: $prefix | ek: $price_ek | vk: $price_vk");
continue;
}
}
return true;
} catch(Exception $e) {
echo $e->getCode().": ".$e->getMessage();exit;
return false;
}
}
public function getProperty($name) {
if($this->$name == null) {