Bugzilla – Attachment 130037 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]
Bug 29983: Display the pretend claim column in overdue.tt
Bug-29983-Display-the-pretend-claim-column-in-over.patch (text/plain), 15.06 KB, created by
Jérémy Breuillard
on 2022-02-01 10:28:19 UTC
(
hide
)
Description:
Bug 29983: Display the pretend claim column in overdue.tt
Filename:
MIME Type:
Creator:
Jérémy Breuillard
Created:
2022-02-01 10:28:19 UTC
Size:
15.06 KB
patch
obsolete
>From 2a11937039f4b9de76efa9eefff3915f424b48cf Mon Sep 17 00:00:00 2001 >From: jeremy breuillard <jeremy.breuillard@biblibre.com> >Date: Tue, 1 Feb 2022 11:20:07 +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". Rebase on master. > >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 | 3 + > .../prog/en/includes/js-date-format.inc | 2 +- > .../prog/en/includes/modal-claims.inc | 104 ++++++++++++++++++ > .../prog/en/modules/circ/overdue.tt | 21 ++++ > .../prog/en/modules/members/moremember.tt | 1 + > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 52 +-------- > 7 files changed, 145 insertions(+), 50 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 a4df26e174..14cf2128f5 100755 >--- a/circ/overdue.pl >+++ b/circ/overdue.pl >@@ -250,12 +250,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); >@@ -303,6 +306,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 >@@ -339,6 +347,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 002a1b4440..03d46f49e1 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,6 +93,8 @@ > </div> > > <!-- Claims Returned Modal --> >+ >+[% PROCESS 'modal-claims-display' %] > <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"> >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 34df3aedec..7d06490932 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>Items overdue as of [% todaysdate | html %] › Circulation › Koha</title> > [% INCLUDE 'doc-head-close.inc' %] > [% FILTER collapse %] >@@ -92,6 +94,7 @@ > <th>Item type</th> > <th>Price</th> > <th>Non-public note</th> >+ <th>Return claims</th> > </tr> > </thead> > [%- BLOCK subject -%]Overdue:[%- END -%] >@@ -117,12 +120,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> > </table> > </div> > >+ <!-- Claims Returned Modal --> >+ [% PROCESS 'modal-claims-display' %] >+ > [% ELSE %] > > <h2>Overdue report</h2> >@@ -266,6 +285,8 @@ > [% 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; >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 951c3e1023..de1487c891 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -861,6 +861,7 @@ > [% INCLUDE 'timepicker.inc' %] > [% INCLUDE 'select2.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 %]"; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index e31585814a..ff01dff8ca 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 Raw
Actions:
View
Attachments on
bug 29983
:
130004
|
130036
|
130037
|
130121
|
130240
|
134223
|
136334
|
138470
|
138471
|
138472
|
138801