27-05-2026 Update DHL Modul v2.0
This commit is contained in:
parent
53bdba33cd
commit
036595be94
41 changed files with 3346 additions and 310 deletions
|
|
@ -3,6 +3,8 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Setting;
|
||||
use App\Services\DhlProductResolver;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Request;
|
||||
|
||||
class SettingController extends Controller
|
||||
|
|
@ -36,9 +38,9 @@ class SettingController extends Controller
|
|||
// DHL-spezifische Behandlung
|
||||
if ($data['action'] === 'save_dhl') {
|
||||
$this->updateDhlConfigCache();
|
||||
\Session()->flash('alert-save-dhl', 'DHL Konfiguration erfolgreich gespeichert!');
|
||||
Session::flash('alert-save-dhl', 'DHL Konfiguration erfolgreich gespeichert!');
|
||||
} else {
|
||||
\Session()->flash('alert-save', '1');
|
||||
Session::flash('alert-save', '1');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -72,10 +74,12 @@ class SettingController extends Controller
|
|||
'test_mode' => config('dhl.legacy.test_mode', true),
|
||||
|
||||
// Product Settings
|
||||
'default_product' => $this->getConfigValue('dhl_product', config('dhl.default_product'), $useEnvPriority),
|
||||
'default_product' => $this->normalizeDhlProductCode($this->getConfigValue('dhl_product', config('dhl.default_product'), $useEnvPriority)),
|
||||
'international_countries' => $this->getDhlInternationalCountries($useEnvPriority),
|
||||
'label_format' => $this->getConfigValue('dhl_label_format', config('dhl.label_format'), $useEnvPriority),
|
||||
'print_format' => $this->getConfigValue('dhl_print_format', config('dhl.print_format'), $useEnvPriority),
|
||||
'retoure_print_format' => $this->getConfigValue('dhl_retoure_print_format', config('dhl.retoure_print_format'), $useEnvPriority),
|
||||
'print_only_if_codeable' => (bool) $this->getConfigValue('dhl_print_only_if_codeable', config('dhl.print_only_if_codeable'), $useEnvPriority),
|
||||
'use_queue' => $this->getConfigValue('dhl_use_queue', config('dhl.use_queue'), $useEnvPriority),
|
||||
|
||||
// Sender Address
|
||||
|
|
@ -94,7 +98,7 @@ class SettingController extends Controller
|
|||
// Account Numbers
|
||||
'account_numbers' => [
|
||||
'V01PAK' => $this->getConfigValue('dhl_account_v01pak', config('dhl.account_numbers.V01PAK'), $useEnvPriority),
|
||||
'V62WP' => $this->getConfigValue('dhl_account_v62wp', config('dhl.account_numbers.V62WP'), $useEnvPriority),
|
||||
'V62KP' => $this->getConfigValue('dhl_account_v62kp', $this->getConfigValue('dhl_account_v62wp', config('dhl.account_numbers.V62KP'), $useEnvPriority), $useEnvPriority),
|
||||
'V53PAK' => $this->getConfigValue('dhl_account_v53pak', config('dhl.account_numbers.V53PAK'), $useEnvPriority),
|
||||
'V07PAK' => $this->getConfigValue('dhl_account_v07pak', config('dhl.account_numbers.V07PAK'), $useEnvPriority),
|
||||
'default' => config('dhl.account_numbers.default'),
|
||||
|
|
@ -103,7 +107,7 @@ class SettingController extends Controller
|
|||
// Dimensions
|
||||
'dimensions' => [
|
||||
'V01PAK' => config('dhl.dimensions.V01PAK'),
|
||||
'V62WP' => config('dhl.dimensions.V62WP'),
|
||||
'V62KP' => config('dhl.dimensions.V62KP'),
|
||||
'V53PAK' => config('dhl.dimensions.V53PAK'),
|
||||
'V07PAK' => config('dhl.dimensions.V07PAK'),
|
||||
'default' => config('dhl.dimensions.default'),
|
||||
|
|
@ -136,6 +140,26 @@ class SettingController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
private function normalizeDhlProductCode(?string $productCode): string
|
||||
{
|
||||
return $productCode === 'V62WP' ? 'V62KP' : ($productCode ?: 'V01PAK');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function getDhlInternationalCountries(bool $useEnvPriority): array
|
||||
{
|
||||
$configCountries = config('dhl.international_countries', DhlProductResolver::DEFAULT_INTERNATIONAL_COUNTRIES);
|
||||
$countries = $configCountries;
|
||||
|
||||
if (! $useEnvPriority) {
|
||||
$countries = Setting::getContentBySlug('dhl_international_countries') ?: $configCountries;
|
||||
}
|
||||
|
||||
return DhlProductResolver::normalizeCountryCodeList(is_array($countries) ? $countries : []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update DHL configuration cache after saving settings
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue