X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=js%2Fkivi.Order.js;h=7294072741eed88765b89941906c676f357531aa;hb=e0fb092b1a1ac0429036b41abc0a85a011e0d9a8;hp=140eba2f0b8d45e44a5697cda5dc19341a06764a;hpb=9ce44b6f09f77fc51a69e4536fa44dee68d0ab85;p=kivitendo-erp.git diff --git a/js/kivi.Order.js b/js/kivi.Order.js index 140eba2f0..729407274 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -96,6 +96,9 @@ namespace('kivi.Order', function(ns) { $('#print_options_form table').first().remove().appendTo('#email_form_print_options'); + $('select#format').change(kivi.Order.adjust_email_attachment_name_for_template_format); + kivi.Order.adjust_email_attachment_name_for_template_format(); + var to_focus = $('#email_form_to').val() === '' ? 'to' : 'subject'; $('#email_form_' + to_focus).focus(); }; @@ -155,6 +158,20 @@ namespace('kivi.Order', function(ns) { email_dialog.dialog("close"); }; + ns.adjust_email_attachment_name_for_template_format = function() { + var $filename_elt = $('#email_form_attachment_filename'); + var $format_elt = $('select#format'); + + if (!$filename_elt || !$format_elt) + return; + + var format = $format_elt.val().toLowerCase(); + var new_ext = format == 'html' ? 'html' : format == 'opendocument' ? 'odt' : 'pdf'; + var filename = $filename_elt.val(); + + $filename_elt.val(filename.replace(/[^.]+$/, new_ext)); + }; + ns.set_number_in_title = function(elt) { $('#nr_in_title').html($(elt).val()); }; @@ -234,6 +251,8 @@ namespace('kivi.Order', function(ns) { }; ns.recalc_amounts_and_taxes = function() { + if (!kivi.validate_form('#order_form')) return; + var data = $('#order_form').serializeArray(); data.push({ name: 'action', value: 'Order/recalc_amounts_and_taxes' }); @@ -821,7 +840,7 @@ namespace('kivi.Order', function(ns) { if (number_info !== '') { info += ' (' + number_info + ')' } if (name_info !== '') { info += ' (' + name_info + ')' } - if (!$('#follow_up_rowcount').lenght) { + if (!$('#follow_up_rowcount').length) { $('').appendTo('#order_form'); $('').appendTo('#order_form'); $('').appendTo('#order_form'); @@ -861,6 +880,13 @@ namespace('kivi.Order', function(ns) { return confirm(kivi.t8("The transport cost article '#1' is missing. Do you want to continue anyway?", [ description ])); }; + ns.check_cusordnumber_presence = function() { + if ($('#order_cusordnumber').val() === '') { + return confirm(kivi.t8('The customer order number is missing. Do you want to continue anyway?')); + } + return true; + }; + }); $(function() {