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

fix: quiqqer/invoice#23

Übergeordneter 9508905a
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -237,6 +237,18 @@ protected function setDataBaseData(array $data)
QUI\System\Log::writeRecursive($this->customer);
QUI\System\Log::addWarning($Exception->getMessage());
}
if (isset($customerData['address']['id']) && $customerData['address']['id']) {
$this->Customer->setAddress($this->getInvoiceAddress());
} elseif (isset($customerData['quiqqer.erp.address'])) {
try {
$User = QUI::getUsers()->get($this->Customer->getId());
$Address = $User->getAddress($customerData['quiqqer.erp.address']);
$this->Customer->setAddress($Address);
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception);
}
}
}
......@@ -247,6 +259,13 @@ protected function setDataBaseData(array $data)
$articles = json_decode($data['articles'], true);
if ($articles) {
// clear vat for recalculation
if (isset($articles['articles'])) {
foreach ($articles['articles'] as $key => $article) {
unset($articles['articles'][$key]['vat']);
}
}
try {
$this->Articles = new ArticleList($articles);
} catch (QUI\ERP\Exception $Exception) {
......@@ -255,6 +274,9 @@ protected function setDataBaseData(array $data)
}
}
$this->Articles->setUser($this->getCustomer());
$this->Articles->calc();
// comments
$this->Comments = new QUI\ERP\Comments();
......
......@@ -158,6 +158,10 @@ public function createInvoice($PermissionUser = null)
$articles = $this->getArticles()->getArticles();
$TemporaryInvoice->getArticles()->setUser(
$this->getCustomer()
);
foreach ($articles as $Article) {
try {
$TemporaryInvoice->getArticles()->addArticle($Article);
......
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