Fix flight and subfleet import with edited fares (#1379)
* Fix fare import * StyleFix
This commit is contained in:
parent
09453becf8
commit
7fabd57e13
@ -166,6 +166,27 @@ class ImportExport
|
||||
return [];
|
||||
}
|
||||
|
||||
if (strpos($split_values[0], '?') !== false) {
|
||||
// This contains the query string, which turns it into a multi-level array
|
||||
$query_str = explode('?', $split_values[0]);
|
||||
$parent = trim($query_str[0]);
|
||||
|
||||
$children = [];
|
||||
$kvp = explode('&', trim($query_str[1]));
|
||||
foreach ($kvp as $items) {
|
||||
if (!$items) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->kvpToArray($items, $children);
|
||||
}
|
||||
|
||||
$ret[$parent] = $children;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
// This is not a query string, return it back untouched
|
||||
return [$split_values[0]];
|
||||
}
|
||||
|
||||
|
@ -253,8 +253,9 @@ class FlightImporter extends ImportExport
|
||||
$fare_attributes = [];
|
||||
}
|
||||
|
||||
$fare = Fare::updateOrCreate(['code' => $fare_code], ['name' => $fare_code]);
|
||||
$fare = Fare::firstOrCreate(['code' => $fare_code], ['name' => $fare_code]);
|
||||
$this->fareSvc->setForFlight($flight, $fare, $fare_attributes);
|
||||
$fare->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -84,8 +84,9 @@ class SubfleetImporter extends ImportExport
|
||||
$fare_attributes = [];
|
||||
}
|
||||
|
||||
$fare = Fare::updateOrCreate(['code' => $fare_code], ['name' => $fare_code]);
|
||||
$fare = Fare::firstOrCreate(['code' => $fare_code], ['name' => $fare_code]);
|
||||
$this->fareSvc->setForSubfleet($subfleet, $fare, $fare_attributes);
|
||||
$fare->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user