diff --git a/circ/circulation.pl b/circ/circulation.pl index d61c4851f2..a6b7416f54 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -629,6 +629,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 902cf7db2e..4057841a34 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -828,6 +828,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 bae185a1f5..b9169b203f 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 54c4da8d89..4cab65fc5a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -762,7 +762,11 @@ - + [% IF waiting_holds_barcodes %] + + [% ELSE %] + + [% END %]
@@ -961,6 +965,28 @@
+[% IF waiting_holds_barcodes %] + +[% END %] + [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] @@ -1028,6 +1054,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) {