@@ -, +, @@ awaiting pickup" list - "Allow to mark items as lost" - "Allow to mark items as lost and notify the patron" --- a/circ/waitingreserves.pl +++ a/circ/waitingreserves.pl @@ -72,6 +72,46 @@ my @cancel_result; if ( $op eq 'cancel_reserve' and $item) { my $res = cancel( $item, $borrowernumber, $fbr, $tbr ); push @cancel_result, $res if $res; +} elsif ( $op =~ m|^mark_as_lost| ) { + my $reserve_id = $input->param('reserve_id'); + my $hold = Koha::Holds->find( $reserve_id ); + die "wrong reserve_id" unless $hold; + if ( C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') =~ m|^yes| ) { + my $itemnumber = $hold->item->itemnumber; + my $patron = $hold->borrower; + C4::Circulation::LostItem( $itemnumber, 'MARK RETURNED' ); # FIXME Do we have to mark it returned? There is no pref for that? See other occurrences of 'LostItem(' + if ( $op eq 'mark_as_lost_and_notify' and C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') eq 'yes_and_notify' ) { + my $library = $hold->branch; + my $letter = C4::Letters::GetPreparedLetter( + module => 'reserves', + letter_code => 'CANCEL_HOLD_ON_LOST', + branchcode => $library->branchcode, # FIXME Is it what we want? + lang => $patron->lang, + tables => { + branches => $library->branchcode, + borrowers => $patron->borrowernumber, + items => $itemnumber, + biblio => $hold->biblionumber, + biblioitems => $hold->biblionumber, + reserves => $hold->unblessed, + }, + ); + if ( $letter ) { + my $admin_email_address = $library->branchemail || C4::Context->preference('KohaAdminEmailAddress'); + + C4::Letters::EnqueueLetter( + { letter => $letter, + borrowernumber => $patron->borrowernumber, + message_transport_type => 'email', + from_address => $admin_email_address, + } + ); + } + } + my $res = cancel( $itemnumber, $patron->borrowernumber, $fbr, $tbr ); + push @cancel_result, $res if $res; + }# else the url parameters have been modified and the user is not allowed to continue + } if ( C4::Context->preference('IndependentBranches') ) { @@ -103,6 +143,7 @@ foreach my $num (@getreserves) { my %getreserv = ( itemnumber => $itemnumber, borrowernum => $borrowernum, + reserve_id => $num->{reserve_id}, ); my $patron = Koha::Patrons->find( $num->{borrowernumber} ); --- a/installer/data/mysql/atomicupdate/bug_19287.sql +++ a/installer/data/mysql/atomicupdate/bug_19287.sql @@ -1, +1,3 @@ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('CanMarkHoldsAwaitingPickupAsLost','no','no|yes|yes_and_notify','Add a button on the "Holds awaiting pickup" screen to mark an item as lost and notify the patron.','Choice'); + +INSERT IGNORE INTO letter(module, code, branchcode, name, is_html, title, content, message_transport_type, lang) VALUES ('reserves', 'CANCEL_HOLD_ON_LOST', '', 'Hold has been cancelled', 0, "Hold has been cancelled", "Dear [% borrower.firstname %] [% borrower.surname %],\n\nWe regret to inform you that the following item cannot longer be placed on hold, it has been marked as lost\n\nTitle: [% biblio.title %]\nAuthor: [% biblio.author %]\nCopy: [% item.copynumber %]\nLocation: [% branch.branchname %]", 'email', 'default'); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt @@ -17,7 +17,8 @@ { "sType": "anti-the", "aTargets" : [ "anti-the" ] }, { "sType": "title-string", "aTargets" : [ "title-string" ] } ], - "sPaginationType": "four_button" + "sPaginationType": "four_button", + "autoWidth": true, })); }); //]]> @@ -127,6 +128,21 @@ [% END %] + [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') != 'no' %] +
+ + + + + [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes' %] + + + [% ELSIF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes_and_notify' %] + + + [% END %] +
+ [% END %] [% END %] @@ -194,7 +210,23 @@ [% ELSE %] [% END %] - + + [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') != 'no' %] +
+ + + + + [% IF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes' %] + + + [% ELSIF Koha.Preference('CanMarkHoldsAwaitingPickupAsLost') == 'yes_and_notify' %] + + + [% END %] +
+ [% END %] + [% END %] --