From 08899a32f9ae554bc59be87d6678c09b678469b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Tue, 12 Jan 2016 11:49:17 +0100 Subject: [PATCH] =?utf8?q?kivi.SalesPurchase.edit=5Flongdescription:=20Auf?= =?utf8?q?ruf=20auch=20mit=20einzelnen=20Parametern=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ermöglichen, statt mit row. Dafür gibt es eine zweite Funktion "..._with_params. Diese wird jetzt von kivi.SalesPurchase.edit_longdescription(row) aufgerufen, damit in den vorhandenen Templates nicht angepasst werden muss. --- js/kivi.SalesPurchase.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/js/kivi.SalesPurchase.js b/js/kivi.SalesPurchase.js index 303ae5fdc..83f79394f 100644 --- a/js/kivi.SalesPurchase.js +++ b/js/kivi.SalesPurchase.js @@ -7,21 +7,34 @@ namespace('kivi.SalesPurchase', function(ns) { return; } + var params = { element: $element, + runningnumber: row, + partnumber: $('#partnumber_' + row).val() || '', + description: $('#description_' + row).val() || '', + default_longdescription: $('#longdescription_' + row).val() || '' + }; + this.edit_longdescription_with_params(params); + }; + + this.edit_longdescription_with_params = function(params) { var $container = $('#popup_edit_longdescription_input_container'); var $edit = $(''); $container.children().remove(); $container.append($edit); - $container.data('element', $element); - $edit.val($element.val()); + if (params.element) { + $container.data('element', params.element); + } + + $edit.val(params.default_longdescription); kivi.init_text_editor($edit); - $('#popup_edit_longdescription_runningnumber').html(row); - $('#popup_edit_longdescription_partnumber').html($('#partnumber_' + row).val() || ''); + $('#popup_edit_longdescription_runningnumber').html(params.runningnumber); + $('#popup_edit_longdescription_partnumber').html(params.partnumber); - var description = ($('#description_' + row).val() || '').replace(/[\n\r]+/, ''); + var description = params.description.replace(/[\n\r]+/, ''); if (description.length >= 50) description = description.substring(0, 50) + "…"; $('#popup_edit_longdescription_description').html(description); -- 2.20.1