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 @@ ...@@ -4,9 +4,6 @@
* This file contains package_quiqqer_invoice_ajax_invoices_temporary_save * 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 * Saves the temporary invoice
* *
...@@ -17,7 +14,7 @@ ...@@ -17,7 +14,7 @@
'package_quiqqer_invoice_ajax_invoices_temporary_save', 'package_quiqqer_invoice_ajax_invoices_temporary_save',
function ($invoiceId, $data) { function ($invoiceId, $data) {
$Invoice = QUI\ERP\Accounting\Invoice\Utils\Invoice::getTemporaryInvoiceByString($invoiceId); $Invoice = QUI\ERP\Accounting\Invoice\Utils\Invoice::getTemporaryInvoiceByString($invoiceId);
$data = \json_decode($data, true); $data = json_decode($data, true);
if (empty($data['customer_id'])) { if (empty($data['customer_id'])) {
$data['invoice_address_id'] = ''; $data['invoice_address_id'] = '';
...@@ -44,13 +41,21 @@ function ($invoiceId, $data) { ...@@ -44,13 +41,21 @@ function ($invoiceId, $data) {
unset($data['articles']); 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'])) { if (isset($data['currency'])) {
$Invoice->setCurrency($data['currency']); $Invoice->setCurrency($data['currency']);
} }
if (!empty($data['currencyRate'])) { if (!empty($data['currencyRate'])) {
$Currency = $Invoice->getCurrency(); $Currency = $Invoice->getCurrency();
$Currency->setExchangeRate(\floatval($data['currencyRate'])); $Currency->setExchangeRate(floatval($data['currencyRate']));
$Invoice->setCurrency($Currency); $Invoice->setCurrency($Currency);
} }
...@@ -61,8 +66,8 @@ function ($invoiceId, $data) { ...@@ -61,8 +66,8 @@ function ($invoiceId, $data) {
$Invoice->clearCustomerFiles(); $Invoice->clearCustomerFiles();
if (!empty($data['attached_customer_files'])) { if (!empty($data['attached_customer_files'])) {
if (\is_string($data['attached_customer_files'])) { if (is_string($data['attached_customer_files'])) {
$customerFiles = \json_decode($data['attached_customer_files'], true); $customerFiles = json_decode($data['attached_customer_files'], true);
} else { } else {
$customerFiles = $data['attached_customer_files']; $customerFiles = $data['attached_customer_files'];
} }
......
...@@ -172,6 +172,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [ ...@@ -172,6 +172,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
}; };
self.setAttribute('articles', data.articles.articles); self.setAttribute('articles', data.articles.articles);
self.setAttribute('priceFactors', data.articles.priceFactors);
} }
if (data.invoice_address) { if (data.invoice_address) {
...@@ -279,6 +280,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [ ...@@ -279,6 +280,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
invoice_address_id : this.getAttribute('invoice_address_id'), invoice_address_id : this.getAttribute('invoice_address_id'),
project_name : this.getAttribute('project_name'), project_name : this.getAttribute('project_name'),
articles : this.getAttribute('articles'), articles : this.getAttribute('articles'),
priceFactors : this.getAttribute('priceFactors'),
date : this.getAttribute('date'), date : this.getAttribute('date'),
editor_id : this.getAttribute('editor_id'), editor_id : this.getAttribute('editor_id'),
ordered_by : this.getAttribute('ordered_by'), ordered_by : this.getAttribute('ordered_by'),
...@@ -1233,6 +1235,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [ ...@@ -1233,6 +1235,7 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [
if (this.$ArticleList) { if (this.$ArticleList) {
this.setAttribute('articles', this.$ArticleList.save()); this.setAttribute('articles', this.$ArticleList.save());
this.setAttribute('priceFactors', this.$ArticleList.getPriceFactors());
this.$serializedList = this.$ArticleList.serialize(); this.$serializedList = this.$ArticleList.serialize();
if (destroyList) { 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