mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-25 06:00:28 +01:00
rework paketmarke contact fields
This commit is contained in:
parent
78dff8b5c1
commit
cbd44d167a
@ -68,6 +68,9 @@ abstract class Versanddienstleister
|
||||
$auftragId = $this->app->DB->Select("SELECT auftragid FROM rechnung WHERE id=$rechnungId LIMIT 1");
|
||||
|
||||
if ($sid === 'rechnung' || $sid === 'lieferschein' || $sid === 'adresse') {
|
||||
|
||||
$ret['addresstype'] = 0; // 0 = firma, 1 = packstation, 2 = postfiliale, 3 = privatadresse
|
||||
|
||||
$docArr = $this->app->DB->SelectRow("SELECT * FROM `$sid` WHERE id = $id LIMIT 1");
|
||||
$ret['addressId'] = $docArr['adresse'];
|
||||
$ret['auftragId'] = $auftragId;
|
||||
@ -79,12 +82,28 @@ abstract class Versanddienstleister
|
||||
|
||||
$ret['original'] = array_filter($docArr, fn($key) => in_array($key, $addressfields), ARRAY_FILTER_USE_KEY);
|
||||
|
||||
$ret['name'] = empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : trim($docArr['ansprechpartner']);
|
||||
$ret['name2'] = !empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : '';
|
||||
$ret['name3'] = join(';', array_filter([
|
||||
$docArr['abteilung'],
|
||||
$docArr['unterabteilung']
|
||||
], fn(string $item) => !empty(trim($item))));
|
||||
if ($docArr['typ'] == "firma") {
|
||||
$ret['company_name'] = $docArr['name'];
|
||||
$ret['addresstype'] = 0;
|
||||
} else {
|
||||
$ret['addresstype'] = 3;
|
||||
}
|
||||
|
||||
$ret['contact_name'] = $docArr['ansprechpartner'];
|
||||
|
||||
$ret['company_division'] = join(
|
||||
';',
|
||||
array_filter(
|
||||
[
|
||||
$docArr['abteilung'],
|
||||
$docArr['unterabteilung']
|
||||
],
|
||||
fn(string $item) => !empty(trim($item))
|
||||
)
|
||||
);
|
||||
|
||||
$ret['name'] = $docArr['name'];
|
||||
|
||||
$ret['address2'] = $docArr['adresszusatz'];
|
||||
|
||||
$ret['city'] = $docArr['ort'];
|
||||
@ -92,7 +111,6 @@ abstract class Versanddienstleister
|
||||
$ret['country'] = $docArr['land'];
|
||||
$ret['phone'] = $docArr['telefon'];
|
||||
$ret['email'] = $docArr['email'];
|
||||
$ret['addresstype'] = 0;
|
||||
|
||||
$strasse = trim($docArr['strasse']);
|
||||
$ret['streetwithnumber'] = $strasse;
|
||||
|
@ -18,29 +18,34 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
<td>{|Adresstyp|}:</td>
|
||||
<td>
|
||||
<select v-model.number="form.addresstype">
|
||||
<option value="0">Haus</option>
|
||||
<option value="0">Firma</option>
|
||||
<option value="1">Packstation</option>
|
||||
<option value="2">Filiale</option>
|
||||
<option value="3">Privatadresse</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Name / Zeile 1|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.name"></td>
|
||||
<tr v-if="form.addresstype === 0">
|
||||
<td>{|Firma|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.company_name"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 0">
|
||||
<td>{|Firmenname / Zeile 2|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.name2"></td>
|
||||
<td>{|Abteilung|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.company_division"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 3">
|
||||
<td>{|Name|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.name"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 0 || form.addresstype === 3">
|
||||
<td>{|Ansprechpartner|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.contact_name"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 1 || form.addresstype === 2">
|
||||
<td>{|Postnummer|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.postnumber"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 0">
|
||||
<td>{|Firmenname / Zeile 3|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.name3"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 0">
|
||||
<tr v-if="form.addresstype === 0 || form.addresstype === 3">
|
||||
<td>{|Strasse/Hausnummer|}:</td>
|
||||
<td>
|
||||
<input type="text" size="30" v-model.trim="form.street">
|
||||
@ -55,7 +60,7 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
<td>{|Postfilialnummer|}:</td>
|
||||
<td><input type="text" size="10" v-model.trim="form.postofficeNumber"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 0">
|
||||
<tr v-if="form.addresstype === 0 || form.addresstype === 3">
|
||||
<td>{|Adresszeile 2|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.address2"></td>
|
||||
</tr>
|
||||
@ -77,10 +82,6 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Ansprechpartner|}:</td>
|
||||
<td><input type="text" size="36" v-model="form.contactperson"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|E-Mail|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.email"></td>
|
||||
|
@ -102,7 +102,19 @@ class Versandart_dhl extends Versanddienstleister{
|
||||
switch ($json->addresstype) {
|
||||
case 0:
|
||||
$shipment->Receiver->Address = new ReceiverNativeAddress();
|
||||
$shipment->Receiver->Address->name2 = $json->name2;
|
||||
|
||||
$shipment->Receiver->name1 = $json->company_name;
|
||||
$shipment->Receiver->Address->name2 = join(
|
||||
';',
|
||||
array_filter(
|
||||
[
|
||||
$json->contact_name,
|
||||
$json->company_division
|
||||
],
|
||||
fn(string $item) => !empty(trim($item))
|
||||
)
|
||||
);
|
||||
|
||||
$shipment->Receiver->Address->streetName = $json->street ?? '';
|
||||
$shipment->Receiver->Address->streetNumber = $json->streetnumber;
|
||||
$shipment->Receiver->Address->city = $json->city ?? '';
|
||||
@ -127,6 +139,20 @@ class Versandart_dhl extends Versanddienstleister{
|
||||
$shipment->Receiver->Postfiliale->zip = $json->zip ?? '';
|
||||
$shipment->Receiver->Postfiliale->Origin = Country::Create($json->country ?? 'DE', $json->state);
|
||||
break;
|
||||
case 3:
|
||||
$shipment->Receiver->Address = new ReceiverNativeAddress();
|
||||
|
||||
$shipment->Receiver->name1 = $json->name;
|
||||
$shipment->Receiver->Address->name2 = $json->contact_name;
|
||||
|
||||
$shipment->Receiver->Address->streetName = $json->street ?? '';
|
||||
$shipment->Receiver->Address->streetNumber = $json->streetnumber;
|
||||
$shipment->Receiver->Address->city = $json->city ?? '';
|
||||
$shipment->Receiver->Address->zip = $json->zip ?? '';
|
||||
$shipment->Receiver->Address->Origin = Country::Create($json->country ?? 'DE', $json->state);
|
||||
if (isset($json->address2) && !empty($json->address2))
|
||||
$shipment->Receiver->Address->addressAddition[] = $json->address2;
|
||||
break;
|
||||
}
|
||||
$shipment->Receiver->Communication = new Communication();
|
||||
$shipment->Receiver->Communication->email = $json->email;
|
||||
|
@ -82,8 +82,18 @@ class Versandart_sendcloud extends Versanddienstleister
|
||||
$parcel->ShippingMethodId = $json->product;
|
||||
$parcel->Name = $json->name;
|
||||
switch ($json->addresstype) {
|
||||
case 0:
|
||||
$parcel->CompanyName = trim("$json->name2 $json->name3");
|
||||
case 0:
|
||||
$parcel->CompanyName = $json->company_name;
|
||||
$parcel->Name = join(
|
||||
';',
|
||||
array_filter(
|
||||
[
|
||||
$json->contact_name,
|
||||
$json->company_division
|
||||
],
|
||||
fn(string $item) => !empty(trim($item))
|
||||
)
|
||||
);
|
||||
$parcel->Address = $json->street;
|
||||
$parcel->Address2 = $json->address2;
|
||||
$parcel->HouseNumber = $json->streetnumber;
|
||||
@ -98,6 +108,23 @@ class Versandart_sendcloud extends Versanddienstleister
|
||||
$parcel->Address = "Postfiliale";
|
||||
$parcel->HouseNumber = $json->postofficeNumber;
|
||||
break;
|
||||
case 3:
|
||||
$parcel->Name = join(
|
||||
';',
|
||||
array_filter(
|
||||
[
|
||||
$json->name,
|
||||
$json->contact_name
|
||||
],
|
||||
fn(string $item) => !empty(trim($item))
|
||||
)
|
||||
);
|
||||
|
||||
$parcel->Address = $json->street;
|
||||
$parcel->Address2 = $json->address2;
|
||||
$parcel->HouseNumber = $json->streetnumber;
|
||||
break;
|
||||
|
||||
}
|
||||
$parcel->Country = $json->country;
|
||||
$parcel->PostalCode = $json->zip;
|
||||
@ -164,4 +191,4 @@ class Versandart_sendcloud extends Versanddienstleister
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user