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

(-)a/admin/columns_settings.yml (+3 lines)
Lines 1440-1445 modules: Link Here
1440
              columnname: price
1440
              columnname: price
1441
            -
1441
            -
1442
              columnname: non-public_note
1442
              columnname: non-public_note
1443
            -
1444
              columnname: claims_returned
1445
              is_hidden: 1
1443
1446
1444
    print_summary:
1447
    print_summary:
1445
        print-summary-checkouts:
1448
        print-summary-checkouts:
(-)a/circ/overdue.pl (-1 / +11 lines)
Lines 255-266 if ($noreport) { Link Here
255
        items.replacementprice,
255
        items.replacementprice,
256
        items.enumchron,
256
        items.enumchron,
257
        items.itemnotes_nonpublic,
257
        items.itemnotes_nonpublic,
258
        items.itype
258
        items.itype,
259
        return_claims.created_on AS return_claim_created_on,
260
        return_claims.id AS return_claim_id
259
      FROM issues
261
      FROM issues
260
    LEFT JOIN borrowers   ON (issues.borrowernumber=borrowers.borrowernumber )
262
    LEFT JOIN borrowers   ON (issues.borrowernumber=borrowers.borrowernumber )
261
    LEFT JOIN items       ON (issues.itemnumber=items.itemnumber)
263
    LEFT JOIN items       ON (issues.itemnumber=items.itemnumber)
262
    LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber)
264
    LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber)
263
    LEFT JOIN biblio      ON (biblio.biblionumber=items.biblionumber )
265
    LEFT JOIN biblio      ON (biblio.biblionumber=items.biblionumber )
266
    LEFT JOIN return_claims ON (return_claims.borrowernumber=borrowers.borrowernumber AND return_claims.itemnumber=items.itemnumber)
264
    WHERE 1=1 "; # placeholder, since it is possible that none of the additional
267
    WHERE 1=1 "; # placeholder, since it is possible that none of the additional
265
                 # conditions will be selected by user
268
                 # conditions will be selected by user
266
    $strsth.=" AND date_due               < '" . $todaysdate     . "' " unless ($showall or $datedueto);
269
    $strsth.=" AND date_due               < '" . $todaysdate     . "' " unless ($showall or $datedueto);
