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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-24 / +26 lines)
Lines 540-546 function PopupMARCFieldDoc(field) { Link Here
540
        var subfields = new Array();
540
        var subfields = new Array();
541
        var tab = new Array();
541
        var tab = new Array();
542
        var label = new Array();
542
        var label = new Array();
543
        var flag=0;
543
        var flag = false;
544
        var tabflag= new Array();
544
        var tabflag= new Array();
545
        var StrAlert = "<div id='form-errors' class='dialog alert list'>";
545
        var StrAlert = "<div id='form-errors' class='dialog alert list'>";
546
        var notFilledClass = "subfield_not_filled";
546
        var notFilledClass = "subfield_not_filled";
Lines 609-615 function PopupMARCFieldDoc(field) { Link Here
609
                var tag=tagsubfieldid.substr(0,3);
609
                var tag=tagsubfieldid.substr(0,3);
610
                var subfield=tagsubfieldid.substr(3,1);
610
                var subfield=tagsubfieldid.substr(3,1);
611
                StrAlert += "<li>"+_("Tag %s subfield %s %s in tab %s").format(tag, subfield, formatFieldName( tabflag[tagsubfieldid][1] ), tabflag[tagsubfieldid][2]) + ' <a class="linkfield btn btn-link" href="#" data-tab="' + tabflag[tagsubfieldid][2] + '" data-field="' + tabflag[tagsubfieldid][3] + '"><i class="fa fa-arrow-right" aria-hidden="true"></i> ' + _("Go to field") + '</a></li>';
611
                StrAlert += "<li>"+_("Tag %s subfield %s %s in tab %s").format(tag, subfield, formatFieldName( tabflag[tagsubfieldid][1] ), tabflag[tagsubfieldid][2]) + ' <a class="linkfield btn btn-link" href="#" data-tab="' + tabflag[tagsubfieldid][2] + '" data-field="' + tabflag[tagsubfieldid][3] + '"><i class="fa fa-arrow-right" aria-hidden="true"></i> ' + _("Go to field") + '</a></li>';
612
                flag=1;
612
                flag = true;
613
            }
613
            }
614
        }
614
        }
615
        StrAlert += "</ul>";
615
        StrAlert += "</ul>";
Lines 663-669 function PopupMARCFieldDoc(field) { Link Here
663
            }
663
            }
664
664
665
            if(isempty){
665
            if(isempty){
666
                flag = 1;
666
                flag = true;
667
                if (mandatory) {
667
                if (mandatory) {
668
                    mandatoryFields[ arr[0] ] = {
668
                    mandatoryFields[ arr[0] ] = {
669
                        importance: "mandatory",
669
                        importance: "mandatory",
Lines 694-700 function PopupMARCFieldDoc(field) { Link Here
694
            StrAlert += "</ul>";
694
            StrAlert += "</ul>";
695
        }
695
        }
696
        StrAlert += "</div>";
696
        StrAlert += "</div>";
697
        if (flag) {
697
        if ( flag ) {
698
            $("#show-errors").html('<button type="button" class="btn btn-danger show-errors"><i class="fa fa-warning"></i> ' + _("Errors") + '</span>');
698
            $("#show-errors").html('<button type="button" class="btn btn-danger show-errors"><i class="fa fa-warning"></i> ' + _("Errors") + '</span>');
699
            return StrAlert;
699
            return StrAlert;
700
        } else {
700
        } else {
Lines 703-735 function PopupMARCFieldDoc(field) { Link Here
703
    }
703
    }
704
704
705
    /**
705
    /**
706
     *
706
     * Run checks for mandatory and important fields
707
     *
707
     * Output errors if necessary, or submit the form
708
     */
708
     */
709
    function Check(){
709
    function Check(){
710
        var StrAlert = AreFieldsNotOk();
710
        var StrAlert = AreFieldsNotOk();
711
        if( ! StrAlert ){
711
        var StrWarning = AreFieldsNotOk( false );
712
            var StrWarning = AreFieldsNotOk(false);
712
        if( !StrAlert && StrWarning ){
713
            if (StrWarning){
713
            // Check important fields
714
714
            $("#check_errors").html( StrWarning );
715
                // Check important fields
715
            $('html, body').animate({ scrollTop: 0 }, 'fast');
716
                $("#check_errors").html( AreFieldsNotOk(false) );
717
                $('html, body').animate({ scrollTop: 0 }, 'fast');
718
716
719
                var r=confirm(_("Important fields(s) are not filled. Are you sure you want to save?"));
717
            var r=confirm( _("Important fields(s) are not filled. Are you sure you want to save?" ) );
720
                if (! r){
718
            if (! r){
721
                    return false;
719
                return false;
722
                }
720
            } else {
721
                document.f.submit();
722
                return true;
723
            }
723
            }
724
            document.f.submit();
724
        } else if( StrAlert ){
725
            return true;
725
            var strAll = StrAlert;
726
        } else {
726
            if( StrWarning ){
727
727
                strAll += StrWarning;
728
            // Call AreFieldsNotOk() twice to check both mandatory and important fields
728
            }
729
            $("#check_errors").html( AreFieldsNotOk() + AreFieldsNotOk(false) );
729
            $("#check_errors").html( strAll );
730
            $('html, body').animate({ scrollTop: 0 }, 'fast');
730
            $('html, body').animate({ scrollTop: 0 }, 'fast');
731
            Sticky.hcSticky('refresh');
731
            Sticky.hcSticky('refresh');
732
            return false;
732
            return false;
733
        } else if( !StrAlert && !StrWarning ){
734
            document.f.submit();
735
            return true;
733
        }
736
        }
734
    }
737
    }
735
738
736
- 

Return to bug 30482