Skip to content
Code-Schnipsel Gruppen Projekte
Commit 521786fc erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

fix: setCustomer at order considered the saved address data

Übergeordneter b2b875ae
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -480,6 +480,17 @@ public function getPrefixedId()
return $this->getIdPrefix().$this->getId();
}
/**
* Return the order id
* -> alias for getId(), this method is used in the calc classes
*
* @return integer
*/
public function getCleanId()
{
return $this->getId();
}
/**
* @return QUI\ERP\Accounting\Calculations
*
......@@ -781,6 +792,10 @@ public function setCustomer($User)
try {
$Customer = QUI::getUsers()->get($User['id']);
if (isset($User['address'])) {
$address = $User['address'];
}
foreach ($missing as $missingAttribute) {
if ($missingAttribute === 'username') {
$User[$missingAttribute] = $Customer->getUsername();
......@@ -792,10 +807,47 @@ public function setCustomer($User)
continue;
}
if (!empty($address[$missingAttribute])) {
$User[$missingAttribute] = $address[$missingAttribute];
continue;
}
$User[$missingAttribute] = $Customer->getAttribute($missingAttribute);
}
} catch (QUI\Exception $Exception) {
// we have a problem, we cant set the user
// we need to fill the user data with empty values
$address = [];
if (isset($User['address'])) {
$address = $User['address'];
}
foreach ($missing as $missingAttribute) {
if ($missingAttribute === 'isCompany') {
if (!empty($address['company'])) {
$User[$missingAttribute] = 1;
continue;
}
$User[$missingAttribute] = 0;
continue;
}
if ($missingAttribute === 'country' ||
$missingAttribute === 'lastname' ||
$missingAttribute === 'firstname') {
if (!empty($address[$missingAttribute])) {
$User[$missingAttribute] = $address[$missingAttribute];
continue;
}
$User[$missingAttribute] = '';
continue;
}
$User[$missingAttribute] = '';
}
}
}
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren