E-Mail-Dialog: Knopf E-Mail senden ausgrauen um mehrfaches Senden zu verhindern
authorJan Büren <jan@kivitendo.de>
Fri, 26 Oct 2018 10:30:05 +0000 (12:30 +0200)
committerJan Büren <jan@kivitendo.de>
Wed, 10 Mar 2021 12:18:24 +0000 (13:18 +0100)
 Author:    Jan Büren <jan@kivitendo.de>

js/kivi.Order.js
templates/webpages/common/_send_email_dialog.html

index f305afb..f6d0427 100644 (file)
@@ -134,6 +134,9 @@ namespace('kivi.Order', function(ns) {
   };
 
   ns.send_email = function() {
+    // push button only once -> slow response from mail server
+    ns.email_dialog_disable_send();
+
     var data = $('#order_form').serializeArray();
     data = data.concat($('[name^="email_form."]').serializeArray());
     data = data.concat($('[name^="print_options."]').serializeArray());
@@ -465,6 +468,11 @@ namespace('kivi.Order', function(ns) {
     pp.o.multiple=1;
     pp.open_dialog();
   };
+ns.email_dialog_disable_send = function() {
+    // disable mail send event to prevent
+    // impatient users to send multiple times
+    $('#send_email').prop('disabled', true);
+  };
 
   ns.add_multi_items = function(data) {
     var insert_before_item_id = ns.get_insert_before_item_id($('#multi_items_position').val());
index 36713ea..9f03f7e 100644 (file)
 <div id="email_form_print_options"></div>
 
 <p>
- [% L.button_tag(email_form.js_send_function, LxERP.t8("Send email")) %]
+ [% L.button_tag(email_form.js_send_function, LxERP.t8("Send email"), id='send_email') %]
  [% L.button_tag("\$('#send_email_dialog').dialog('close');", LxERP.t8("Abort")) %]
 </p>