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

feat: refactor: erp#78

Übergeordneter 1ccf01c2
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -4,9 +4,6 @@
* This file contains package_quiqqer_invoice_ajax_invoices_temporary_save
*/
use QUI\ERP\Shipping\Shipping;
use QUI\ERP\Accounting\Invoice\Handler as InvoiceHandler;
/**
* Saves the temporary invoice
*
......@@ -17,7 +14,7 @@
'package_quiqqer_invoice_ajax_invoices_temporary_save',
function ($invoiceId, $data) {
$Invoice = QUI\ERP\Accounting\Invoice\Utils\Invoice::getTemporaryInvoiceByString($invoiceId);
$data = \json_decode($data, true);
$data = json_decode($data, true);
if (empty($data['customer_id'])) {
$data['invoice_address_id'] = '';
......@@ -44,13 +41,21 @@ function ($invoiceId, $data) {
unset($data['articles']);
}
if (isset($data['priceFactors'])) {
try {
$List = new QUI\ERP\Accounting\PriceFactors\FactorList($data['priceFactors']);
$Invoice->getArticles()->importPriceFactors($List);
} catch (QUI\Exception $Exception) {
}
}
if (isset($data['currency'])) {
$Invoice->setCurrency($data['currency']);
}
if (!empty($data['currencyRate'])) {
$Currency = $Invoice->getCurrency();
$Currency->setExchangeRate(\floatval($data['currencyRate']));
$Currency->setExchangeRate(floatval($data['currencyRate']));
$Invoice->setCurrency($Currency);
}
......@@ -61,8 +66,8 @@ function ($invoiceId, $data) {
$Invoice->clearCustomerFiles();
if (!empty($data['attached_customer_files'])) {
if (\is_string($data['attached_customer_files'])) {
$customerFiles = \json_decode($data['attached_customer_files'], true);
if (is_string($data['attached_customer_files'])) {
$customerFiles = json_decode($data['attached_customer_files'], true);
} else {
$customerFiles = $data['attached_customer_files'];
}
......
......@@ -172,6 +172,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
};
self.setAttribute('articles', data.articles.articles);
self.setAttribute('priceFactors', data.articles.priceFactors);
}
if (data.invoice_address) {
......@@ -279,6 +280,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
invoice_address_id : this.getAttribute('invoice_address_id'),
project_name : this.getAttribute('project_name'),
articles : this.getAttribute('articles'),
priceFactors : this.getAttribute('priceFactors'),
date : this.getAttribute('date'),
editor_id : this.getAttribute('editor_id'),
ordered_by : this.getAttribute('ordered_by'),
......@@ -1233,6 +1235,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
if (this.$ArticleList) {
this.setAttribute('articles', this.$ArticleList.save());
this.setAttribute('priceFactors', this.$ArticleList.getPriceFactors());
this.$serializedList = this.$ArticleList.serialize();
if (destroyList) {
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren