@@ -, +, @@ instead you get a message box showing the hold was filled, along with a button to print the hold slip. automatically --- circ/returns.pl | 58 +++++++++++++++++----- installer/data/mysql/atomicupdate/bug_19383.sql | 3 ++ installer/data/mysql/sysprefs.sql | 2 + .../en/modules/admin/preferences/circulation.pref | 12 +++++ .../intranet-tmpl/prog/en/modules/circ/returns.tt | 56 +++++++++++++++++++++ 5 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_19383.sql --- a/circ/returns.pl +++ a/circ/returns.pl @@ -414,7 +414,38 @@ if ( $messages->{'ResFound'}) { my $reserve = $messages->{'ResFound'}; my $patron = Koha::Patrons->find( $reserve->{borrowernumber} ); my $holdmsgpreferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $reserve->{'borrowernumber'}, message_name => 'Hold_Filled' } ); - if ( $reserve->{'ResFound'} eq "Waiting" or $reserve->{'ResFound'} eq "Reserved" ) { + + if ( $reserve->{'ResFound'} eq "Reserved" && C4::Context->preference('HoldsAutoFill') ) { + my $item = Koha::Items->find( $itemnumber ); + my $biblio = $item->biblio; + + my $diffBranchSend = ($userenv_branch ne $reserve->{branchcode}) ? $reserve->{branchcode} : undef; + ModReserveAffect( $reserve->{itemnumber}, $reserve->{borrowernumber}, $diffBranchSend, $reserve->{reserve_id} ); + my ( $messages, $nextreservinfo ) = GetOtherReserves($reserve->{itemnumber}); + + my $patron = Koha::Patrons->find( $nextreservinfo ); + my $name = $patron ? $patron->surname . ", " . $patron->title . " " . $patron->firstname : ''; + + $template->param( + hold_auto_filled => 1, + print_slip => C4::Context->preference('HoldsAutoFillPrintSlip'), + patron => $patron, + borrowernumber => $patron->id, + biblionumber => $biblio->id, + ); + + if ( $messages->{'transfert'} ) { + $template->param( + itemtitle => $biblio->title, + itemnumber => $item->itemnumber, + itembiblionumber => $biblio->biblionumber, + iteminfo => $biblio->author, + name => $name, + diffbranch => 1, + ); + } + } + elsif ( $reserve->{'ResFound'} eq "Waiting" or $reserve->{'ResFound'} eq "Reserved" ) { if ( $reserve->{'ResFound'} eq "Waiting" ) { $template->param( waiting => ($userenv_branch eq $reserve->{'branchcode'} ? 1 : 0 ), @@ -428,19 +459,20 @@ if ( $messages->{'ResFound'}) { ); } - # same params for Waiting or Reserved - $template->param( - # FIXME The full patron object should be passed to the template - found => 1, - patron => $patron, - barcode => $barcode, - destbranch => $reserve->{'branchcode'}, - itemnumber => $reserve->{'itemnumber'}, - reservenotes => $reserve->{'reservenotes'}, - reserve_id => $reserve->{reserve_id}, - bormessagepref => $holdmsgpreferences->{'transports'}, - ); } # else { ; } # error? + + # same params for Waiting or Reserved + $template->param( + # FIXME The full patron object should be passed to the template + found => 1, + patron => $patron, + barcode => $barcode, + destbranch => $reserve->{'branchcode'}, + itemnumber => $reserve->{'itemnumber'}, + reservenotes => $reserve->{'reservenotes'}, + reserve_id => $reserve->{reserve_id}, + bormessagepref => $holdmsgpreferences->{'transports'}, + ); } # Error Messages --- a/installer/data/mysql/atomicupdate/bug_19383.sql +++ a/installer/data/mysql/atomicupdate/bug_19383.sql @@ -0,0 +1,3 @@ +INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES +('HoldsAutoFill','0',NULL,'If on, librarian will not be asked if hold should be filled, it will be filled automatically','YesNo'), +('HoldsAutoFillPrintSlip','0',NULL,'If on, hold slip print dialog will be displayed automatically','YesNo'); --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -191,6 +191,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo'), ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch\'s items to emphasize. If PatronBranch, emphasize the logged in user\'s library\'s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha\'s Apache configuration file.','Choice'), ('HoldFeeMode','not_always','any_time_is_placed|not_always|any_time_is_collected','Set the hold fee mode','Choice'), +('HoldsAutoFill','0',NULL,'If on, librarian will not be asked if hold should be filled, it will be filled automatically','YesNo'), +('HoldsAutoFillPrintSlip','0',NULL,'If on, hold slip print dialog will be displayed automatically','YesNo'), ('HoldsLog','0',NULL,'If ON, log create/cancel/suspend/resume actions on holds.','YesNo'), ('HoldsQueueSkipClosed', '0', NULL, 'If enabled, any libraries that are closed when the holds queue is built will be ignored for the purpose of filling holds.', 'YesNo'), ('HoldsToPullStartDate','2',NULL,'Set the default start date for the Holds to pull list to this many days ago','Integer'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -478,6 +478,18 @@ Circulation: - his/her auto renewals. Checkin Policy: - + - pref: HoldsAutoFill + choices: + yes: Do + no: "Don't" + - automatically fill holds instead of asking the librarian. + - + - pref: HoldsAutoFillPrintSlip + choices: + yes: Do + no: "Don't" + - automatically display the hold slip dialog for auto-filled holds. + - - pref: BlockReturnOfWithdrawnItems choices: yes: Block --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -51,6 +51,57 @@ [% IF Koha.Preference('CircSidebar') %]
[% END %]
+ [% IF hold_auto_filled %] +
+ [% IF ( reservenotes ) %] +

Notes: [% reservenotes %]

+ [% END %] +

Hold filled for:

+
  • + [% INCLUDE 'patron-title.inc' patron=patron %] + - [% patron.category.description %] +
  • + + [% INCLUDE display_holdpatron_address %] + + [% IF ( patron.phone ) %] +
  • [% patron.phone %]
  • + [% END %] + + [% IF ( patron.email ) %] +
  • + [% IF ( transfertodo ) %] + [% patron.email %] + [% ELSE %] + [% patron.email %] + [% END %] +
  • + [% END %] + + [% UNLESS ( transfertodo) %] + [% INCLUDE display_bormessagepref %] + [% END %] + + [% IF ( patron.debarred ) %] +
  • Patron is RESTRICTED
  • + [% END %] + + [% IF ( patron.gonenoaddress ) %] +
  • Patron's address is in doubt
  • + [% END %] + + [% IF ( transfertodo ) %] +

    Transfer to: [% Branches.GetName( destbranch ) %]

    + [% ELSE %] +

    Hold at [% Branches.GetName( destbranch ) %]

    + [% END %] + + + Print + +
    + [% END %] + [% IF privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %]
    Error: This patron has requested their circulation history be anonymized on check-in, but the AnonymousPatron system preference is empty or incorrect.
    [% ELSIF NOT Koha.Preference('AnonymousPatron') AND Koha.Preference('OPACPrivacy') %] @@ -708,6 +759,11 @@ $(".modal").on('hidden.bs.modal', function (e) { $("#barcode").focus(); }); + $(".print-slip").on('click', function(e) { + e.preventDefault(); + Dopop('hold-transfer-slip.pl?borrowernumber=[% patron.borrowernumber %]&biblionumber=[% biblionumber %]'); + }); + [% IF print_slip %] Dopop('hold-transfer-slip.pl?borrowernumber=[% patron.borrowernumber %]&biblionumber=[% biblionumber %]'); [% END %] --