View | Details | Raw Unified | Return to bug 14070
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (-4 / +25 lines)
Lines 30-35 $(document).ready(function() { Link Here
30
    $("#submit_form").click( function(event) {
30
    $("#submit_form").click( function(event) {
31
        event.preventDefault();
31
        event.preventDefault();
32
        var at_least_one_exists = 0;
32
        var at_least_one_exists = 0;
33
        var submit_trigger = 0;
34
        var check_mtt_fieldsets = new Array ();
35
33
        $("fieldset.mtt").each( function(){
36
        $("fieldset.mtt").each( function(){
34
            var title = $(this).find('input[name="title"]').val();
37
            var title = $(this).find('input[name="title"]').val();
35
            var content = $(this).find('textarea[name="content"]').val();
38
            var content = $(this).find('textarea[name="content"]').val();
Lines 41-50 $(document).ready(function() { Link Here
41
                var msg = _("Please specify title and content for %s");
44
                var msg = _("Please specify title and content for %s");
42
                msg = msg.replace( "%s", mtt );
45
                msg = msg.replace( "%s", mtt );
43
                at_least_one_exists = 1;
46
                at_least_one_exists = 1;
44
                alert(msg)
47
                check_mtt_fieldsets.push("0");
48
                alert(msg);
45
                return false;
49
                return false;
46
            } else if ( title.length > 0 && content.length > 0 ) {
50
            } else if ( title.length > 0 && content.length > 0 ) {
47
                at_least_one_exists = 1;
51
                at_least_one_exists = 1;
52
                check_mtt_fieldsets.push("1");
48
            }
53
            }
49
        } );
54
        } );
50
        if ( ! at_least_one_exists ) {
55
        if ( ! at_least_one_exists ) {
Lines 52-57 $(document).ready(function() { Link Here
52
            return false;
57
            return false;
53
        }
58
        }
54
59
60
        for(var i = 0; i < check_mtt_fieldsets.length; i++)
61
        {
62
          if ( check_mtt_fieldsets[i] !== check_mtt_fieldsets[0] )
63
          {
64
            submit_trigger = 0;
65
            return false;
66
          } else {
67
                   if ( check_mtt_fieldsets[0] == 1 ) {
68
                     submit_trigger = 1;
69
                   }
70
          }
71
        }
72
55
        // Test if code already exists in DB
73
        // Test if code already exists in DB
56
        var new_lettercode = $("#code").val();
74
        var new_lettercode = $("#code").val();
57
        var new_branchcode = $("#branch").val();
75
        var new_branchcode = $("#branch").val();
Lines 71-83 $(document).ready(function() { Link Here
71
                }
89
                }
72
                return false;
90
                return false;
73
              } else {
91
              } else {
74
                $("#add_notice").submit();
92
                if ( submit_trigger == 1) {
93
                  $("#add_notice").submit();
94
                }
75
              }
95
              }
76
            },
96
            },
77
          });
97
          });
78
        [% IF ( add_form and code ) %]
98
        [% IF ( add_form and code ) %]
79
          } else {
99
          } else {
80
            $("#add_notice").submit();
100
                 if ( submit_trigger == 1) {
101
                   $("#add_notice").submit();
102
                 }
81
          }
103
          }
82
        [% END %]
104
        [% END %]
83
    });
105
    });
84
- 

Return to bug 14070