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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt (-1 / +252 lines)
Lines 1-3 Link Here
1
[% USE Koha %]
1
[% USE Branches %]
2
[% USE Branches %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
4
<title>Koha &rsaquo; Administration &rsaquo; Circulation and fine rules</title>
Lines 26-31 function clear_edit(){ Link Here
26
    $(edit_row).find("td:last input[name='clear']").remove();
27
    $(edit_row).find("td:last input[name='clear']").remove();
27
}
28
}
28
29
30
function change_tester_input(el) {
31
    $(el).parent().find("span").css("display", "none");
32
    $(el).parent().find("span").eq($("option:selected", el).index()).css("display", "inline");
33
}
34
35
function reset_tester_results() {
36
    $("td[id^='tester_res_']").each(function() {
37
        $(this).html("");
38
    });
39
}
40
41
function tester_submit() {
42
    var url = "/api/v1/issuingrules/effective";
43
    var query_params = {};
44
    $.each($("input[name^=tester_input_], select[name^=tester_input_]"), function () {
45
        if ($(this).parent().css("display") === "none") {
46
            return true;
47
        }
48
        var param = $(this).attr("name").replace("tester_input_", "");
49
        if ($(this).val() || param === 'branchcode' && !$(this).val()) {
50
            query_params[param] = $(this).val();
51
        }
52
    });
53
    $.ajax({
54
        url: "/api/v1/issuingrules/effective?"+$.param(query_params),
55
        method: "GET",
56
        statusCode: {
57
            200: function(response) {
58
                $("#tester_error").html("").css("display","none");
59
                $.each(response, function (key,val) {
60
                    if (key === "hardduedate") {
61
                        var compare;
62
                        switch (response.hardduedatecompare) {
63
                            case -1:
64
                                compare = _("Before");
65
                                break;
66
                            case 0:
67
                                compare = _("Exactly on");
68
                                break;
69
                            case 1:
70
                                compare = _("After");
71
                                break;
72
                            default:
73
                                compare = _("Exactly on");
74
                                break;
75
                        }
76
                        val = "("+compare+") " + response.hardduedate;
77
                    }
78
                    if (val === "*") {
79
                        val = _("All");
80
                    }
81
                    $("#tester_res_"+key).html("" + val);
82
                });
83
            },
84
            400: function(xhr) {
85
                $("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block");
86
                reset_tester_results();
87
            },
88
            404: function(xhr) {
89
                $("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block");
90
                reset_tester_results();
91
            },
92
            401: function(xhr) {
93
                $("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block");
94
                reset_tester_results();
95
            },
96
            403: function(xhr) {
97
                $("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block");
98
                reset_tester_results();
99
            },
100
            500: function(xhr) {
101
                $("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block");
102
                reset_tester_results();
103
            },
104
            503: function(xhr) {
105
                $("#tester_error").html('<i class="fa fa-exclamation-triangle"></i> ' + xhr.responseJSON.error).css("display", "block");
106
                reset_tester_results();
107
            }
108
        },
109
        dataType: "json"
110
    });
111
}
112
29
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
113
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this rule? This cannot be undone.");
30
114
31
$(document).ready(function() {
115
$(document).ready(function() {
Lines 105-110 $(document).ready(function() { Link Here
105
            e.preventDefault();
189
            e.preventDefault();
106
            clear_edit();
190
            clear_edit();
107
        });
191
        });
192
193
        $("#issuing-rules-tester-container").css("display", "none");
194
        $("#toggle-tester").click(function() {
195
            $("#issuing-rules-tester-container").toggle();
196
        });
197
        $("#tester_patron").val("cardnumber");
198
        $("#tester_item").val("barcode");
199
        $("#tester_branch").val($("#tester_branch option:first").val());
200
        change_tester_input($("#tester_patron"));
201
        change_tester_input($("#tester_item"));
202
        change_tester_input($("#tester_branch"));
203
        $("select[id^='tester_']").change(function(e) {
204
            change_tester_input(this);
205
        });
206
207
        tester_submit();
208
        $("#tester_submit").click(function () {
209
            tester_submit();
210
        });
211
212
108
});
213
});
109
//]]>
214
//]]>
110
</script>
215
</script>
Lines 427-432 $(document).ready(function() { Link Here
427
            </table>
532
            </table>
428
        </form>
533
        </form>
429
    </div>
534
    </div>
535
    <div id="issuing-rules-tester" class="container" style="width:auto;">
536
    <a id="toggle-tester" class="btn btn-default btn-sm">Circulation and fine rules test tool</a>
537
    <div id="issuing-rules-tester-container">
538
    <h3>Circulation and fine rules test tool</h3>
539
        <p>This test tool lets you search a row of circulation and fine rules for a specific patron, item and library.</p>
540
        <p>Dropdown value for <strong>Library</strong> is determined via system preference <strong>CircControl</strong>. If the preference is set to item's library, then system preference <strong>HomeOrHoldingBranch</strong> defines the branch to use. You can test with any library by selecting the last option <i>Library</i>.</p>
541
        <table>
542
            <thead>
543
            <tr>
544
                <th>Patron</th>
545
                <th>Item</th>
546
                <th>Library</th>
547
                <th>Actions</th>
548
            </tr>
549
            </thead>
550
            <tbody>
551
                <tr>
552
                <td>
553
                    <select id="tester_patron" name="tester_patron">
554
                        <option value="cardnumber">Card number</option>
555
                        <option value="borrowernumber">Borrowernumber</option>
556
                        <option value="categorycode">Categorycode</option>
557
                    </select>
558
                    <span><input type="text" name="tester_input_cardnumber" placeholder="Card number" /></span>
559
                    <span><input type="text" name="tester_input_borrowernumber" placeholder="Borrowernumber" /></span>
560
                    <span>
561
                        <select name="tester_input_categorycode" id="tester_categorycode">
562
                            <option value="">All</option>
563
                        [% FOREACH patron_category IN patron_categories%]
564
                            <option value="[% patron_category.categorycode %]">[% patron_category.description %]</option>
565
                        [% END %]
566
                        </select>
567
                    </span>
568
                </td>
569
                <td>
570
                    <select id="tester_item" name="tester_item">
571
                        <option value="barcode">Barcode</option>
572
                        <option value="itemnumber">Itemnumber</option>
573
                        <option value="itemtype">Item type</option>
574
                    </select>
575
                    <span><input type="text" name="tester_input_barcode" placeholder="Barcode" /></span>
576
                    <span><input type="text" name="tester_input_itemnumber" placeholder="Itemnumber" /></span>
577
                    <span>
578
                        <select name="tester_input_itemtype" id="tester_itemtype">
579
                            <option value="">All</option>
580
                        [% FOREACH itemtypeloo IN itemtypeloop %]
581
                            <option value="[% itemtypeloo.itemtype %]">[% itemtypeloo.translated_description %]</option>
582
                        [% END %]
583
                        </select>
584
                    </span>
585
                </td>
586
                <td>
587
                    <select id="tester_branch" name="tester_branch">
588
                    [% IF Koha.Preference('CircControl') == 'PatronLibrary' %]
589
                        <option value="patronlibrary">Patron's home library</option>
590
                    [% ELSIF Koha.Preference('CircControl') == 'ItemHomeLibrary' %]
591
                        [% IF Koha.Preference('HomeOrHoldingBranch') == 'homebranch' %]
592
                        <option value="itemhomelibrary">Item's home library</option>
593
                        [% ELSE %]
594
                        <option value="itemholdinglibrary">Item's holding library</option>
595
                        [% END %]
596
                    [% ELSE %]
597
                        <option value="pickuplibrary">Current library ([% LoginBranchname %])</option>
598
                    [% END %]
599
                        <option value="library">Library</option>
600
                    </select>
601
                    <span></span>
602
                    <span>
603
                        <select name="tester_input_branchcode" id="tester_branchcode">
604
                            <option value="">All</option>
605
                            [% PROCESS options_for_libraries libraries => Branches.all( unfiltered => 1 ) %]
606
                        </select>
607
                    </span>
608
                </td>
609
                <td><button type="submit" id="tester_submit" class="btn btn-default btn-xs"><i class="fa fa-search"></i> Find</button></td>
610
                </tr>
611
            </tbody>
612
        </table>
613
        <table>
614
            <thead>
615
            <tr>
616
                <th>Library</th>
617
                <th>Patron category</th>
618
                <th>Item type</th>
619
                <th>Current checkouts allowed</th>
620
                <th>Current on-site checkouts allowed</th>
621
                <th>Loan period</th>
622
                <th>Unit</th>
623
                <th>Hard due date</th>
624
                <th>Fine amount</th>
625
                <th>Fine charging interval</th>
626
                <th>When to charge</th>
627
                <th>Fine grace period</th>
628
                <th>Overdue fines cap (amount)</th>
629
                <th>Cap fine at replacement price</th>
630
                <th>Suspension in days (day)</th>
631
                <th>Max. suspension duration (day)</th>
632
                <th>Renewals allowed (count)</th>
633
                <th>Renewal period</th>
634
                <th>No renewal before</th>
635
                <th>Automatic renewal</th>
636
                <th>No automatic renewal after</th>
637
                <th>No automatic renewal after (hard limit)</th>
638
                <th>Holds allowed (count)</th>
639
                <th>Holds per record (count)</th>
640
                <th>On shelf holds allowed</th>
641
                <th>Item level holds</th>
642
                <th>Article requests</th>
643
                <th>Rental discount (%)</th>
644
            </tr>
645
            </thead>
646
            <tbody>
647
            <tr id="tester_res_results">
648
                <td id="tester_res_branchcode"></td>
649
                <td id="tester_res_categorycode"></td>
650
                <td id="tester_res_itemtype"></td>
651
                <td id="tester_res_maxissueqty"></td>
652
                <td id="tester_res_maxonsiteissueqty"></td>
653
                <td id="tester_res_issuelength"></td>
654
                <td id="tester_res_lengthunit"></td>
655
                <td id="tester_res_hardduedate"></td>
656
                <td id="tester_res_fine"></td>
657
                <td id="tester_res_chargeperiod"></td>
658
                <td id="tester_res_chargeperiod_charge_at"></td>
659
                <td id="tester_res_firstremind"></td>
660
                <td id="tester_res_overduefinescap"></td>
661
                <td id="tester_res_cap_fine_to_replacement_price"></td>
662
                <td id="tester_res_finedays"></td>
663
                <td id="tester_res_maxsuspensiondays"></td>
664
                <td id="tester_res_renewalsallowed"></td>
665
                <td id="tester_res_renewalperiod"></td>
666
                <td id="tester_res_norenewalbefore"></td>
667
                <td id="tester_res_auto_renew"></td>
668
                <td id="tester_res_no_auto_renewal_after"></td>
669
                <td id="tester_res_no_auto_renewal_after_hard_limit"></td>
670
                <td id="tester_res_reservesallowed"></td>
671
                <td id="tester_res_holds_per_record"></td>
672
                <td id="tester_res_onshelfholds"></td>
673
                <td id="tester_res_opacitemholds"></td>
674
                <td id="tester_res_article_requests"></td>
675
                <td id="tester_res_rentaldiscount"></td>
676
            </tr>
677
            </tbody>
678
        </table>
679
        <div id="tester_error" class="alert alert-danger"></div>
680
    </div>
681
    </div>
430
    <div id="defaults-for-this-library" class="container">
682
    <div id="defaults-for-this-library" class="container">
431
    <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) %][% END %]</h3>
683
    <h3>Default checkout, hold and return policy[% IF humanbranch %] for [% Branches.GetName( humanbranch ) %][% END %]</h3>
432
        <p>You can set a default maximum number of checkouts, hold policy and return policy that will be used if none is defined below for a particular item type or category.</p>
684
        <p>You can set a default maximum number of checkouts, hold policy and return policy that will be used if none is defined below for a particular item type or category.</p>
433
- 

Return to bug 19037