Lines 308-313 if ($noreport) { Link Here
308
        my $pattrs = $borrowernumber_to_attributes{$data->{borrowernumber}} || {};  # patron attrs for this borrower
311
        my $pattrs = $borrowernumber_to_attributes{$data->{borrowernumber}} || {};  # patron attrs for this borrower
309
        # $pattrs is a hash { attrcode => [  [value,displayvalue], [value,displayvalue]... ] }
312
        # $pattrs is a hash { attrcode => [  [value,displayvalue], [value,displayvalue]... ] }
310
313
314
        my $return_claim_created_on = $data->{return_claim_created_on};
315
        if ( defined $return_claim_created_on ) {
316
            $return_claim_created_on = output_pref({ dt => dt_from_string($return_claim_created_on ) });
317
        }
318
311
        my @patron_attr_value_loop;   # template array [ {value=>v1}, {value=>v2} ... } ]
319
        my @patron_attr_value_loop;   # template array [ {value=>v1}, {value=>v2} ... } ]
312
        for my $pattr_filter (grep { ! $_->{isclone} } @patron_attr_filter_loop) {
320
        for my $pattr_filter (grep { ! $_->{isclone} } @patron_attr_filter_loop) {
313
            my @displayvalues = map { $_->[1] } @{ $pattrs->{$pattr_filter->{code}} };   # grab second value from each subarray
321
            my @displayvalues = map { $_->[1] } @{ $pattrs->{$pattr_filter->{code}} };   # grab second value from each subarray
Lines 347-352 if ($noreport) { Link Here
347
            itemcallnumber         => $data->{itemcallnumber},
355
            itemcallnumber         => $data->{itemcallnumber},
348
            replacementprice       => $data->{replacementprice},
356
            replacementprice       => $data->{replacementprice},
349
            itemnotes_nonpublic    => $data->{itemnotes_nonpublic},
357
            itemnotes_nonpublic    => $data->{itemnotes_nonpublic},
358
            return_claim_created_on => $return_claim_created_on,
359
            return_claim_id        => $data->{return_claim_id},
350
            enumchron              => $data->{enumchron},
360
            enumchron              => $data->{enumchron},
351
            itemtype               => $data->{itype},
361
            itemtype               => $data->{itype},
352
            patron_attr_value_loop => \@patron_attr_value_loop,
362
            patron_attr_value_loop => \@patron_attr_value_loop,
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc (+3 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% PROCESS 'modal-claims.inc' %]
2
<div id="checkouts">
3
<div id="checkouts">
3
    [% IF ( issuecount ) %]
4
    [% IF ( issuecount ) %]
4
        <div id="issues-table-loading-message">
5
        <div id="issues-table-loading-message">
Lines 92-97 Link Here
92
</div>
93
</div>
93
94
94
<!-- Claims Returned Modal -->
95
<!-- Claims Returned Modal -->
96
97
[% PROCESS 'modal-claims-display' %]
95
<div class="modal fade" id="claims-returned-modal" tabindex="-1" role="dialog" aria-labelledby="claims-returned-modal-label">
98
<div class="modal fade" id="claims-returned-modal" tabindex="-1" role="dialog" aria-labelledby="claims-returned-modal-label">
96
  <div class="modal-dialog" role="document">
99
  <div class="modal-dialog" role="document">
97
    <div class="modal-content">
100
    <div class="modal-content">
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc (-1 / +1 lines)
Lines 57-63 Link Here
57
57
58
        window.$time = function(value, options) {
58
        window.$time = function(value, options) {
59
            if(!value) return '';
59
            if(!value) return '';
60
            var tz = (opitons&&options.tz)||def_tz;
60
            var tz = (options&&options.tz)||def_tz;
61
            var m = moment(value);
61
            var m = moment(value);
62
            if(tz) m.tz(tz);
62
            if(tz) m.tz(tz);
63
63
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/modal-claims.inc (+104 lines)
Line 0 Link Here
1
2
[% USE Koha %]
3
<!-- modal-claims.inc -->
4
5
[% BLOCK 'modal-claims-display' %]
6
    <!-- Claims Returned Modal -->
7
    <div class="modal fade" id="claims-returned-modal" tabindex="-1" role="dialog" aria-labelledby="claims-returned-modal-label">
8
        <div class="modal-dialog" role="document">
9
            <div class="modal-content">
10
                <div class="modal-header">
11
                    <h4 class="modal-title" id="claims-returned-modal-label">Claim returned</h4>
12
                </div>
13
                <div class="modal-body">
14
15
                    <div class="form-group">
16
                        <label for="claims-returned-notes" class="control-label">Notes</label>
17
                        <div>
18
                        <textarea id="claims-returned-notes" class="form-control" rows="3"></textarea>
19
                        </div>
20
                    </div>
21
22
                    [% IF Koha.Preference('ClaimReturnedChargeFee') == 'ask' %]
23
                        <div class="form-group">
24
                        <div class="checkbox">
25
                            <label for="claims-returned-charge-lost-fee">
26
                            <input id="claims-returned-charge-lost-fee" type="checkbox" value="1">
27
                            Charge lost fee
28
                            </label>
29
                        </div>
30
                        </div>
31
                    [% END %]
32
33
                    <input type="hidden" id="claims-returned-itemnumber" />
34
                </div>
35
                <div class="modal-footer">
36
                    <button id="claims-returned-modal-btn-submit" type="button" class="btn btn-primary"><i class="fa fa-exclamation-circle"></i> Make claim</button>
37
                    <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> Cancel</button>
38
                </div>
39
            </div>
40
        </div>
41
    </div>
42
[% END %]
43
44
[% BLOCK 'modal-claims-js' %]
45
<script>
46
47
    // Verify if the syspref is defined
48
    var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]";
49
50
    var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
51
    var interface = "[% interface | html %]";
52
    var theme = "[% theme | html %]";
53
54
    // Handle return claims
55
    $(document).on("click", '.claim-returned-btn', function(e){
56
        e.preventDefault();
57
        itemnumber = $(this).data('itemnumber');
58
59
        $('#claims-returned-itemnumber').val(itemnumber);
60
        $('#claims-returned-notes').val("");
61
        $('#claims-returned-charge-lost-fee').attr('checked', false);
62
        $('#claims-returned-modal').modal();
63
    });
64
    $(document).on("click", '#claims-returned-modal-btn-submit', function(e){
65
        let itemnumber = $('#claims-returned-itemnumber').val();
66
        let notes = $('#claims-returned-notes').val();
67
        let fee = $('#claims-returned-charge-lost-fee').attr('checked') ? true : false;
68
69
        $('#claims-returned-modal').modal('hide');
70
71
        const button = $('.claim-returned-btn[data-itemnumber="' + itemnumber + '"]');
72
        const img = '<img id="return_claim_spinner_' + itemnumber + '" src="' + interface + '/' + theme + '/img/spinner-small.gif" />';
73
        button.replaceWith(img);
74
75
        params = {
76
            item_id: itemnumber,
77
            notes: notes,
78
            charge_lost_fee: fee,
79
            created_by: logged_in_user_borrowernumber,
80
        };
81
82
        $.post( '/api/v1/return_claims', JSON.stringify(params), function( data ) {
83
84
            id = "#return_claim_spinner_" + data.item_id;
85
86
            let created_on = new Date(data.created_on);
87
            let formated_date = $datetime(created_on);
88
89
            let content = "";
90
            if ( data.claim_id ) {
91
                content = '<span class="badge">' + formated_date + '</span>';
92
                $(id).parent().parent().addClass('ok');
93
            } else {
94
                content = _("Unable to claim as returned");
95
                $(id).parent().parent().addClass('warn');
96
            }
97
98
            $(id).replaceWith( content );
99
100
            $('body').trigger('refreshClaimModal');
101
        }, "json")
102
    });
103
</script>
104
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+2 lines)
Lines 1003-1008 Link Here
1003
    [% INCLUDE 'select2.inc' %]
1003
    [% INCLUDE 'select2.inc' %]
1004
    [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
1004
    [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
1005
    [% INCLUDE 'js-date-format.inc' %]
1005
    [% INCLUDE 'js-date-format.inc' %]
1006
    [% PROCESS 'modal-claims-js' %]
1007
1006
    <script>
1008
    <script>
1007
        /* Set some variable needed in circulation.js */
1009
        /* Set some variable needed in circulation.js */
1008
        var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
1010
        var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt (+21 lines)
Lines 2-7 Link Here
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE AuthorisedValues %]
3
[% USE AuthorisedValues %]
4
[% USE KohaDates %]
4
[% USE KohaDates %]
5
[% USE Koha %]
5
[%- USE Branches -%]
6
[%- USE Branches -%]
6
[%- USE Price -%]
7
[%- USE Price -%]
7
[%- USE ItemTypes -%]
8
[%- USE ItemTypes -%]
Lines 9-14 Link Here
9
[%- USE TablesSettings -%]
10
[%- USE TablesSettings -%]
10
[% SET footerjs = 1 %]
11
[% SET footerjs = 1 %]
11
[% INCLUDE 'doc-head-open.inc' %]
12
[% INCLUDE 'doc-head-open.inc' %]
13
[% PROCESS 'modal-claims.inc' %]
12
<title>Items overdue as of [% todaysdate | html %] &rsaquo; Circulation &rsaquo; Koha</title>
14
<title>Items overdue as of [% todaysdate | html %] &rsaquo; Circulation &rsaquo; Koha</title>
13
[% INCLUDE 'doc-head-close.inc' %]
15
[% INCLUDE 'doc-head-close.inc' %]
14
[% FILTER collapse %]
16
[% FILTER collapse %]
Lines 92-97 Link Here
92
          <th>Item type</th>
94
          <th>Item type</th>
93
          <th>Price</th>
95
          <th>Price</th>
94
          <th>Non-public note</th>
96
          <th>Non-public note</th>
97
          <th>Return claims</th>
95
        </tr>
98
        </tr>
96
      </thead>
99
      </thead>
97
      [%- BLOCK subject -%]Overdue:[%- END -%]
100
      [%- BLOCK subject -%]Overdue:[%- END -%]
Lines 117-128 Link Here
117
            <td>[% ItemTypes.GetDescription( overdueloo.itemtype ) | html %]</td>
120
            <td>[% ItemTypes.GetDescription( overdueloo.itemtype ) | html %]</td>
118
          <td>[% overdueloo.replacementprice | $Price %]</td>
121
          <td>[% overdueloo.replacementprice | $Price %]</td>
119
          <td>[% overdueloo.itemnotes_nonpublic | html %]</td>
122
          <td>[% overdueloo.itemnotes_nonpublic | html %]</td>
123
          <td>
124
            [% IF ( overdueloo.return_claim_created_on ) %]
125
                <span class="badge">[% overdueloo.return_claim_created_on | html %]</span>
126
            [% ELSIF Koha.Preference('ClaimReturnedLostValue') %]
127
                <a class="btn btn-default btn-xs claim-returned-btn" data-itemnumber=[% overdueloo.itemnum | html %]>
128
                    <i class="fa fa-exclamation-circle"></i> Claim returned
129
                </a>
130
            [% ELSE %]
131
                <a class="btn btn-default btn-xs" disabled="disabled" title="ClaimReturnedLostValue is not set, this feature is disabled">
132
                    <i class="fa fa-exclamation-circle"></i> Claim returned
133
                </a>
134
            [% END %]
135
          </td>
120
        </tr>
136
        </tr>
121
      [% END %]
137
      [% END %]
122
      </tbody>
138
      </tbody>
123
    </table>
139
    </table>
124
  </div>
140
  </div>
125
141
142
 <!-- Claims Returned Modal -->
143
 [% PROCESS 'modal-claims-display' %]
144
126
[% ELSE %]
145
[% ELSE %]
127
146
128
  <h1>Overdue report</h1>
147
  <h1>Overdue report</h1>
Lines 266-271 Link Here
266
    [% INCLUDE 'datatables.inc' %]
285
    [% INCLUDE 'datatables.inc' %]
267
    [% INCLUDE 'columns_settings.inc' %]
286
    [% INCLUDE 'columns_settings.inc' %]
268
    [% INCLUDE 'select2.inc' %]
287
    [% INCLUDE 'select2.inc' %]
288
    [% INCLUDE 'js-date-format.inc' %]
289
    [% PROCESS 'modal-claims-js' %]
269
    <script>
290
    <script>
270
        function clone_input( node, original_id ) {
291
        function clone_input( node, original_id ) {
271
            var original = node;
292
            var original = node;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+1 lines)
Lines 844-849 Link Here
844
    [% INCLUDE 'columns_settings.inc' %]
844
    [% INCLUDE 'columns_settings.inc' %]
845
    [% INCLUDE 'select2.inc' %]
845
    [% INCLUDE 'select2.inc' %]
846
    [% INCLUDE 'js-date-format.inc' %]
846
    [% INCLUDE 'js-date-format.inc' %]
847
    [% PROCESS 'modal-claims-js' %]
847
    <script>
848
    <script>
848
        /* Set some variable needed in circulation.js */
849
        /* Set some variable needed in circulation.js */
849
        var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
850
        var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]";
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-49 / +4 lines)
Lines 901-956 $(document).ready(function() { Link Here
901
        } ).prop('checked', false);
901
        } ).prop('checked', false);
902
    }
902
    }
