From: Bernd Bleßmann Date: Tue, 12 Jan 2016 10:49:17 +0000 (+0100) Subject: kivi.SalesPurchase.edit_longdescription: Aufruf auch mit einzelnen Parametern … X-Git-Tag: release-3.4.1~357 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=08899a32f9ae554bc59be87d6678c09b678469b6;p=kivitendo-erp.git kivi.SalesPurchase.edit_longdescription: Aufruf auch mit einzelnen Parametern … 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. --- 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);