Auftragsmaske: JavaScript-Checks für Speichern aktiver per. Rechnungen nach kivi...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 23 Jun 2014 13:03:19 +0000 (15:03 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 23 Jun 2014 13:03:19 +0000 (15:03 +0200)
js/edit_periodic_invoices_config.js
js/kivi.SalesPurchase.js
templates/webpages/oe/form_footer.html

index 44ebd19..b969e1d 100644 (file)
@@ -14,7 +14,3 @@ function edit_periodic_invoices_config() {
   // alert(url);
   window.open(url, "_new_generic", parm);
 }
-
-function warn_save_active_periodic_invoice() {
-  return confirm(kivi.t8('This sales order has an active configuration for periodic invoices. If you save then all subsequently created invoices will contain those changes as well, but not those that have already been created. Do you want to continue?'));
-}
index dfd2a6a..bcae114 100644 (file)
@@ -49,11 +49,18 @@ namespace('kivi.SalesPurchase', function(ns) {
     return confirm(kivi.t8('There are still transfers not matching the qty of the delivery order. Stock operations can not be changed later. Do you really want to proceed?'));
   };
 
+  this.oe_warn_save_active_periodic_invoice = function() {
+    return confirm(kivi.t8('This sales order has an active configuration for periodic invoices. If you save then all subsequently created invoices will contain those changes as well, but not those that have already been created. Do you want to continue?'));
+  };
+
   this.on_submit_checks = function() {
     var $button = $(this);
     if (($button.data('check-transfer-qty') == 1) && !kivi.SalesPurchase.delivery_order_check_transfer_qty())
       return false;
 
+    if (($button.data('warn-save-active-periodic-invoice') == 1) && !kivi.SalesPurchase.oe_warn_save_active_periodic_invoice())
+      return false;
+
     return true;
   };
 
index 1896f76..aa52392 100644 (file)
 <input class="submit" type="submit" name="action_ship_to" value="[% 'Ship to' | $T8 %]">
 <input class="submit" type="submit" name="action_print" value="[% 'Print' | $T8 %]">
 <input class="submit" type="submit" name="action_e_mail" value="[% 'E-mail' | $T8 %]">
-<input class="submit" type="submit" name="action_save" value="[% 'Save' | $T8 %]"[% IF warn_save_active_periodic_invoice %] onclick="return warn_save_active_periodic_invoice();"[% END %]>
-<input class="submit" type="submit" name="action_save_and_close" value="[% 'Save and Close' | $T8 %]"[% IF warn_save_active_periodic_invoice %] onclick="return warn_save_active_periodic_invoice();"[% END %]>
+<input class="submit" type="submit" name="action_save" value="[% 'Save' | $T8 %]"[% IF warn_save_active_periodic_invoice %] data-warn-save-active-periodic-invoice="1"[% END %]>
+<input class="submit" type="submit" name="action_save_and_close" value="[% 'Save and Close' | $T8 %]"[% IF warn_save_active_periodic_invoice %] data-warn-save-active-periodic-invoice="1"[% END %]>
 
 [%- IF id %]
   <input type="button" class="submit" onclick="follow_up_window()" value="[% 'Follow-Up' | $T8 %]">
 [% END %]
 
 </form>
+<script type='text/javascript'>
+ $(kivi.SalesPurchase.init_on_submit_checks);
+</script>