903
903
904
    // Handle return claims
904
    // Refresh after return claim
905
    $(document).on("click", '.claim-returned-btn', function(e){
905
    $('body').on('refreshClaimModal', function () {
906
        e.preventDefault();
906
        refreshReturnClaimsTable();
907
        itemnumber = $(this).data('itemnumber');
907
        issuesTable.api().ajax.reload();
908
909
        $('#claims-returned-itemnumber').val(itemnumber);
910
        $('#claims-returned-notes').val("");
911
        $('#claims-returned-charge-lost-fee').attr('checked', false)
912
        $('#claims-returned-modal').modal()
913
    });
914
    $(document).on("click", '#claims-returned-modal-btn-submit', function(e){
915
        let itemnumber = $('#claims-returned-itemnumber').val();
916
        let notes = $('#claims-returned-notes').val();
917
        let fee = $('#claims-returned-charge-lost-fee').attr('checked') ? true : false;
918
919
        $('#claims-returned-modal').modal('hide')
920
921
        $('.claim-returned-btn[data-itemnumber="' + itemnumber + '"]').replaceWith('<img id="return_claim_spinner_' + itemnumber + ' src=' + interface + '/' + theme + '/img/spinner-small.gif />');
922
923
        params = {
924
            item_id: itemnumber,
925
            notes: notes,
926
            charge_lost_fee: fee,
927
            created_by: logged_in_user_borrowernumber,
928
        };
929
930
        $.post( '/api/v1/return_claims', JSON.stringify(params), function( data ) {
931
932
            id = "#return_claim_spinner_" + data.item_id;
933
934
            let created_on = new Date(data.created_on);
935
936
            let content = "";
937
            if ( data.claim_id ) {
938
                content = '<span class="badge">' + created_on.toLocaleDateString() + '</span>';
939
                $(id).parent().parent().addClass('ok');
940
            } else {
941
                content = __("Unable to claim as returned");
942
                $(id).parent().parent().addClass('warn');
943
            }
944
945
            $(id).replaceWith( content );
946
947
            refreshReturnClaimsTable();
948
            issuesTable.api().ajax.reload();
949
        }, "json")
950
951
    });
908
    });
952
909
953
954
    // Don't load return claims table unless it is clicked on
910
    // Don't load return claims table unless it is clicked on
955
    var returnClaimsTable;
911
    var returnClaimsTable;
956
    $("#return-claims-tab").click( function() {
912
    $("#return-claims-tab").click( function() {
957
- 

Return to bug 29983