kivi.SalesPurchase.edit_longdescription: callback zum Setzen der Beschreibung angeben...
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Tue, 8 Mar 2016 13:13:28 +0000 (14:13 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 11 Mar 2016 11:45:30 +0000 (12:45 +0100)
js/kivi.SalesPurchase.js

index 83f7939..3e8dc63 100644 (file)
@@ -26,6 +26,9 @@ namespace('kivi.SalesPurchase', function(ns) {
     if (params.element) {
       $container.data('element', params.element);
     }
+    if (params.set_function) {
+      $container.data('setFunction', params.set_function);
+    }
 
     $edit.val(params.default_longdescription);
 
@@ -50,10 +53,13 @@ namespace('kivi.SalesPurchase', function(ns) {
   };
 
   this.set_longdescription = function() {
-    $('#popup_edit_longdescription_input_container')
-      .data('element')
-      .val( $('#popup_edit_longdescription_input').val() );
-
+    if ($('#popup_edit_longdescription_input_container').data('setFunction')) {
+      $('#popup_edit_longdescription_input_container').data('setFunction')($('#popup_edit_longdescription_input').val());
+    } else {
+      $('#popup_edit_longdescription_input_container')
+        .data('element')
+        .val( $('#popup_edit_longdescription_input').val() );
+    }
     $('#edit_longdescription_dialog').dialog('close');
   };