Bugzilla – Attachment 130004 Details for
Bug 29983
Display the return claims column in the circulation overdues page (overdue.tt)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29983: Display the pretend claim column in overdue.tt
Bug-29983-Display-the-pretend-claim-column-in-over.patch (text/plain), 17.36 KB, created by
Jérémy Breuillard
on 2022-01-31 13:53:50 UTC
(
hide
)
Description:
Bug 29983: Display the pretend claim column in overdue.tt
Filename:
MIME Type:
Creator:
Jérémy Breuillard
Created:
2022-01-31 13:53:50 UTC
Size:
17.36 KB
patch
obsolete
>From 8535f22ffca4e87c88533920fb654c67cbc3682a Mon Sep 17 00:00:00 2001 >From: jeremy breuillard <jeremy.breuillard@biblibre.com> >Date: Wed, 15 Dec 2021 15:24:41 +0100 >Subject: [PATCH] Bug 29983: Display the pretend claim column in overdue.tt > >This patch displays the column "Return claims" from the page "moremember.pl" to the page "overdues.pl" > >Test plan: >1)Use a patron with at least 1 item who should be checked out soon >2)Home > Patron > Patron details for [name] >3)Click on the 'Checkout' button down the page to show the full table and notice the "Return Claims" column >4)Now go to Home > Circulation > Overdues >5)Find the patron who has to check out and have a look at the table >6)Apply patch and repeat 4) and 5) -> the "Return Claim" column is now displayed on the table >--- > circ/overdue.pl | 12 +- > .../prog/en/includes/checkouts-table.inc | 37 +------ > .../prog/en/includes/js-date-format.inc | 2 +- > .../prog/en/includes/modal-claims.inc | 104 ++++++++++++++++++ > .../prog/en/modules/circ/overdue.tt | 27 ++++- > .../prog/en/modules/members/moremember.tt | 5 +- > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 52 +-------- > 7 files changed, 150 insertions(+), 89 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/modal-claims.inc > >diff --git a/circ/overdue.pl b/circ/overdue.pl >index 1ce791fe24..88b8c822b8 100755 >--- a/circ/overdue.pl >+++ b/circ/overdue.pl >@@ -248,12 +248,15 @@ if ($noreport) { > items.replacementprice, > items.enumchron, > items.itemnotes_nonpublic, >- items.itype >+ items.itype, >+ return_claims.created_on AS return_claim_created_on, >+ return_claims.id AS return_claim_id > FROM issues > LEFT JOIN borrowers ON (issues.borrowernumber=borrowers.borrowernumber ) > LEFT JOIN items ON (issues.itemnumber=items.itemnumber) > LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) > LEFT JOIN biblio ON (biblio.biblionumber=items.biblionumber ) >+ LEFT JOIN return_claims ON (return_claims.borrowernumber=borrowers.borrowernumber AND return_claims.itemnumber=items.itemnumber) > WHERE 1=1 "; # placeholder, since it is possible that none of the additional > # conditions will be selected by user > $strsth.=" AND date_due < '" . $todaysdate . "' " unless ($showall); >@@ -301,6 +304,11 @@ if ($noreport) { > my $pattrs = $borrowernumber_to_attributes{$data->{borrowernumber}} || {}; # patron attrs for this borrower > # $pattrs is a hash { attrcode => [ [value,displayvalue], [value,displayvalue]... ] } > >+ my $return_claim_created_on = $data->{return_claim_created_on}; >+ if ( defined $return_claim_created_on ) { >+ $return_claim_created_on = output_pref({ dt => dt_from_string( $return_claim_created_on ) }); >+ } >+ > my @patron_attr_value_loop; # template array [ {value=>v1}, {value=>v2} ... } ] > for my $pattr_filter (grep { ! $_->{isclone} } @patron_attr_filter_loop) { > my @displayvalues = map { $_->[1] } @{ $pattrs->{$pattr_filter->{code}} }; # grab second value from each subarray >@@ -336,6 +344,8 @@ if ($noreport) { > itemcallnumber => $data->{itemcallnumber}, > replacementprice => $data->{replacementprice}, > itemnotes_nonpublic => $data->{itemnotes_nonpublic}, >+ return_claim_created_on => $return_claim_created_on, >+ return_claim_id => $data->{return_claim_id}, > enumchron => $data->{enumchron}, > itemtype => $data->{itype}, > patron_attr_value_loop => \@patron_attr_value_loop, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >index 38a4700416..34f86e6f90 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table.inc >@@ -1,4 +1,5 @@ > [% USE Koha %] >+[% PROCESS 'modal-claims.inc' %] > <div id="checkouts"> > [% IF ( issuecount ) %] > <div id="issues-table-loading-message"> >@@ -92,41 +93,7 @@ > </div> > > <!-- Claims Returned Modal --> >-<div class="modal fade" id="claims-returned-modal" tabindex="-1" role="dialog" aria-labelledby="claims-returned-modal-label"> >- <div class="modal-dialog" role="document"> >- <div class="modal-content"> >- <div class="modal-header"> >- <h4 class="modal-title" id="claims-returned-modal-label">Claim returned</h4> >- </div> >- <div class="modal-body"> >- >- <div class="form-group"> >- <label for="claims-returned-notes" class="control-label">Notes</label> >- <div> >- <textarea id="claims-returned-notes" class="form-control" rows="3"></textarea> >- </div> >- </div> >- >- [% IF Koha.Preference('ClaimReturnedChargeFee') == 'ask' %] >- <div class="form-group"> >- <div class="checkbox"> >- <label for="claims-returned-charge-lost-fee"> >- <input id="claims-returned-charge-lost-fee" type="checkbox" value="1"> >- Charge lost fee >- </label> >- </div> >- </div> >- [% END %] >- >- <input type="hidden" id="claims-returned-itemnumber" /> >- </div> >- <div class="modal-footer"> >- <button id="claims-returned-modal-btn-submit" type="button" class="btn btn-primary"><i class="fa fa-exclamation-circle"></i> Make claim</button> >- <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> Cancel</button> >- </div> >- </div> >- </div> >-</div> >+[% PROCESS 'modal-claims-display' %] > > <!-- Resolve Return Claim Modal --> > <div class="modal fade" id="claims-returned-resolved-modal" tabindex="-1" role="dialog" aria-labelledby="claims-returned-resolved-modal-label"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc >index 3dae094b8d..92445eca31 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc >@@ -57,7 +57,7 @@ > > window.$time = function(value, options) { > if(!value) return ''; >- var tz = (opitons&&options.tz)||def_tz; >+ var tz = (options&&options.tz)||def_tz; > var m = moment(value); > if(tz) m.tz(tz); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/modal-claims.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/modal-claims.inc >new file mode 100644 >index 0000000000..bb0e408d41 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/modal-claims.inc >@@ -0,0 +1,104 @@ >+ >+[% USE Koha %] >+<!-- modal-claims.inc --> >+ >+[% BLOCK 'modal-claims-display' %] >+ <!-- Claims Returned Modal --> >+ <div class="modal fade" id="claims-returned-modal" tabindex="-1" role="dialog" aria-labelledby="claims-returned-modal-label"> >+ <div class="modal-dialog" role="document"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <h4 class="modal-title" id="claims-returned-modal-label">Claim returned</h4> >+ </div> >+ <div class="modal-body"> >+ >+ <div class="form-group"> >+ <label for="claims-returned-notes" class="control-label">Notes</label> >+ <div> >+ <textarea id="claims-returned-notes" class="form-control" rows="3"></textarea> >+ </div> >+ </div> >+ >+ [% IF Koha.Preference('ClaimReturnedChargeFee') == 'ask' %] >+ <div class="form-group"> >+ <div class="checkbox"> >+ <label for="claims-returned-charge-lost-fee"> >+ <input id="claims-returned-charge-lost-fee" type="checkbox" value="1"> >+ Charge lost fee >+ </label> >+ </div> >+ </div> >+ [% END %] >+ >+ <input type="hidden" id="claims-returned-itemnumber" /> >+ </div> >+ <div class="modal-footer"> >+ <button id="claims-returned-modal-btn-submit" type="button" class="btn btn-primary"><i class="fa fa-exclamation-circle"></i> Make claim</button> >+ <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> Cancel</button> >+ </div> >+ </div> >+ </div> >+ </div> >+[% END %] >+ >+[% BLOCK 'modal-claims-js' %] >+<script> >+ >+ // Verify if the syspref is defined >+ var ClaimReturnedLostValue = "[% Koha.Preference('ClaimReturnedLostValue') | html %]"; >+ >+ var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]"; >+ var interface = "[% interface | html %]"; >+ var theme = "[% theme | html %]"; >+ >+ // Handle return claims >+ $(document).on("click", '.claim-returned-btn', function(e){ >+ e.preventDefault(); >+ itemnumber = $(this).data('itemnumber'); >+ >+ $('#claims-returned-itemnumber').val(itemnumber); >+ $('#claims-returned-notes').val(""); >+ $('#claims-returned-charge-lost-fee').attr('checked', false); >+ $('#claims-returned-modal').modal(); >+ }); >+ $(document).on("click", '#claims-returned-modal-btn-submit', function(e){ >+ let itemnumber = $('#claims-returned-itemnumber').val(); >+ let notes = $('#claims-returned-notes').val(); >+ let fee = $('#claims-returned-charge-lost-fee').attr('checked') ? true : false; >+ >+ $('#claims-returned-modal').modal('hide'); >+ >+ const button = $('.claim-returned-btn[data-itemnumber="' + itemnumber + '"]'); >+ const img = '<img id="return_claim_spinner_' + itemnumber + '" src="' + interface + '/' + theme + '/img/spinner-small.gif" />'; >+ button.replaceWith(img); >+ >+ params = { >+ item_id: itemnumber, >+ notes: notes, >+ charge_lost_fee: fee, >+ created_by: logged_in_user_borrowernumber, >+ }; >+ >+ $.post( '/api/v1/return_claims', JSON.stringify(params), function( data ) { >+ >+ id = "#return_claim_spinner_" + data.item_id; >+ >+ let created_on = new Date(data.created_on); >+ let formated_date = $datetime(created_on); >+ >+ let content = ""; >+ if ( data.claim_id ) { >+ content = '<span class="badge">' + formated_date + '</span>'; >+ $(id).parent().parent().addClass('ok'); >+ } else { >+ content = __("Unable to claim as returned"); >+ $(id).parent().parent().addClass('warn'); >+ } >+ >+ $(id).replaceWith( content ); >+ >+ $('body').trigger('refreshClaimModal'); >+ }, "json") >+ }); >+</script> >+[% END %] >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >index 7d14c2662d..8a6532d112 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/overdue.tt >@@ -2,6 +2,7 @@ > [% USE Asset %] > [% USE AuthorisedValues %] > [% USE KohaDates %] >+[% USE Koha %] > [%- USE Branches -%] > [%- USE Price -%] > [%- USE ItemTypes -%] >@@ -9,6 +10,7 @@ > [%- USE TablesSettings -%] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] >+[% PROCESS 'modal-claims.inc' %] > <title>Koha › Circulation › Items overdue as of [% todaysdate | html %]</title> > [% INCLUDE 'doc-head-close.inc' %] > [% FILTER collapse %] >@@ -77,6 +79,7 @@ > <th>Item type</th> > <th>Price</th> > <th>Non-public note</th> >+ <th>Return claims</th> > </tr> > </thead> > [%- BLOCK subject -%]Overdue:[%- END -%] >@@ -100,12 +103,28 @@ > <td>[% ItemTypes.GetDescription( overdueloo.itemtype ) | html %]</td> > <td>[% overdueloo.replacementprice | $Price %]</td> > <td>[% overdueloo.itemnotes_nonpublic | html %]</td> >+ <td> >+ [% IF ( overdueloo.return_claim_created_on ) %] >+ <span class="badge">[% overdueloo.return_claim_created_on %]</span> >+ [% ELSIF Koha.Preference('ClaimReturnedLostValue') %] >+ <a class="btn btn-default btn-xs claim-returned-btn" data-itemnumber=[% overdueloo.itemnum | html %]> >+ <i class="fa fa-exclamation-circle"></i> Claim returned >+ </a> >+ [% ELSE %] >+ <a class="btn btn-default btn-xs" disabled="disabled" title="ClaimReturnedLostValue is not set, this feature is disabled"> >+ <i class="fa fa-exclamation-circle"></i> Claim returned >+ </a> >+ [% END %] >+ </td> > </tr> > [% END %] >- </tbody> >+ </tbody> > </table> > </div> > >+ <!-- Claims Returned Modal --> >+ [% PROCESS 'modal-claims-display' %] >+ > [% ELSE %] > > <h2>Overdue report</h2> >@@ -249,7 +268,11 @@ > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] > [% INCLUDE 'select2.inc' %] >+ [% INCLUDE 'js-date-format.inc' %] >+ [% PROCESS 'modal-claims-js' %] > <script> >+ >+ > function clone_input( node, original_id ) { > var original = node; > var clone = original.clone(); >@@ -307,7 +330,7 @@ > clone_input( $(this).parent(), $(this).data("original-id") ); > }) > }); >- </script> >+ </script> > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 7b7fd26e67..1f9906cf8a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -914,6 +914,8 @@ > [% INCLUDE 'calendar.inc' %] > [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %] > [% INCLUDE 'timepicker.inc' %] >+ [% INCLUDE 'js-date-format.inc' %] >+ [% PROCESS 'modal-claims-js' %] > <script> > /* Set some variable needed in circulation.js */ > var logged_in_user_borrowernumber = "[% logged_in_user.borrowernumber | html %]"; >@@ -979,7 +981,6 @@ > "bPaginate": false > })); > >- > $("#view_restrictions").on("click",function(){ > $('#debarments-tab-link').click(); > }); >@@ -994,8 +995,8 @@ > e.preventDefault(); > $("#picture-upload, #show-picture-upload").toggle(); > }); >- > }); >+ > function uncheck_sibling(me){ > nodename=me.getAttribute("name"); > if (nodename =="barcodes[]"){ >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index 7668a41ee4..39169b2fdf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -888,56 +888,12 @@ $(document).ready(function() { > } ).prop('checked', false); > } > >- // Handle return claims >- $(document).on("click", '.claim-returned-btn', function(e){ >- e.preventDefault(); >- itemnumber = $(this).data('itemnumber'); >- >- $('#claims-returned-itemnumber').val(itemnumber); >- $('#claims-returned-notes').val(""); >- $('#claims-returned-charge-lost-fee').attr('checked', false) >- $('#claims-returned-modal').modal() >- }); >- $(document).on("click", '#claims-returned-modal-btn-submit', function(e){ >- let itemnumber = $('#claims-returned-itemnumber').val(); >- let notes = $('#claims-returned-notes').val(); >- let fee = $('#claims-returned-charge-lost-fee').attr('checked') ? true : false; >- >- $('#claims-returned-modal').modal('hide') >- >- $('.claim-returned-btn[data-itemnumber="' + itemnumber + '"]').replaceWith('<img id="return_claim_spinner_' + itemnumber + ' src=' + interface + '/' + theme + '/img/spinner-small.gif />'); >- >- params = { >- item_id: itemnumber, >- notes: notes, >- charge_lost_fee: fee, >- created_by: logged_in_user_borrowernumber, >- }; >- >- $.post( '/api/v1/return_claims', JSON.stringify(params), function( data ) { >- >- id = "#return_claim_spinner_" + data.item_id; >- >- let created_on = new Date(data.created_on); >- >- let content = ""; >- if ( data.claim_id ) { >- content = '<span class="badge">' + created_on.toLocaleDateString() + '</span>'; >- $(id).parent().parent().addClass('ok'); >- } else { >- content = __("Unable to claim as returned"); >- $(id).parent().parent().addClass('warn'); >- } >- >- $(id).replaceWith( content ); >- >- refreshReturnClaimsTable(); >- issuesTable.api().ajax.reload(); >- }, "json") >- >+ // Refresh after return claim >+ $('body').on('refreshClaimModal', function () { >+ refreshReturnClaimsTable(); >+ issuesTable.api().ajax.reload(); > }); > >- > // Don't load return claims table unless it is clicked on > var returnClaimsTable; > $("#return-claims-tab").click( function() { >-- >2.17.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29983
:
130004
|
130036
|
130037
|
130121
|
130240
|
134223
|
136334
|
138470
|
138471
|
138472
|
138801