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 577-582 function Changefwk() { Link Here
577
                <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>
577
                <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>
578
            [% ELSE %]
578
            [% ELSE %]
579
                <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %]</span>
579
                <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %]</span>
580
                [% IF innerloo.mandatory %]
581
                    <span style="color:red" title="This field is mandatory">*</span>
582
                [% ELSIF innerloo.important %]
583
                    <span title="This field is important">*</span>
584
                [% END %]
580
                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]'); return false;">&nbsp;?</a>[% END %]
585
                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]'); return false;">&nbsp;?</a>[% END %]
581
            [% END %]
586
            [% END %]
582
                [% IF ( innerloo.fixedfield ) %]
587
                [% IF ( innerloo.fixedfield ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-7 / +27 lines)
Lines 88-95 $(document).ready(function(){ Link Here
88
});
88
});
89
89
90
function Check(f) {
90
function Check(f) {
91
    var total_errors = CheckMandatorySubfields(f);
91
    var total_mandatory = CheckMandatorySubfields(f);
92
    if (total_errors==0) {
92
    var total_important = CheckImportantSubfields(f);
93
    var alertString2;
94
    if (total_mandatory==0) {
93
        // Explanation about this line:
95
        // Explanation about this line:
94
        // In case of limited edition permission, we have to prevent user from modifying some fields.
96
        // In case of limited edition permission, we have to prevent user from modifying some fields.
95
        // But there is no such thing as readonly attribute for select elements.
97
        // But there is no such thing as readonly attribute for select elements.
Lines 97-108 function Check(f) { Link Here
97
        // So we "un-disable" the elements just before submitting.
99
        // So we "un-disable" the elements just before submitting.
98
        // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
100
        // That's a bit clumsy, and if someone comes up with a better solution, feel free to improve that.
99
        $("select[name=field_value]").prop('disabled', false);
101
        $("select[name=field_value]").prop('disabled', false);
100
        return true;
101
    } else {
102
    } else {
102
        var alertString2 = _("Form not submitted because of the following problem(s)");
103
        alertString2 = _("Form not submitted because of the following problem(s)");
103
        alertString2 += "\n------------------------------------------------------------------------------------\n";
104
        alertString2 += "\n------------------------------------------------------------------------------------\n";
104
        alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
105
        alertString2 += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_mandatory);
105
        alert(alertString2);
106
    }
107
    if(total_important > 0){
108
        if( !alertString2 ){
109
            alertString2 = "";
110
        }
111
        alertString2 += "\n\n " + _("%s important field(s) empty (highlighted)").format(total_important);
112
        alertString2 += "\n\n " + _("Are you sure you want to save?");
113
    }
114
    if(alertString2){
115
        if(total_mandatory){
116
             alert(alertString2);
117
        }else{
118
            var a = confirm(alertString2);
119
            if( a ){
120
                return true;
121
            }
122
        }
106
        return false;
123
        return false;
107
    }
124
    }
108
    return true;
125
    return true;
Lines 320-331 function confirm_deletion() { Link Here
320
                <input type="hidden" name="tag"       value="[% ite.tag %]" />
337
                <input type="hidden" name="tag"       value="[% ite.tag %]" />
321
                <input type="hidden" name="subfield"  value="[% ite.subfield %]" />
338
                <input type="hidden" name="subfield"  value="[% ite.subfield %]" />
322
                <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
339
                <input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
340
                <input type="hidden" name="important" value="[% ite.important %]" />
323
                [% IF ( ite.repeatable ) %]
341
                [% IF ( ite.repeatable ) %]
324
                    <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
342
                    <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
325
                        <img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
343
                        <img src="[% interface %]/[% theme %]/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
326
                    </a>
344
                    </a>
327
                [% END %]
345
                [% END %]
328
                [% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %]
346
                [% IF ( ite.mandatory ) %] <span class="required">Required</span>
347
                [% ELSIF ( ite.important ) %] <span class="important" style="font-style: italic; margin-left: .5em;">Important</span>
348
                [% END %]
329
            </div></li>
349
            </div></li>
330
        [% END %]
350
        [% END %]
331
    </ol>
351
    </ol>
(-)a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js (-1 / +12 lines)
Lines 557-562 function CheckMandatorySubfields(p){ Link Here
557
    return total;
557
    return total;
558
}
558
}
559
559
560
function CheckImportantSubfields(p){
561
    var total = 0;
562
    $(p).find(".subfield_line input[name='important'][value='1']").each(function(i){
563
        var editor = $(this).siblings("[name='field_value']");
564
        if (!editor.val()) {
565
            editor.addClass("missing");
566
            total++;
567
        }
568
    });
569
    return total;
570
}
571
560
 $(document).ready(function() {
572
 $(document).ready(function() {
561
    $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
573
    $("input.input_marceditor, input.indicator").addClass('noEnterSubmit');
562
});
574
});
563
- 

Return to bug 8643