@@ -, +, @@ in order to enable entry of SMS notices. (Home -> Koha administration -> Global system preferences -> Patrons) to Enable in order to enable entry of Phone notices. (Home -> Koha administration -> Global system preferences -> Patrons) a) Enter a code and description. (e.g. TST, testing) b) type 'test' into the letter box. c) Click 'Submit' -- You should get a warning, but it will force you back to the Notices & Slips page! This is WRONG! -- when you click Submit, you will get a warning, but not be redirected d) After the warning, clear out the letter box before attempting the next type. The warning gets caught for the first problem section, not all of them. Fixing that is beyond the scope of this bug. --- .../intranet-tmpl/prog/en/modules/tools/letter.tt | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -30,6 +30,9 @@ $(document).ready(function() { $("#submit_form").click( function(event) { event.preventDefault(); var at_least_one_exists = 0; + var submit_trigger = 0; + var check_mtt_fieldsets = new Array (); + $("fieldset.mtt").each( function(){ var title = $(this).find('input[name="title"]').val(); var content = $(this).find('textarea[name="content"]').val(); @@ -41,10 +44,12 @@ $(document).ready(function() { var msg = _("Please specify title and content for %s"); msg = msg.replace( "%s", mtt ); at_least_one_exists = 1; - alert(msg) + check_mtt_fieldsets.push("0"); + alert(msg); return false; } else if ( title.length > 0 && content.length > 0 ) { at_least_one_exists = 1; + check_mtt_fieldsets.push("1"); } } ); if ( ! at_least_one_exists ) { @@ -52,6 +57,19 @@ $(document).ready(function() { return false; } + for(var i = 0; i < check_mtt_fieldsets.length; i++) + { + if ( check_mtt_fieldsets[i] !== check_mtt_fieldsets[0] ) + { + submit_trigger = 0; + return false; + } else { + if ( check_mtt_fieldsets[0] == 1 ) { + submit_trigger = 1; + } + } + } + // Test if code already exists in DB var new_lettercode = $("#code").val(); var new_branchcode = $("#branch").val(); @@ -71,13 +89,17 @@ $(document).ready(function() { } return false; } else { - $("#add_notice").submit(); + if ( submit_trigger == 1) { + $("#add_notice").submit(); + } } }, }); [% IF ( add_form and code ) %] } else { - $("#add_notice").submit(); + if ( submit_trigger == 1) { + $("#add_notice").submit(); + } } [% END %] }); --