diff --git a/bin/backend/controls/panels/TemporaryInvoice.js b/bin/backend/controls/panels/TemporaryInvoice.js index 431c709a1c49ca1ce57f52a28fcc0c767b3eabc2..064c4d3aa7ec4e438bde5558502a2a94dca56582 100644 --- a/bin/backend/controls/panels/TemporaryInvoice.js +++ b/bin/backend/controls/panels/TemporaryInvoice.js @@ -905,9 +905,27 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [ 'package/quiqqer/erp/bin/backend/controls/articles/product/AddProductWindow', 'package/quiqqer/invoice/bin/backend/controls/articles/Article' ], function (Win, Article) { + var productDescriptionSource = false; + new Win({ user : self.getUserData(), + fields: false, events: { + onLoad: function (Instance, ProductSearch) { + ProductSearch.Loader.show(); + + require(['package/quiqqer/invoice/bin/Invoices'], function (Invoices) { + Invoices.getSetting('invoice', 'productDescriptionSource').then(function (src) { + if (parseInt(src)) { + productDescriptionSource = parseInt(src); + Instance.setAttribute('fields', [productDescriptionSource]); + } + + ProductSearch.Loader.hide(); + }); + }); + }, + onSubmit: function (Win, article) { var Instance = new Article(article); @@ -915,6 +933,17 @@ define('package/quiqqer/invoice/bin/backend/controls/panels/TemporaryInvoice', [ Instance.setVat(article.calculated_vatArray.vat); } + if (productDescriptionSource && + typeof article.fields !== 'undefined' && + typeof article.fields[productDescriptionSource] !== 'undefined') { + var field = article.fields[productDescriptionSource]; + var current = QUILocale.getCurrent(); + + if (typeof field[current] !== 'undefined') { + Instance.setAttribute('description', field[current]); + } + } + self.$ArticleList.addArticle(Instance); resolve(Instance); } diff --git a/locale.xml b/locale.xml index fdeb1c113aa88e0e0ea503ec69c87d372899f0f7..b613613cea1662c6b8dd035b0feda04abfdeeee5 100644 --- a/locale.xml +++ b/locale.xml @@ -492,6 +492,19 @@ <en><![CDATA[This text is displayed in every invoice as additional text.]]></en> </locale> + <locale name="invoice.settings.invoice.productDescriptionSource"> + <de><![CDATA[Quelle der Produktbeschreibung]]></de> + <en><![CDATA[Product description source]]></en> + </locale> + <locale name="invoice.settings.invoice.productDescriptionSource.description"> + <de><![CDATA[ + Dieses Einstellung legt fest, welches Feld für die Produktbeschreibung, bei hinzufügen einer Rechnung, verwendet wird. + ]]></de> + <en><![CDATA[ + This setting determines which field is used for the product description when adding an invoice. + ]]></en> + </locale> + <locale name="invoice.send.mail.message.description" html="true"> <de><![CDATA[ <p>Inhalt der Rechnungsmail. Verfügbare Platzhalter:</p> diff --git a/settings.xml b/settings.xml index 926aa903420d4e1c15762415411e4d033d13c2af..b20d692a109a22df64e390c3cbcaa7026aa8bf1b 100644 --- a/settings.xml +++ b/settings.xml @@ -27,6 +27,9 @@ <conf name="globalInvoiceText"> <type><![CDATA[string]]></type> </conf> + <conf name="productDescriptionSource"> + <type>integer</type> + </conf> </section> <section name="temporaryInvoice"> @@ -142,6 +145,21 @@ var="invoice.settings.invoice.globalInvoiceText.description"/> </description> </input> + + <input conf="invoice.productDescriptionSource" + data-qui="package/quiqqer/products/bin/controls/fields/Select" + data-qui-options-max="1" + data-qui-options-multiple="0" + > + <text> + <locale group="quiqqer/invoice" + var="invoice.settings.invoice.productDescriptionSource"/> + </text> + <description> + <locale group="quiqqer/invoice" + var="invoice.settings.invoice.productDescriptionSource.description"/> + </description> + </input> </settings> <settings title="invoiceDownload" name="invoiceDownload">