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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-23 lines)
Lines 562-590 fieldset.rows table { clear: none; margin: 0; } Link Here
562
        [%- ELSE -%]
562
        [%- ELSE -%]
563
            var mana_enabled = 0;
563
            var mana_enabled = 0;
564
        [%- END -%]
564
        [%- END -%]
565
        var MSG_LINK_TO_VENDOR = _("If you wish to claim late or missing issues you must link this subscription to a vendor. Click OK to ignore or Cancel to return and enter a vendor");
566
        var MSG_LINK_BIBLIO = _("You must choose or create a bibliographic record");
567
        var MSG_BIBLIO_NOT_EXIST = _("Bibliographic record does not exist!");
568
        var MSG_REQUIRED_SUB_LENGTH = _("You must choose a subscription length or an end date.");
569
        var MSG_TEST_PREDICTION = _("Please click on 'Test prediction pattern' before saving subscription.");
570
        var MSG_REQUIRED_PUB_DATE = _("You must choose a first publication date");
571
        var MSG_SAVE_PREDICTION_PATTERN = _("You have modified the advanced prediction pattern. Please save your work or cancel modifications.");
572
        var MSG_PATTERN_IRREG = _("Warning! Present pattern has planned irregularities. Click on 'Test prediction pattern' to check if it's still valid");
573
        var MSG_PATTERN_NAME = _("Please enter a name for this pattern");
574
        var MSG_PATTERN_NAME_EXISTS = _("This pattern name already exists. Do you want to modify it?");
575
        var MSG_OVERWRITE_PATTERNS = _("Warning: This will modify the pattern for all subscriptions that are using it.");
576
        var MSG_PATTERN_CREATE_FAILED = _("Something went wrong. Unable to create a new numbering pattern.");
577
        var MSG_PATTERN_TEST_FAILED = _("Cannot test prediction pattern for the following reason(s): %s");
578
        var MSG_FREQUENCY_UNDEFINED = _("Frequency is not defined");
579
        var MSG_PUB_DATE_UNDEFINED = _("First publication date is not defined");
580
        var MSG_NEXT_ISSUE_UNDEFINED = _("Next issue publication date is not defined");
581
        var MSG_MANA_SEARCHING = _("Searching for subscription in Mana Knowledge Base");
582
        var MSG_MANA_RESULTS = _("Results from Mana Knowledge Base");
583
        var MSG_MANA_SUBSCRIPTION_FOUND = _("Subscription found on Mana Knowledge Base:");
584
        var MSG_MANA_SHOW_DETAILS = _("Show Mana results");
585
        var MSG_MANA_NO_SUBSCRIPTION_FOUND = _("No subscription found on Mana Knowledge Base");
586
        var MSG_MANA_SHARE_PATTERN = _("Please feel free to share your pattern with all others librarians once you are done");
587
588
        var BOOKSELLER_IDS = [% To.json( bookseller_ids ) || '[]' | $raw %];
565
        var BOOKSELLER_IDS = [% To.json( bookseller_ids ) || '[]' | $raw %];
589
    </script>
566
    </script>
590
    [% Asset.js("js/subscription-add.js") | $raw %]
567
    [% Asset.js("js/subscription-add.js") | $raw %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js (-23 / +22 lines)
Lines 16-22 function check_issues(){ Link Here
16
        if (document.f.subtype.value == globalfreqdata.unit){
16
        if (document.f.subtype.value == globalfreqdata.unit){
17
            document.f.issuelengthcount.value=(document.f.sublength.value*globalfreqdata.issuesperunit)/globalfreqdata.unitsperissue;
17
            document.f.issuelengthcount.value=(document.f.sublength.value*globalfreqdata.issuesperunit)/globalfreqdata.unitsperissue;
18
        } else if (document.f.subtype.value != "issues"){
18
        } else if (document.f.subtype.value != "issues"){
19
            alert( MSG_FREQUENCY_LENGTH_ERROR );
19
            alert( __("Frequency and subscription length provided doesn't combine well. Please consider entering an issue count rather than a time period.") );
20
        }
20
        }
21
    }
21
    }
