Bugzilla – Attachment 155188 Details for
Bug 34668
Notify staff with a pop-up about waiting holds for a patron when checking out
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34668: Add popup warn librarians of waiting holds when checking out
Bug-34668-Add-popup-warn-librarians-of-waiting-hol.patch (text/plain), 9.39 KB, created by
Matt Blenkinsop
on 2023-09-04 08:48:50 UTC
(
hide
)
Description:
Bug 34668: Add popup warn librarians of waiting holds when checking out
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2023-09-04 08:48:50 UTC
Size:
9.39 KB
patch
obsolete
>From 421d660675d27acd1ea1fc5d7746dc1c9ee57151 Mon Sep 17 00:00:00 2001 >From: Shi Yao Wang <shi-yao.wang@inlibro.com> >Date: Thu, 31 Aug 2023 13:31:16 -0400 >Subject: [PATCH] Bug 34668: Add popup warn librarians of waiting holds when > checking out > >When there are holds waiting for patrons, sometimes the librarian misses >the "Holds waiting here" display. This patch adds a modal popup warning >when checking out an item for a patron with waiting holds. > >Test plan: >1) find a user (user1) >2) find a biblio (biblio1) >3) add a hold for biblio1 to user1 > (search biblio1 > Holds > find user1 > Place hold) >4) checkout biblio1 to another user if not already checked out > and checkin through circulation page (not through the user page) > > confirm hold >5) there should be a "Holds waiting here (1)" section added on user1 page > >6) checkout any items that isn't the one on hold for user1 > -> notice it just checks out as normal >7) apply patch and update database >8) go to administration > system preferences > switch "WaitingNotifyAtCheckout" to "Notify" >9) refresh page and redo step 6 > -> notice there is now a modal to warn the librarian of a waiting hold > click Ok to proceed with the checkout, click outside the modal to not do anything >10) additionnally, the popup shouldn't appear if we checkout any of > user1's waiting hold > >Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >--- > circ/circulation.pl | 11 ++++ > ...668-add_WaitingNotifyAtCheckout_syspref.pl | 16 +++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../admin/preferences/circulation.pref | 6 ++ > .../prog/en/modules/circ/circulation.tt | 64 ++++++++++++++++++- > 5 files changed, 97 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_34668-add_WaitingNotifyAtCheckout_syspref.pl > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 9b925e29ad..51103875bf 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -547,6 +547,17 @@ if ( $patron ) { > ); > $template->param( patron_messages => $patron_messages ); > >+ if ( C4::Context->preference("WaitingNotifyAtCheckout") ) { >+ >+ #Check for waiting holds >+ my $waiting_holds = $patron->holds->search( { found => 'W', branchcode => $branch } ); >+ my @waiting_holds_barcodes = (); >+ while ( my $hold = $waiting_holds->next ) { >+ push( @waiting_holds_barcodes, $hold->item->barcode ); >+ } >+ >+ $template->param( waiting_holds_barcodes => \@waiting_holds_barcodes ); >+ } > } > > my $fast_cataloging = 0; >diff --git a/installer/data/mysql/atomicupdate/bug_34668-add_WaitingNotifyAtCheckout_syspref.pl b/installer/data/mysql/atomicupdate/bug_34668-add_WaitingNotifyAtCheckout_syspref.pl >new file mode 100644 >index 0000000000..d7a8848ed3 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_34668-add_WaitingNotifyAtCheckout_syspref.pl >@@ -0,0 +1,16 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "34668", >+ description => "Add syspref WaitingNotifyAtCheckout", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Do you stuffs here >+ $dbh->do(q{INSERT IGNORE INTO `systempreferences` (variable,value,options,explanation,type) VALUES('WaitingNotifyAtCheckout','0',NULL,'If ON, notify librarians of waiting holds for the patron whose items they are checking out.','YesNo') }); >+ >+ say $out "Added new system preference 'WaitingNotifyAtCheckout'"; >+ >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index aa8a526e38..b538769c1e 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -794,6 +794,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('viewMARC','1','','Allow display of MARC view of bibiographic records','YesNo'), > ('virtualshelves','1','','If ON, enables Lists management','YesNo'), > ('WaitingNotifyAtCheckin','0',NULL,'If ON, notify librarians of waiting holds for the patron whose items they are checking in.','YesNo'), >+('WaitingNotifyAtCheckout','0',NULL,'If ON, notify librarians of waiting holds for the patron whose items they are checking out.','YesNo'), > ('WebBasedSelfCheck','0',NULL,'If ON, enables the web-based self-check system','YesNo'), > ('WhenLostChargeReplacementFee','1',NULL,'If ON, Charge the replacement price when a patron loses an item.','YesNo'), > ('WhenLostForgiveFine','0',NULL,'If ON, Forgives the fines on an item when it is lost.','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 55feb4d444..89f7ce8798 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -97,6 +97,12 @@ Circulation: > 1: Notify > 0: "Don't notify" > - librarians of waiting holds for the patron whose items they are checking in. >+ - >+ - pref: WaitingNotifyAtCheckout >+ choices: >+ 1: Notify >+ 0: "Don't notify" >+ - librarians of waiting holds for the patron whose items they are checking out. > - > - pref: FilterBeforeOverdueReport > choices: >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 3388e387a5..45932a0de6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -666,7 +666,11 @@ > <a href="#" title="Checkout settings"><i class="fa-solid fa-sliders"></i></a> > </div> > >- <button type="submit" class="btn btn-primary">Check out</button> >+ [% IF waiting_holds_barcodes %] >+ <button type="button" class="btn btn-primary">Check out</button> >+ [% ELSE %] >+ <button type="submit" class="btn btn-primary">Check out</button> >+ [% END %] > > <div class="circ-settings"> > >@@ -865,6 +869,28 @@ > </div> <!-- /.modal-dialog --> > </div> <!-- /#barcodeSubmittedModal --> > >+[% IF waiting_holds_barcodes %] >+ <div id="circ-warnwaitingholds-modal" class="modal fade audio-alert-action block"> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <div class="modal-header"> >+ <h3>This patron has waiting holds</h3> >+ </div> >+ <div class="modal-body"> >+ <ul> >+ <li> >+ This patron has waiting holds that are available for checkout >+ </li> >+ </ul> >+ </div> >+ <div class="modal-footer"> >+ <button type="button" class="btn btn-primary" data-dismiss="modal">Ok</button> >+ </div> >+ </div> >+ </div> >+ </div> >+[% END %] >+ > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] >@@ -931,6 +957,42 @@ > var newin = window.open(link, 'popup', 'width=600,height=400,resizable=1,toolbar=0,scrollbars=1,top'); > } > $(document).ready(function() { >+ [% IF waiting_holds_barcodes %] >+ $('#circ-warnwaitingholds-modal .btn-primary').on('click',function() { >+ $('#mainform').submit(); >+ }); >+ >+ var waiting_holds_barcodes = new Array(); >+ [% FOREACH b IN waiting_holds_barcodes %] >+ waiting_holds_barcodes.push("[% b | html %]"); >+ [% END %] >+ $('#barcode').on('keyup', function() { >+ $('#mainform .btn-primary').off('click'); >+ $('#barcode').off('keypress'); >+ if ( waiting_holds_barcodes.includes($('#barcode').val().trim()) ) { >+ $('#mainform .btn-primary').on('click',function() { >+ $('#mainform').submit(); >+ }); >+ >+ $('#barcode').on('keypress', function(e) { >+ if (e.which == 13) { >+ $('#mainform').submit(); >+ } >+ }); >+ } else { >+ $('#mainform .btn-primary').on('click',function() { >+ $('#circ-warnwaitingholds-modal').modal(); >+ }); >+ >+ $('#barcode').on('keypress', function(e) { >+ if (e.which == 13) { >+ $('#circ-warnwaitingholds-modal').modal(); >+ } >+ }); >+ } >+ }); >+ [% END %] >+ > $('#mainform').on('submit',function() { > if ($("#barcode") && $("#barcode").val()) { > $('#barcode').on('keypress',function(event) { >-- >2.37.1 (Apple Git-137.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 34668
:
155044
|
155045
|
155143
|
155188
|
156992
|
157243
|
157312
|
157315
|
157316
|
158359
|
158528
|
158529
|
158530
|
160673
|
160674
|
160675
|
160676