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

(-)a/cataloguing/additem.pl (+1 lines)
Lines 125-130 sub generate_subfield_form { Link Here
125
        $subfield_data{subfield}   = $subfieldtag;
125
        $subfield_data{subfield}   = $subfieldtag;
126
        $subfield_data{marc_lib}   ="<span id=\"error$i\" title=\"".$subfieldlib->{lib}."\">".$subfieldlib->{lib}."</span>";
126
        $subfield_data{marc_lib}   ="<span id=\"error$i\" title=\"".$subfieldlib->{lib}."\">".$subfieldlib->{lib}."</span>";
127
        $subfield_data{mandatory}  = $subfieldlib->{mandatory};
127
        $subfield_data{mandatory}  = $subfieldlib->{mandatory};
128
        $subfield_data{important}  = $subfieldlib->{important};
128
        $subfield_data{repeatable} = $subfieldlib->{repeatable};
129
        $subfield_data{repeatable} = $subfieldlib->{repeatable};
129
        $subfield_data{maxlength}  = $subfieldlib->{maxlength};
130
        $subfield_data{maxlength}  = $subfieldlib->{maxlength};
130
        
131
        
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (+5 lines)
Lines 681-686 function Changefwk() { Link Here
681
                <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a>
681
                <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a>
682
            [% ELSE %]
682
            [% ELSE %]
683
                <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %]</span>
683
                <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %]</span>
684
                [% IF innerloo.mandatory %]
685
                    <span style="color:red" title="This field is mandatory">*</span>
686
                [% ELSIF innerloo.important %]
687
                    <span title="This field is important">*</span>
688
                [% END %]
684
                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]'); return false;">&nbsp;?</a>[% END %]
689
                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]'); return false;">&nbsp;?</a>[% END %]
685
            [% END %]
690
            [% END %]
686
                [% IF ( innerloo.fixedfield ) %]
691
                [% IF ( innerloo.fixedfield ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-7 / +27 lines)
Lines 85-92 $(document).ready(function(){ Link Here
85
});
85
});
86
86
87
function Check(f) {
87
function Check(f) {
88
    var total_errors = CheckMandatorySubfields(f);
88
    var total_mandatory = CheckMandatorySubfields(f);
89
    if (total_errors==0) {
89
    var total_important = CheckImportantSubfields(f);
90
    var alertString2;
91
    if (total_mandatory==0) {
90
        // Explanation about this line:
92
        // Explanation about this line:
91
        // In case of limited edition permission, we have to prevent user from modifying some fields.
93
        // In case of limited edition permission, we have to prevent user from modifying some fields.
92
        // But there is no such thing as readonly attribute for select elements.
94
        // But there is no such thing as readonly attribute for select elements.
Lines 94-105 function Check(f) { Link Here
94
        // So we "un-disable" the elements just before submitting.
96
        // So we "un-disable" the elements just before submitting.
95
        // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
97
        // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
96
        $("select[name=field_value]").prop('disabled', false);
98
        $("select[name=field_value]").prop('disabled', false);
97
        return true;
98
    } else {
99
    } else {
99
        var alertString2 = _("Form not submitted because of the following problem(s)");
100
        alertString2 = _("Form not submitted because of the following problem(s)");
100
        alertString2 += "\n------------------------------------------------------------------------------------\n";
101
        alertString2 += "\n------------------------------------------------------------------------------------\n";
101
        alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
102
        alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_mandatory);
102
        alert(alertString2);
103
    }
104
    if(total_important > 0){
105
        if( !alertString2 ){
106
            alertString2 = "";
107
        }
108
        alertString2 += "\n\n " + _("%s important field(s) empty (highlighted)").format(total_important);
109
        alertString2 += "\n\n " + _("Are you sure you want to save?");
110
    }
111
    if(alertString2){
112
        if(total_mandatory){
113
             alert(alertString2);
114
        }else{
115
            var a = confirm(alertString2);
116
            if( a ){
117
                return true;
118
            }
119
        }
103
        return false;
120
        return false;
104
    }
121
    }
105
    return true;
122
    return true;
Lines 300-311 function confirm_deletion() { Link Here
300
                <input type="hidden" name="tag"       value="[% ite.tag %]" />
317
                <input type="hidden" name="tag"       value="[% ite.tag %]" />
301
                <input type="hidden" name="subfield"  value="[% ite.subfield %]" />
318
                <input type="hidden" name="subfield"  value="[% ite.subfield %]" />
302
                <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
319
                <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
320
                <input type="hidden" name="important" value="[% ite.important %]" />
303
                [% IF ( ite.repeatable ) %]
321
                [% IF ( ite.repeatable ) %]
304
                    <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
322
                    <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
305
                        <img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
323
                        <img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
306
                    </a>
324
                    </a>
307
                [% END %]
325
                [% END %]
308
                [% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %]
326
                [% IF ( ite.mandatory ) %] <span class="required">Required</span>
327
                [% ELSIF ( ite.important ) %] <span class="important" style="font-style: italic; margin-left: .5em;">Important</span>
328
                [% END %]
309
            </div></li>
329
            </div></li>
310
        [% END %]
330
        [% END %]
311
    </ol>
331
    </ol>
(-)a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js (-1 / +12 lines)
Lines 552-557 function CheckMandatorySubfields(p){ Link Here
552
    return total;
552
    return total;
553
}
553
}
554
554
555
function CheckImportantSubfields(p){
556
    var total = 0;
557
    $(p).find(".subfield_line input[name='important'][value='1']").each(function(i){
558
        var editor = $(this).siblings("[name='field_value']");
559
        if (!editor.val()) {
560
            editor.addClass("missing");
561
            total++;
562
        }
563
    });
564
    return total;
565
}
566
555
 $(document).ready(function() {
567
 $(document).ready(function() {
556
    $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
568
    $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
557
});
569
});
558
- 

Return to bug 8643