mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Sendcloud ParcelCreation added additional rules for DPD
This commit is contained in:
parent
56cfc54aa5
commit
8c1f434833
@ -12,19 +12,29 @@ class ParcelCreation extends ParcelBase
|
|||||||
{
|
{
|
||||||
public ?int $SenderAddressId = null;
|
public ?int $SenderAddressId = null;
|
||||||
|
|
||||||
// const DEFAUlT_LENGTH = 150;
|
|
||||||
|
|
||||||
public function toApiRequest(): array
|
public function toApiRequest(): array
|
||||||
{
|
{
|
||||||
|
|
||||||
define("DEFAULT_LENGTH", 150);
|
define("DEFAULT_LENGTH", 150);
|
||||||
|
|
||||||
|
// DPD-special condition, to be checked in detail
|
||||||
|
$address_2 = substr($this->Adress2, 0, 35);
|
||||||
|
$company_name = substr($this->CompanyName, 0, 35);
|
||||||
|
$length = strlen($address_2)+strlen($company_name);
|
||||||
|
if ($length > 34) {
|
||||||
|
$company_name_length = 34-strlen($address_2);
|
||||||
|
if ($company_name_length < 0) {
|
||||||
|
$company_name_lenght = 0;
|
||||||
|
}
|
||||||
|
$company_name = substr($company_name, 0, $company_name_length);
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'name' => substr($this->Name, 0, 75),
|
'name' => substr($this->Name, 0, 35),
|
||||||
'company_name' => substr($this->CompanyName, 0, 50),
|
'company_name' => $company_name,
|
||||||
'address' => substr($this->Address, 0, 75),
|
'address' => substr($this->Address, 0, 35),
|
||||||
'address_2' => substr($this->Address2, 0, 75),
|
'address_2' => $address_2,
|
||||||
'house_number' => substr($this->HouseNumber, 0, 20),
|
'house_number' => substr($this->HouseNumber, 0, 8),
|
||||||
'city' => substr($this->City, 0, 30),
|
'city' => substr($this->City, 0, 30),
|
||||||
'postal_code' => substr($this->PostalCode, 0, 12),
|
'postal_code' => substr($this->PostalCode, 0, 12),
|
||||||
'telephone' => substr($this->Telephone, 0, 20),
|
'telephone' => substr($this->Telephone, 0, 20),
|
||||||
@ -56,3 +66,4 @@ class ParcelCreation extends ParcelBase
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user