Bugzilla – Attachment 79690 Details for
Bug 7088
Cannot renew items on hold even with override
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7088: Allow renew on hold items with due date
Bug-7088-Allow-renew-on-hold-items-with-due-date.patch (text/plain), 23.23 KB, created by
Andrew Isherwood
on 2018-10-01 07:43:07 UTC
(
hide
)
Description:
Bug 7088: Allow renew on hold items with due date
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2018-10-01 07:43:07 UTC
Size:
23.23 KB
patch
obsolete
>From f0603d126d237373568a78877cb2232c9863012e Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Fri, 21 Sep 2018 11:09:13 +0100 >Subject: [PATCH] Bug 7088: Allow renew on hold items with due date > >This patch adds the ability for items that are on hold to be renewed with a due date specfied by the user. It is enabled by the new "AllowRenewalOnHoldOverride" syspref. It is manifested in two locations: > >1. In the "Checkouts" table on the Patron Details screen. It is now possible to select on loan items that would otherwise fulfil a hold request to be renewed. When such an item is selected, an additional date selection box is displayed to allow the user to specify the due date for all on hold items that are to be renewed. > >2. In the Circulation > Renew alert screen. When a barcode of an on loan item that would ordinarily fulfil a hold request is entered, the usual alert is displayed indicating that the item is on hold, it is still possible to override this, and renew, however it is now also possible to specify a due date. > >Test plan: > >- Go to the Patron Details page for a patron who has an item on loan that would fulfil an outstanding loan request. >- TEST: Observe that it is NOT possible to select this item >- Enable the "AllowRenewalOnHoldOverride" syspref >- Return to the Patron Details page for a patron who has an item on loan that would fulfil an outstanding loan request. >- TEST: Observe that it IS possible to select this item >- Select the item >- TEST: Observe that an additional "On hold due date" input box is displayed >- De-select the item >- TEST: Observe that an additional "On hold due date" input box is hidden >- Select the item >- In the "On hold due date" input box, select a due date for the item >- Click "Renew or check in selected items" >- TEST: Observe that the item is renewed as usual >- In the "Renewal due date" input box, select a due date >- Remove the contents of the "On hold due date" input box >- Click "Renew or check in selected items" >- TEST: Observe that the item is renewed by falling back to the "Renewal due date" value if a value is not specified in the "On hold due date" input box >- Remove the contents of the "Renewal due date" input box >- Click "Renew or check in selected items" >- TEST: Observe that the standard loan period is used for the renewal period if no due date is specified in either box >- In the "On hold due date" input box, select a due date for the item >- In the "Renewal due date" input box, select a different due date >- Click "Renew all" >- TEST: Observe that all non on hold items are renewed using the value in "Renewal due date" and on hold items are renewed using the value in "On hold due date" >- From the main staff client from page, choose "Circulation", then choose "Renew" >- Enter the barcode of an item that you know to be on hold and submit >- TEST: In the alert box that appears, observe that a date picker is >displayed >- Choose a due date for this item, then click "Override and renew" >- TEST: In the "Item renewed" box, observe that the item has been >renewed to the date specified >--- > circ/renew.pl | 2 +- > .../intranet-tmpl/prog/css/src/staff-global.scss | 19 ++++ > .../prog/en/includes/checkouts-table-footer.inc | 10 +- > .../prog/en/modules/circ/circulation.tt | 1 + > .../intranet-tmpl/prog/en/modules/circ/renew.tt | 22 +++++ > .../prog/en/modules/members/moremember.tt | 1 + > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 101 ++++++++++++++++----- > .../intranet-tmpl/prog/js/pages/circulation.js | 2 +- > svc/renew | 6 ++ > 9 files changed, 136 insertions(+), 28 deletions(-) > >diff --git a/circ/renew.pl b/circ/renew.pl >index 246c26629f..2ec674e810 100755 >--- a/circ/renew.pl >+++ b/circ/renew.pl >@@ -92,7 +92,7 @@ if ($barcode) { > } > if ($can_renew) { > my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; >- my $date_due = AddRenewal( undef, $item->itemnumber(), $branchcode ); >+ my $date_due = AddRenewal( undef, $item->itemnumber(), $branchcode, dt_from_string( scalar $cgi->param('renewonholdduedate')) ); > $template->param( date_due => $date_due ); > } > } >diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >index 8af60e2809..c739a40b74 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >+++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss >@@ -3757,12 +3757,31 @@ span { > } > } > >+input.renew { >+ margin-right: 1em; >+} >+ > .renewals { > display: block; > font-size: .8em; > padding: .5em; > } > >+.dialog input#renewonholdduedate { >+ padding: 2px; >+} >+ >+.date-select { >+ label { >+ display: inline-block; >+ width: 40%; >+ } >+} >+ >+#newonholdduedate { >+ display: none; >+} >+ > #transport-types { > padding-top: .5px; > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc >index b831c1e507..5e3d1849c6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc >@@ -4,10 +4,12 @@ > <td id="totaldue" style="text-align: right;">[% totaldue | html %]</td> > <td id="totalfine" style="text-align: right;">[% finetotal | html %]</td> > <td id="totalprice" style="text-align: right;">[% totalprice | html %]</td> >- <td colspan="3"><div class="date-select"> >- <p><label for="newduedate">Renewal due date:</label> <input type="text" size="12" id="newduedate" name="newduedate" value="[% newduedate | html %]" /> >-</p> >- <p><label for="exemptfine">Forgive fines on return: <input type="checkbox" id="exemptfine" name="exemptfine" value="1" /></label></p></div> >+ <td colspan="3"> >+ <div class="date-select"> >+ <p><label for="newduedate">Renewal due date:</label> <input type="text" size="12" id="newduedate" name="newduedate" value="[% newduedate | html %]" /></p> >+ <p id="newonholdduedate"><label for="newonholdduedate">On hold due date:</label> <input type="text" size="12" name="newonholdduedate" value="" /></p> >+ <p><label for="exemptfine">Forgive fines on return:</label> <input type="checkbox" id="exemptfine" name="exemptfine" value="1" /></p> >+ </div> > </td> > </tr> > </tfoot> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index dbf3e2d37e..1fac3368cb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -995,6 +995,7 @@ No patron matched <span class="ex">[% message | html %]</span> > var branchcode = "[% branch | html %]"; > var exports_enabled = "[% Koha.Preference('ExportCircHistory') | html %]"; > var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride') )? 1: 0 | html %]; >+ var AllowRenewalOnHoldOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalOnHoldOverride') )? 1: 0 | html %]; > var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 | html %]; > var script = "circulation"; > var relatives_borrowernumbers = new Array(); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >index 11c3eca4fc..133d94ef49 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt >@@ -1,3 +1,5 @@ >+[% USE raw %] >+[% USE Asset %] > [% USE Koha %] > [% USE KohaDates %] > [% SET footerjs = 1 %] >@@ -110,6 +112,9 @@ > <input type="hidden" name="barcode" value="[% item.barcode | html %]"/> > <input type="hidden" name="override_limit" value="1" /> > <input type="hidden" name="override_holds" value="1" /> >+ <div> >+ <label for="renewonholdduedate">Renewal due date:</label> <input type="text" size="12" id="renewonholdduedate" name="renewonholdduedate" value="" /> >+ </div> > <button type="submit" class="approve"><i class="fa fa-check"></i> Override and renew</button> > </form> > >@@ -175,6 +180,9 @@ > <div> > > [% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'calendar.inc' %] >+ [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %] >+ [% INCLUDE 'timepicker.inc' %] > [% IF error %] > <script type="text/javascript"> > $( document ).ready(function() { >@@ -182,6 +190,20 @@ > }); > </script> > [% END %] >+ <script type="text/javascript"> >+ $( document ).ready(function() { >+ $("#renewonholdduedate").datetimepicker({ >+ onClose: function(dateText, inst) { >+ validate_date(dateText, inst); >+ }, >+ minDate: 1, // require that renewal date is after today >+ hour: 23, >+ minute: 59 >+ }).on('change', function(e) { >+ if ( ! is_valid_date( $(this).val() ) ) {$(this).val('');} >+ }); >+ }); >+ </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 a88a98ee88..b61ccb0651 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -815,6 +815,7 @@ > var exports_enabled = "[% Koha.Preference('ExportCircHistory') | html %]"; > var AllowCirculate = [% (CAN_user_circulate_circulate_remaining_permissions)? 1 : 0 | html %] > var AllowRenewalLimitOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalLimitOverride') )? 1: 0 | html %]; >+ var AllowRenewalOnHoldOverride = [% (CAN_user_circulate_override_renewals && Koha.Preference('AllowRenewalOnHoldOverride') )? 1: 0 | html %]; > var script = "moremember"; > var relatives_borrowernumbers = new Array(); > [% FOREACH b IN relatives_borrowernumbers %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index b964a9cd8f..2b176713b1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -3,14 +3,37 @@ $(document).ready(function() { > > var barcodefield = $("#barcode"); > >+ var onHoldDueDateSet = false; >+ >+ var onHoldChecked = function() { >+ var isChecked = false; >+ $('input[data-on-reserve]').each(function() { >+ if ($(this).is(':checked')) { >+ isChecked=true; >+ } >+ }); >+ return isChecked; >+ }; >+ >+ var showHideOnHoldRenewal = function() { >+ // Display the date input >+ if (onHoldChecked()) { >+ $('#newonholdduedate').show() >+ } else { >+ $('#newonholdduedate').hide(); >+ } >+ }; >+ > // Handle the select all/none links for checkouts table columns > $("#CheckAllRenewals").on("click",function(){ > $("#UncheckAllCheckins").click(); > $(".renew:visible").prop("checked", true); >+ showHideOnHoldRenewal(); > return false; > }); > $("#UncheckAllRenewals").on("click",function(){ > $(".renew:visible").prop("checked", false); >+ showHideOnHoldRenewal(); > return false; > }); > >@@ -24,6 +47,16 @@ $(document).ready(function() { > return false; > }); > >+ $("#newduedate").on("change", function() { >+ if (!onHoldDueDateSet) { >+ $('#newonholdduedate input').val($('#newduedate').val()); >+ } >+ }); >+ >+ $("#newonholdduedate").on("change", function() { >+ onHoldDueDateSet = true; >+ }); >+ > // Don't allow both return and renew checkboxes to be checked > $(document).on("change", '.renew', function(){ > if ( $(this).is(":checked") ) { >@@ -36,6 +69,12 @@ $(document).ready(function() { > } > }); > >+ // Display on hold due dates input when an on hold item is >+ // selected >+ $(document).on('change', '.renew', function(){ >+ showHideOnHoldRenewal(); >+ }); >+ > $("#output_format > option:first-child").attr("selected", "selected"); > $("select[name='csv_profile_id']").hide(); > $(document).on("change", '#issues-table-output-format', function(){ >@@ -92,18 +131,28 @@ $(document).ready(function() { > $(".renew:checked:visible").each(function() { > var override_limit = $("#override_limit").is(':checked') ? 1 : 0; > >+ var isOnReserve = $(this).data().hasOwnProperty('onReserve'); >+ > var itemnumber = $(this).val(); > > $(this).parent().parent().replaceWith("<img id='renew_" + itemnumber + "' src='" + interface + "/" + theme + "/img/spinner-small.gif' />"); > > var params = { >- itemnumber: itemnumber, >- borrowernumber: borrowernumber, >- branchcode: branchcode, >- override_limit: override_limit, >- date_due: $("#newduedate").val() >+ itemnumber: itemnumber, >+ borrowernumber: borrowernumber, >+ branchcode: branchcode, >+ override_limit: override_limit, > }; > >+ // Determine which due date we need to use >+ var dueDate = isOnReserve ? >+ $("#newonholdduedate input").val() : >+ $("#newduedate").val(); >+ >+ if (dueDate && dueDate.length > 0) { >+ params.date_due = dueDate >+ } >+ > $.post( "/cgi-bin/koha/svc/renew", params, function( data ) { > var id = "#renew_" + data.itemnumber; > >@@ -146,6 +195,7 @@ $(document).ready(function() { > $("#RenewAll").on("click",function(){ > $("#CheckAllRenewals").click(); > $("#UncheckAllCheckins").click(); >+ showHideOnHoldRenewal(); > $("#RenewCheckinChecked").click(); > > // Prevent form submit >@@ -344,79 +394,77 @@ $(document).ready(function() { > "bVisible": AllowCirculate ? true : false, > "mDataProp": function ( oObj ) { > var content = ""; >+ var msg = ""; > var span_style = ""; > var span_class = ""; > >- content += "<span>"; >- content += "<span style='padding: 0 1em;'>" + oObj.renewals_count + "</span>"; >- > if ( oObj.can_renew ) { > // Do nothing > } else if ( oObj.can_renew_error == "on_reserve" ) { >- content += "<span class='renewals-disabled-no-override'>" >+ msg += "<span class='renewals-disabled-no-override'>" > + "<a href='/cgi-bin/koha/reserve/request.pl?biblionumber=" + oObj.biblionumber + "'>" + ON_HOLD + "</a>" > + "</span>"; > >- span_style = "display: none"; >+ span_style = AllowRenewalLimitOverride ? "" : "display: none"; > span_class = "renewals-allowed"; > } else if ( oObj.can_renew_error == "too_many" ) { >- content += "<span class='renewals-disabled'>" >+ msg += "<span class='renewals-disabled'>" > + NOT_RENEWABLE > + "</span>"; > > span_style = "display: none"; > span_class = "renewals-allowed"; > } else if ( oObj.can_renew_error == "restriction" ) { >- content += "<span class='renewals-disabled'>" >+ msg += "<span class='renewals-disabled'>" > + NOT_RENEWABLE_RESTRICTION > + "</span>"; > > span_style = "display: none"; > span_class = "renewals-allowed"; > } else if ( oObj.can_renew_error == "overdue" ) { >- content += "<span class='renewals-disabled'>" >+ msg += "<span class='renewals-disabled'>" > + NOT_RENEWABLE_OVERDUE > + "</span>"; > > span_style = "display: none"; > span_class = "renewals-allowed"; > } else if ( oObj.can_renew_error == "too_soon" ) { >- content += "<span class='renewals-disabled'>" >+ msg += "<span class='renewals-disabled'>" > + NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date ) > + "</span>"; > > span_style = "display: none"; > span_class = "renewals-allowed"; > } else if ( oObj.can_renew_error == "auto_too_soon" ) { >- content += "<span class='renewals-disabled'>" >+ msg += "<span class='renewals-disabled'>" > + NOT_RENEWABLE_AUTO_TOO_SOON > + "</span>"; > > span_style = "display: none"; > span_class = "renewals-allowed"; > } else if ( oObj.can_renew_error == "auto_too_late" ) { >- content += "<span class='renewals-disabled'>" >+ msg += "<span class='renewals-disabled'>" > + NOT_RENEWABLE_AUTO_TOO_LATE > + "</span>"; > > span_style = "display: none"; > span_class = "renewals-allowed"; > } else if ( oObj.can_renew_error == "auto_too_much_oweing" ) { >- content += "<span class='renewals-disabled'>" >+ msg += "<span class='renewals-disabled'>" > + NOT_RENEWABLE_AUTO_TOO_MUCH_OWEING > + "</span>"; > > span_style = "display: none"; > span_class = "renewals-allowed"; > } else if ( oObj.can_renew_error == "auto_account_expired" ) { >- content += "<span class='renewals-disabled'>" >+ msg += "<span class='renewals-disabled'>" > + NOT_RENEWABLE_AUTO_ACCOUNT_EXPIRED > + "</span>"; > > span_style = "display: none"; > span_class = "renewals-allowed"; > } else if ( oObj.can_renew_error == "auto_renew" ) { >- content += "<span class='renewals-disabled'>" >+ msg += "<span class='renewals-disabled'>" > + NOT_RENEWABLE_AUTO_RENEW > + "</span>"; > >@@ -425,7 +473,7 @@ $(document).ready(function() { > } else if ( oObj.can_renew_error == "onsite_checkout" ) { > // Don't display something if it's an onsite checkout > } else { >- content += "<span class='renewals-disabled'>" >+ msg += "<span class='renewals-disabled'>" > + oObj.can_renew_error > + "</span>"; > >@@ -433,17 +481,26 @@ $(document).ready(function() { > span_class = "renewals-allowed"; > } > >- var can_force_renew = ( oObj.onsite_checkout == 0 ) && ( oObj.can_renew_error != "on_reserve" ); >+ var can_force_renew = ( oObj.onsite_checkout == 0 ) && >+ ( oObj.can_renew_error != "on_reserve" || (oObj.can_renew_error == "on_reserve" && AllowRenewalOnHoldOverride)) >+ ? true : false; > var can_renew = ( oObj.renewals_remaining > 0 && !oObj.can_renew_error ); >+ content += "<span>"; > if ( can_renew || can_force_renew ) { >+ content += "<span style='padding: 0 1em;'>" + oObj.renewals_count + "</span>"; > content += "<span class='" + span_class + "' style='" + span_style + "'>" > + "<input type='checkbox' "; > if ( oObj.date_due_overdue && can_renew ) { > content += "checked='checked' "; > } >+ if (oObj.can_renew_error == "on_reserve") { >+ content += "data-on-reserve "; >+ } > content += "class='renew' id='renew_" + oObj.itemnumber + "' name='renew' value='" + oObj.itemnumber +"'/>" > + "</span>"; >- >+ } >+ content += msg; >+ if ( can_renew || can_force_renew ) { > content += "<span class='renewals'>(" > + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed ) > + ")</span>"; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >index cd2ca9bc4f..9602550500 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >@@ -28,7 +28,7 @@ $(document).ready(function() { > radioCheckBox($(this)); > }); > >- $("#newduedate").datetimepicker({ >+ $("#newduedate, #newonholdduedate input").datetimepicker({ > onClose: function(dateText, inst) { > validate_date(dateText, inst); > }, >diff --git a/svc/renew b/svc/renew >index 1aa9a28944..29e51d8cf7 100755 >--- a/svc/renew >+++ b/svc/renew >@@ -59,6 +59,12 @@ $data->{branchcode} = $branchcode; > ( $data->{renew_okay}, $data->{error} ) = > CanBookBeRenewed( $borrowernumber, $itemnumber, $override_limit ); > >+# If we're allowing reserved items to be renewed... >+if ( $data->{error} && $data->{error} eq 'on_reserve' && C4::Context->preference('AllowRenewalOnHoldOverride')) { >+ $data->{renew_okay} = 1; >+ $data->{error} = undef; >+} >+ > if ( $data->{renew_okay} ) { > $date_due = AddRenewal( $borrowernumber, $itemnumber, $branchcode, $date_due ); > $data->{date_due} = output_pref( { dt => $date_due, as_due_date => 1 } ); >-- >2.11.0
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 7088
:
79689
|
79690
|
79691
|
82274
|
83004
|
83005
|
83006
|
83092
|
83093
|
83094
|
84509
|
84510
|
84850
|
85434
|
85435
|
85436
|
85437
|
85438
|
85439
|
85440
|
88446
|
88868
|
89026
|
89027
|
89028
|
89029
|
89030
|
89031
|
89032
|
89033
|
89034
|
89044
|
89045
|
89046
|
89047
|
89048
|
89049
|
89050
|
89051
|
89052
|
89086
|
89087
|
89088
|
89089
|
89090
|
89091
|
89092
|
89093
|
89094