Bug 19383: Add ability to print hold receipts automatically
Some libraries don't wish to require librarians to confirm each hold during checkin. Instead they would like to only be alerted that a hold was filled. Test Plan: 1) Apply this patch 2) Run updatedatabase.pl 3) Enable the new syspref HoldsAutoFill 4) Check in an item that should be trapped for a hold 5) Note that instead of the modal asking if the hold should be filled, instead you get a message box showing the hold was filled, along with a button to print the hold slip. 6) Enable the new syspref HoldsAutoFillPrintSlip 7) Repeat step 4 8) Note the same behavior, but this time the print dialog displays automatically Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
4a2bdc80ab
commit
f7fe10c6ff
5 changed files with 118 additions and 13 deletions
|
@ -415,7 +415,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 ),
|
||||
|
@ -429,19 +460,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
|
||||
|
|
3
installer/data/mysql/atomicupdate/bug_19383.sql
Normal file
3
installer/data/mysql/atomicupdate/bug_19383.sql
Normal file
|
@ -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');
|
|
@ -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'),
|
||||
|
|
|
@ -477,6 +477,18 @@ Circulation:
|
|||
no: Allow
|
||||
- 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:
|
||||
|
|
|
@ -52,6 +52,57 @@
|
|||
[% IF Koha.Preference('CircSidebar') %]<div class="yui-b">[% END %]
|
||||
<div class="yui-g">
|
||||
|
||||
[% IF hold_auto_filled %]
|
||||
<div class="dialog alert hold-auto-filled">
|
||||
[% IF ( reservenotes ) %]
|
||||
<h4>Notes: [% reservenotes %]</h4>
|
||||
[% END %]
|
||||
<h3>Hold filled for:</h3>
|
||||
<li>
|
||||
[% INCLUDE 'patron-title.inc' patron=patron %]
|
||||
<span class="patron-category"> - [% patron.category.description %]</span>
|
||||
</li>
|
||||
|
||||
[% INCLUDE display_holdpatron_address %]
|
||||
|
||||
[% IF ( patron.phone ) %]
|
||||
<li>[% patron.phone %]</li>
|
||||
[% END %]
|
||||
|
||||
[% IF ( patron.email ) %]
|
||||
<li>
|
||||
[% IF ( transfertodo ) %]
|
||||
[% patron.email %]
|
||||
[% ELSE %]
|
||||
<a id="boremail" href="mailto:[% patron.email %]">[% patron.email %]</a>
|
||||
[% END %]
|
||||
</li>
|
||||
[% END %]
|
||||
|
||||
[% UNLESS ( transfertodo) %]
|
||||
[% INCLUDE display_bormessagepref %]
|
||||
[% END %]
|
||||
|
||||
[% IF ( patron.debarred ) %]
|
||||
<li class="error">Patron is RESTRICTED</li>
|
||||
[% END %]
|
||||
|
||||
[% IF ( patron.gonenoaddress ) %]
|
||||
<li class="error">Patron's address is in doubt</li>
|
||||
[% END %]
|
||||
|
||||
[% IF ( transfertodo ) %]
|
||||
<h4><strong>Transfer to:</strong> [% Branches.GetName( destbranch ) %]</h4>
|
||||
[% ELSE %]
|
||||
<h4><strong>Hold at</strong> [% Branches.GetName( destbranch ) %]</h4>
|
||||
[% END %]
|
||||
|
||||
<a href="#" class="btn btn-default print print-slip">
|
||||
<i class="fa fa-print"></i> Print
|
||||
</a>
|
||||
</div>
|
||||
[% END %]
|
||||
|
||||
[% IF privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %]
|
||||
<div class="dialog alert"><strong>Error:</strong> This patron has requested their circulation history be anonymized on check-in, but the AnonymousPatron system preference is empty or incorrect.</div>
|
||||
[% ELSIF NOT Koha.Preference('AnonymousPatron') AND Koha.Preference('OPACPrivacy') %]
|
||||
|
@ -714,6 +765,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=[% borrowernumber | html %]&biblionumber=[% biblionumber | html %]&itemnumber=[% itemnumber | html %]');
|
||||
[% END %]
|
||||
|
|
Loading…
Reference in a new issue