Bugzilla – Attachment 125078 Details for
Bug 29060
Use modal for suspending holds until a date from the holds page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29060: Use modal for suspending holds until a date from the holds page
Bug-29060-Use-modal-for-suspending-holds-until-a-d.patch (text/plain), 12.50 KB, created by
Owen Leonard
on 2021-09-20 17:48:23 UTC
(
hide
)
Description:
Bug 29060: Use modal for suspending holds until a date from the holds page
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2021-09-20 17:48:23 UTC
Size:
12.50 KB
patch
obsolete
>From dc89283a2f019013e264143f43eb5174c8ff7be2 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 21 Apr 2021 19:17:51 +0000 >Subject: [PATCH] Bug 29060: Use modal for suspending holds until a date from > the holds page > >This patch modifies the way suspensions are handled when viewing the >list of holds on a particular title. In particular, when >AutoResumeSuspendedHolds is enabled the "suspend until" form field is >hidden until the suspend button is clicked, when a modal window appears. >This is consistent with the way it works when working with the list of >holds on a patron record. > >The patch also converts the hold deletion button from an "X" image to a >more-standard "Delete" button. > >To test, apply the patch and make sure AutoResumeSuspendedHolds is >enabled. > >- Locate a title in the catalog with multiple holds. >- View the holds on that title. In the list of holds you should see > "Delete" and "Suspend" buttons in the last two columns of the tabel of > holds. >- Test that the "Delete" button works correctly, >- Test the "Suspend" button. Clicking it should trigger a modal window > where you can set a date for the hold to resume. > - Submitting the form with a date should result in the page reloading > and showing the hold as suspended until that date. > - Submitting hte form without a date should result in the page > reloading and showing the hold as suspended. > - Test that the "Resume" button works to remove the suspension. >- Disable AutoResumeSuspendedHolds. Now when you click the "Suspend" > button you should not see the modal. The page should reload and the > hold should be suspended without a resume date. >--- > .../prog/en/includes/holds_table.inc | 23 ++++--- > .../prog/en/modules/reserve/request.tt | 62 ++++++++++++++++++- > 2 files changed, 73 insertions(+), 12 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >index 59f33cd2a0..3b74cc774b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc >@@ -177,6 +177,13 @@ > [% IF hold.non_priority %] > <br><i>Non priority hold</i> > [% END %] >+ [% IF ( hold.suspend ) %] >+ [% IF ( hold.suspend_until ) -%] >+ <p id="suspend-details-[% hold.reserve_id | html %]" style="font-size:90%">Hold is <strong>suspended</strong> until [% hold.suspend_until | $KohaDates %]</p> >+ [% ELSE %] >+ <p id="suspend-details-[% hold.reserve_id | html %]" style="font-size:90%">Hold is <strong>suspended</strong></p> >+ [% END %] >+ [% END %] > </td> > > [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %] >@@ -196,28 +203,24 @@ > [% END %] > > <td> >- <a class="cancel-hold" title="Cancel hold" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-id="[% hold.reserve_id | html %]" href="request.pl?action=cancel&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]"> >- <img src="[% interface | html %]/[% theme | html %]/img/x.png" alt="Cancel" /> >+ <a class="cancel-hold btn btn-default btn-xs" title="Cancel hold" data-borrowernumber="[% hold.borrowernumber | html %]" data-biblionumber="[% hold.biblionumber | html %]" data-id="[% hold.reserve_id | html %]" href="request.pl?action=cancel&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&reserve_id=[% hold.reserve_id | html %]&date=[% hold.date | html %]"> >+ <i class="fa fa-trash" aria-hidden="true"></i> Delete > </a> > </td> > > <td> > [% IF Koha.Preference('SuspendHoldsIntranet') %] > [% UNLESS ( hold.found ) %] >- <input type="button" value="[% IF ( hold.suspend ) %]Unsuspend[% ELSE %]Suspend[% END %]" onclick="window.location.href='request.pl?action=toggleSuspend&reserve_id=[% hold.reserve_id | html %]&borrowernumber=[% hold.borrowernumber | html %]&biblionumber=[% hold.biblionumber | html %]&date=[% hold.date | html %]&suspend_until=' + $('#suspend_until_[% hold.reserve_id | html %]').val()" /> >- >- [% IF Koha.Preference('AutoResumeSuspendedHolds') %] >- <label for="suspend_until_[% hold.reserve_id | html %]">[% IF ( hold.suspend ) %] on [% ELSE %] until [% END %]</label> >- <input type="text" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" size="10" value="[% hold.suspend_until | $KohaDates %]" class="datepicker suspend_until_datepicker" /> >- <a href='#' onclick="document.getElementById('suspend_until_[% hold.reserve_id | html %]').value='';">Clear date</a> >+ [% IF ( hold.suspend ) %] >+ <a class="hold-resume btn btn-default btn-xs" data-biblionumber="[% hold.biblionumber | html %]" data-borrowernumber="[% hold.borrowernumber | html %]" data-reserve-id="[% hold.reserve_id | html %]" data-title="[% hold_title | html %]" data-date="[% hold.date | html %]" id="resume[% hold.reserve_id | html %]"><i class="fa fa-play"></i> Resume</a> > [% ELSE %] >- <input type="hidden" name="suspend_until_[% hold.reserve_id | html %]" id="suspend_until_[% hold.reserve_id | html %]" value=""/> >+ <a class="hold-suspend btn btn-default btn-xs" data-biblionumber="[% hold.biblionumber | html %]" data-borrowernumber="[% hold.borrowernumber | html %]" data-reserve-id="[% hold.reserve_id | html %]" data-title="[% hold_title | html %]" data-date="[% hold.date | html %]" id="suspend[% hold.reserve_id | html %]"><i class="fa fa-pause"></i> Suspend</a> > [% END %] > [% END %] > [% END # IF SuspendHoldsIntranet %] > > [% IF ( hold.found ) %] >- <input type="button" id="revert_hold_[% hold.reserve_id | html %]" value="[% IF hold.intransit %]Revert transit status[% ELSE %]Revert waiting status[% END %]" onclick="window.location.href='request.pl?action=move&where=down&first_priority=[% first_priority | uri %]&last_priority=[% last_priority | uri %]&prev_priority=0&next_priority=1&borrowernumber=[% hold.borrowernumber | uri %]&biblionumber=[% hold.biblionumber | uri %]&itemnumber=[% hold.itemnumber | uri %]&reserve_id=[% hold.reserve_id | uri %]&date=[% hold.date | uri %]'"> >+ <input class="btn btn-default btn-xs" type="button" id="revert_hold_[% hold.reserve_id | html %]" value="[% IF hold.intransit %]Revert transit status[% ELSE %]Revert waiting status[% END %]" onclick="window.location.href='request.pl?action=move&where=down&first_priority=[% first_priority | uri %]&last_priority=[% last_priority | uri %]&prev_priority=0&next_priority=1&borrowernumber=[% hold.borrowernumber | uri %]&biblionumber=[% hold.biblionumber | uri %]&itemnumber=[% hold.itemnumber | uri %]&reserve_id=[% hold.reserve_id | uri %]&date=[% hold.date | uri %]'"> > [% END %] > </td> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index f54ac0d32a..9db277e97b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -1000,12 +1000,12 @@ > [% holds_by_itemtype.push( h ) %] > [% END %] > [% END %] >- [% INCLUDE holds_table.inc holds=holds_by_itemtype %] >+ [% INCLUDE holds_table.inc holds=holds_by_itemtype hold_title = biblioloo.title %] > [% END %] > </fieldset> > [% END # /FOREACH b %] > [% ELSE %] >- [% INCLUDE holds_table.inc holds=biblioloo.reserveloop %] >+ [% INCLUDE holds_table.inc holds=biblioloo.reserveloop hold_title = biblioloo.title %] > [% END # /IF HoldsSplitQueue %] > > [% END # /IF biblioloo.reserveloop %] >@@ -1590,6 +1590,64 @@ > stickTo: "#existing_holds", > stickyClass: "floating" > }); >+ >+ $("body").append("\ >+ <div id='suspend-modal' class='modal' role='dialog' aria-hidden='true'>\ >+ <div class='modal-dialog'>\ >+ <div class='modal-content'>\ >+ <form id='suspend-modal-form' class='form-inline' name='suspend-modal-form' action='request.pl' method='post'>\ >+ <div class='modal-header'>\ >+ <button type='button' class='closebtn' data-dismiss='modal' aria-hidden='true'>Ã</button>\ >+ <h3 id='suspend-modal-label'>" + _("Suspend hold on") + " <em><span id='suspend-modal-title'></span></em></h3>\ >+ </div>\ >+ <div class='modal-body'>\ >+ <input type='hidden' name='action' value='toggleSuspend' />\ >+ <input type='hidden' id='suspend-modal-borrowernumber' name='borrowernumber' />\ >+ <input type='hidden' id='suspend-modal-biblionumber' name='biblionumber' />\ >+ <input type='hidden' id='suspend-modal-date' name='date' />\ >+ <input type='hidden' id='suspend-modal-reserve_id' name='reserve_id' />\ >+ <label for='suspend-modal-until'>" + _("Suspend until:") + "</label>\ >+ <input name='suspend_until' id='suspend-modal-until' class='suspend-until' size='10' />\ >+ <p><a class='btn btn-link' id='suspend-modal-clear-date' ><i class='fa fa-remove' aria-hidden='true'></i> " + _("Clear date to suspend indefinitely") + "</a></p>\ >+ </div>\ >+ <div class='modal-footer'>\ >+ <button id='suspend-modal-submit' class='btn btn-default' type='submit'>" + _("Suspend") + "</button>\ >+ <a href='#' data-dismiss='modal' aria-hidden='true' class='cancel'>" + _("Cancel") + "</a>\ >+ </div>\ >+ </form>\ >+ </div>\ >+ </div>\ >+ </div>\ >+ "); >+ >+ $(".hold-suspend, .hold-resume").on( "click", function(e) { >+ e.preventDefault(); >+ var id = $(this).data("reserve-id") >+ var title = $(this).data("title"); >+ var borrowernumber = $(this).data("borrowernumber"); >+ var biblionumber = $(this).data("biblionumber"); >+ var date = $(this).data("date"); >+ >+ $("#suspend-modal-title").html( title ); >+ $("#suspend-modal-reserve_id").val( id ); >+ $("#suspend-modal-borrowernumber").val( borrowernumber ); >+ $("#suspend-modal-biblionumber").val( biblionumber ); >+ $("#suspend-modal-date").val( date ); >+ /* Actions based on which button was pushed */ >+ if( $(this).hasClass("hold-resume") ){ >+ document.forms["suspend-modal-form"].submit(); >+ } else { >+ [% IF Koha.Preference('AutoResumeSuspendedHolds') %] >+ $('#suspend-modal').modal('show'); >+ [% ELSE %] >+ document.forms["suspend-modal-form"].submit(); >+ [% END %] >+ } >+ }); >+ >+ $("#suspend-modal-until").datepicker({ minDate: 1 }); // Require that "until date" be in the future >+ $("#suspend-modal-clear-date").on( "click", function() { $("#suspend-modal-until").val(""); } ); >+ > }); > </script> > [% END %] >-- >2.20.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 29060
:
125078
|
126446
|
126480