22
}
22
}
Lines 48-54 function Clear(id) { Link Here
48
function Check_page1() {
48
function Check_page1() {
49
    var bookseller_id = $("#aqbooksellerid").val();
49
    var bookseller_id = $("#aqbooksellerid").val();
50
    if ( bookseller_id.length == 0) {
50
    if ( bookseller_id.length == 0) {
51
        input_box = confirm( MSG_LINK_TO_VENDOR );
51
        input_box = confirm( __("If you wish to claim late or missing issues you must link this subscription to a vendor. Click OK to ignore or Cancel to return and enter a vendor") );
52
        if (input_box==false) {
52
        if (input_box==false) {
53
            return false;
53
            return false;
54
        }
54
        }
Lines 62-97 function Check_page1() { Link Here
62
62
63
    var biblionumber = $("#biblionumber").val()
63
    var biblionumber = $("#biblionumber").val()
64
    if ( biblionumber.length == 0 ) {
64
    if ( biblionumber.length == 0 ) {
65
        alert( MSG_LINK_BIBLIO );
65
        alert( __("You must choose or create a bibliographic record") );
66
        return false;
66
        return false;
67
    }
67
    }
68
68
69
    var bib_exists = $("input[name='title']").val().length;
69
    var bib_exists = $("input[name='title']").val().length;
70
70
71
    if (!bib_exists) alert(MSG_BIBLIO_NOT_EXIST);
71
    if (!bib_exists) alert( __("Bibliographic record does not exist!") );
72
    return bib_exists;
72
    return bib_exists;
73
}
73
}
74
74
75
function Check_page2(){
75
function Check_page2(){
76
    if( more_than_one_serial == "" ){
76
    if( more_than_one_serial == "" ){
77
        if($("#acqui_date").val().length == 0){
77
        if($("#acqui_date").val().length == 0){
78
            alert( MSG_REQUIRED_PUB_DATE );
78
            alert( __("You must choose a first publication date") );
79
            return false;
79
            return false;
80
        }
80
        }
81
    }
81
    }
82
    if($("#sublength").val().length == 0 && $("input[name='enddate']").val().length == 0){
82
    if($("#sublength").val().length == 0 && $("input[name='enddate']").val().length == 0){
83
        alert( MSG_REQUIRED_SUB_LENGTH );
83
        alert( __("You must choose a subscription length or an end date.") );
84
        return false;
84
        return false;
85
    }
85
    }
86
    if(advancedpatternlocked == 0){
86
    if(advancedpatternlocked == 0){
87
        alert( MSG_SAVE_PREDICTION_PATTERN );
87
        alert( __("You have modified the advanced prediction pattern. Please save your work or cancel modifications.") );
88
        return false;
88
        return false;
89
    }
89
    }
90
    if(patternneedtobetested){
90
    if(patternneedtobetested){
91
        if( irregularity !== "" ){
91
        if( irregularity !== "" ){
92
            alert( MSG_PATTERN_IRREG );
92
            alert( __("Warning! Present pattern has planned irregularities. Click on 'Test prediction pattern' to check if it's still valid") );
93
        } else {
93
        } else {
94
            alert( MSG_TEST_PREDICTION );
94
            alert( __("Please click on 'Test prediction pattern' before saving subscription.") );
95
        }
95
        }
96
        return false;
96
        return false;
97
    }
97
    }
Lines 272-295 function testPredictionPattern() { Link Here
272
    var error = 0;
272
    var error = 0;
273
    var error_msg = "";
273
    var error_msg = "";
274
    if(frequencyid == undefined || frequencyid == ""){
274
    if(frequencyid == undefined || frequencyid == ""){
275
        error_msg += "- " + MSG_FREQUENCY_UNDEFINED + "\n";
275
        error_msg += "- " + __("Frequency is not defined") + "\n";
276
        error ++;
276
        error ++;
277
    }
277
    }
278
    acquidate = $("#acqui_date").val();
278
    acquidate = $("#acqui_date").val();
279
    if(acquidate == undefined || acquidate == ""){
279
    if(acquidate == undefined || acquidate == ""){
280
        error_msg += "-" + MSG_PUB_DATE_UNDEFINED + "\n";
280
        error_msg += "-" + __("First publication date is not defined") + "\n";
281
        error ++;
281
        error ++;
282
    }
282
    }
283
    if( more_than_one_serial !== "" ){
283
    if( more_than_one_serial !== "" ){
284
        var nextacquidate = $("#nextacquidate").val();
284
        var nextacquidate = $("#nextacquidate").val();
285
        if(nextacquidate == undefined || nextacquidate == ""){
285
        if(nextacquidate == undefined || nextacquidate == ""){
286
            error_msg += "-" + MSG_NEXT_ISSUE_UNDEFINED + "\n";
286
            error_msg += "-" + __("Next issue publication date is not defined") + "\n";
287
            error ++;
287
            error ++;
288
        }
288
        }
289
    }
289
    }
290
290
291
    if(error){
291
    if(error){
292
        alert( MSG_PATTERN_TEST_FAILED.format(error_msg) );
292
        alert( __("Cannot test prediction pattern for the following reason(s): %s").format(error_msg) );
293
        return false;
293
        return false;
294
    }
294
    }
295
295
Lines 338-344 function testPredictionPattern() { Link Here
338
338
339
function saveAdvancedPattern() {
339
function saveAdvancedPattern() {
340
    if ($("#patternname").val().length == 0) {
340
    if ($("#patternname").val().length == 0) {
341
        alert( MSG_PATTERN_NAME );
341
        alert( __("Please enter a name for this pattern") );
342
        return false;
342
        return false;
343
    }
343
    }
344
344
Lines 353-360 function saveAdvancedPattern() { Link Here
353
    });
353
    });
354
    var cnfrm = 1;
354
    var cnfrm = 1;
355
    if(found){
355
    if(found){
356
        var msg = MSG_PATTERN_NAME_EXISTS
356
        var msg = __("This pattern name already exists. Do you want to modify it?")
357
            + "\n" + MSG_OVERWRITE_PATTERNS;
357
            +"\n" + __("Warning: This will modify the pattern for all subscriptions that are using it.");
358
        cnfrm = confirm(msg);
358
        cnfrm = confirm(msg);
359
    }
359
    }
360
360
Lines 384-390 function saveAdvancedPattern() { Link Here
384
                    $("#numberpattern").val(data.numberpatternid);
384
                    $("#numberpattern").val(data.numberpatternid);
385
                    numberpatternload();
385
                    numberpatternload();
386
                } else {
386
                } else {
387
                    alert( MSG_PATTERN_CREATE_FAILED );
387
                    alert( __("Something went wrong. Unable to create a new numbering pattern.") );
388
                }
388
                }
389
            }
389
            }
390
        );
390
        );
Lines 405-411 function show_page_2() { Link Here
405
}
405
}
406
406
407
function mana_search() {
407
function mana_search() {
408
    $("#mana_search").html("<p>" + MSG_MANA_SEARCHING + "... <img src='" + interface + "/" + theme + "/img/spinner-small.gif' /></p>");
408
    $("#mana_search").html("<p>" + __("Searching for subscription in Mana Knowledge Base") + "... <img src='" + interface + "/" + theme + "/img/spinner-small.gif' /></p>");
409
    $("#mana_search").show();
409
    $("#mana_search").show();
410
410
411
    $.ajax({
411
    $.ajax({
Lines 416-422 function mana_search() { Link Here
416
    })
416
    })
417
        .done( function( result ) {
417
        .done( function( result ) {
418
            $("#mana_search_result .modal-body").html(result);
418
            $("#mana_search_result .modal-body").html(result);
419
            $("#mana_search_result_label").text( MSG_MANA_RESULTS );
419
            $("#mana_search_result_label").text( __("Results from Mana Knowledge Base") );
420
            $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults, {
420
            $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults, {
421
                "sPaginationType": "full",
421
                "sPaginationType": "full",
422
                "order":[[4, "desc"], [5, "desc"]],
422
                "order":[[4, "desc"], [5, "desc"]],
Lines 430-439 function mana_search() { Link Here
430
                ]
430
                ]
431
            }));
431
            }));
432
            if( $("#mana_results_datatable").length && $("td.dataTables_empty").length == 0){
432
            if( $("#mana_results_datatable").length && $("td.dataTables_empty").length == 0){
433
                $("#mana_search").html("<p>" + MSG_MANA_SUBSCRIPTION_FOUND + "</p><p> <a href=\"#\" data-toggle=\"modal\" data-target=\"#mana_search_result\"><i class=\"fa fa-window-maximize\"></i> " + MSG_MANA_SHOW_DETAILS + "</a></p>");
433
                $("#mana_search").html("<p>" + __("Subscription found on Mana Knowledge Base:") + "</p><p> <a href=\"#\" data-toggle=\"modal\" data-target=\"#mana_search_result\"><i class=\"fa fa-window-maximize\"></i> " + __("Show Mana results") + "</a></p>");
434
            }
434
            }
435
            else if ( $("#mana_results_datatable").length ){
435
            else if ( $("#mana_results_datatable").length ){
436
                $("#mana_search").html("<p>" + MSG_MANA_NO_SUBSCRIPTION_FOUND + "</p><p>" + MSG_MANA_SHARE_PATTERN + "</p>");
436
                $("#mana_search").html("<p>" + __("No subscription found on Mana Knowledge Base") + "</p><p>" + __("Please feel free to share your pattern with all others librarians once you are done") + "</p>");
437
            }
437
            }
438
            else{
438
            else{
439
                $("#mana_search").html( result );
439
                $("#mana_search").html( result );
Lines 721-727 $(document).ready(function() { Link Here
721
            },
721
            },
722
            error: function (x) {
722
            error: function (x) {
723
                $("input[name='title']").val('');
723
                $("input[name='title']").val('');
724
                $("#error_bib_not_exist").html("This bibliographic record does not exist");
724
                $("#error_bib_not_exist").html( __("This bibliographic record does not exist") );
725
            }
725
            }
726
        });
726
        });
727
    });
727
    });
728
- 

Return to bug 26257