Rechnungsmaske: "Browser-Zurück verhindern" konfigurierbar in Mandantenkonfig
[kivitendo-erp.git] / templates / webpages / is / form_header.html
index 5b78c3e..c870191 100644 (file)
@@ -18,6 +18,7 @@
 <input type="hidden" name="follow_up_trans_info_1" id="follow_up_trans_info_1" value="[% HTML.escape(follow_up_trans_info) %]">
 <input type="hidden" name="follow_up_rowcount" id="follow_up_rowcount" value="1">
 <input type="hidden" name="lastmtime" id="lastmtime" value="[% HTML.escape(lastmtime) %]">
+<input type="hidden" name="already_printed_flag" id="already_printed_flag" value="0">
 
 <h1>[% title %]</h1>
 
@@ -34,9 +35,8 @@
 [%- END %]
 [%- IF id %]
   [%- IF INSTANCE_CONF.get_doc_storage %]
-  [% object_type = is_type_credit_note? 'credit_note' : 'invoice' %]
-  <li><a href="controller.pl?action=File/list&file_type=document&object_type=[% object_type %]&object_id=[% HTML.url(id) %]">[% 'Documents' | $T8 %]</a></li>
-  <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=[% object_type %]&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
+  <li><a href="controller.pl?action=File/list&file_type=document&object_type=[% type %]&object_id=[% HTML.url(id) %]">[% 'Documents' | $T8 %]</a></li>
+  <li><a href="controller.pl?action=File/list&file_type=attachment&object_type=[% type %]&object_id=[% HTML.url(id) %]">[% 'Attachments' | $T8 %]</a></li>
   [%- END %]
   [%- IF AUTH.assert('record_links', 1) %]
   <li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Invoice&object_id=[% HTML.url(id) %]">[% 'Linked Records' | $T8 %]</a></li>
   <script type="text/javascript">
    <!--
      $('document').ready(function(){
+[% IF INSTANCE_CONF.get_invoice_prevent_browser_back %]
+       function disableBack() { window.history.forward() };
+       window.onload = disableBack();
+       window.onpageshow = function(evt) { if (evt.persisted) disableBack() };
+[% END %]
+
 [% IF resubmit && is_format_html %]
        window.open('about:blank','Beleg');
        document.invoice.target = 'Beleg';
        kivi.SalesPurchase.show_print_dialog();
        kivi.SalesPurchase.print_record();
 [% ELSIF resubmit %]
-       kivi.SalesPurchase.show_print_dialog();
-       kivi.SalesPurchase.print_record();
+       if ($('#already_printed_flag').val() === "0") {
+         kivi.SalesPurchase.show_print_dialog();
+         kivi.SalesPurchase.print_record();
+         $('#already_printed_flag').val("1");
+       }
 [% ELSIF creditwarning != '' %]
        alert('[% 'Credit Limit exceeded!!!' | $T8 %]');
 [% ELSE %]