|
Lines 55-70
my @messages;
Link Here
|
| 55 |
if ( $op eq 'cancel_reserve' and $reserve_id ) { |
55 |
if ( $op eq 'cancel_reserve' and $reserve_id ) { |
| 56 |
my $hold = Koha::Holds->find( $reserve_id ); |
56 |
my $hold = Koha::Holds->find( $reserve_id ); |
| 57 |
if ( $hold ) { |
57 |
if ( $hold ) { |
|
|
58 |
my $hold_branchcode = $hold->branchcode; |
| 59 |
my $hold_biblionumber = $hold->biblionumber; |
| 60 |
my $hold_borrowernumber = $hold->borrowernumber; |
| 61 |
my $hold_borrower = Koha::Patrons->find( $hold_borrowernumber ); |
| 58 |
my $cancellation_reason = $input->param('cancellation-reason'); |
62 |
my $cancellation_reason = $input->param('cancellation-reason'); |
| 59 |
$hold->cancel({ cancellation_reason => $cancellation_reason }); |
63 |
$hold->cancel({ cancellation_reason => $cancellation_reason }); |
| 60 |
push @messages, { type => 'message', code => 'hold_cancelled' }; |
64 |
push @messages, { type => 'message', code => 'hold_cancelled' }; |
|
|
65 |
|
| 66 |
# send notice to user that their hold has been cancelled |
| 67 |
my $letter = C4::Letters::GetPreparedLetter ( |
| 68 |
module => 'reserves', |
| 69 |
letter_code => 'HOLD_MANUAL_CANCEL', |
| 70 |
branchcode => $hold_branchcode, |
| 71 |
tables => { |
| 72 |
'biblio', $hold_biblionumber, |
| 73 |
'borrowers', $hold_borrowernumber |
| 74 |
} |
| 75 |
); |
| 76 |
C4::Message->enqueue($letter, $hold_borrower->unblessed, 'email'); |
| 61 |
} |
77 |
} |
| 62 |
} elsif ( $op =~ m|^mark_as_lost| ) { |
78 |
} elsif ( $op =~ m|^mark_as_lost| ) { |
| 63 |
my $hold = Koha::Holds->find( $reserve_id ); |
79 |
my $hold = Koha::Holds->find( $reserve_id ); |
|
|
80 |
my $hold_branchcode = $hold->branchcode; |
| 81 |
my $hold_biblionumber = $hold->biblionumber; |
| 82 |
my $hold_borrowernumber = $hold->borrowernumber; |
| 83 |
my $patron = $hold->borrower; |
| 64 |
die "wrong reserve_id" unless $hold; # This is a bit rude, but we are not supposed to get a wrong reserve_id |
84 |
die "wrong reserve_id" unless $hold; # This is a bit rude, but we are not supposed to get a wrong reserve_id |
| 65 |
my $item = $hold->item; |
85 |
my $item = $hold->item; |
| 66 |
if ( $item and C4::Context->preference('CanMarkHoldsToPullAsLost') =~ m|^allow| ) { |
86 |
if ( $item and C4::Context->preference('CanMarkHoldsToPullAsLost') =~ m|^allow| ) { |
| 67 |
my $patron = $hold->borrower; |
|
|
| 68 |
C4::Circulation::LostItem( $item->itemnumber, "pendingreserves" ); |
87 |
C4::Circulation::LostItem( $item->itemnumber, "pendingreserves" ); |
| 69 |
if ( $op eq 'mark_as_lost_and_notify' and C4::Context->preference('CanMarkHoldsToPullAsLost') eq 'allow_and_notify' ) { |
88 |
if ( $op eq 'mark_as_lost_and_notify' and C4::Context->preference('CanMarkHoldsToPullAsLost') eq 'allow_and_notify' ) { |
| 70 |
my $library = $hold->branch; |
89 |
my $library = $hold->branch; |
|
Lines 123-128
if ( $op eq 'cancel_reserve' and $reserve_id ) {
Link Here
|
| 123 |
} |
142 |
} |
| 124 |
} |
143 |
} |
| 125 |
|
144 |
|
|
|
145 |
# send notice to user that their hold has been cancelled |
| 146 |
my $letter = C4::Letters::GetPreparedLetter ( |
| 147 |
module => 'reserves', |
| 148 |
letter_code => 'HOLD_MANUAL_CANCEL', |
| 149 |
branchcode => $hold_branchcode, |
| 150 |
tables => { |
| 151 |
'biblio', $hold_biblionumber, |
| 152 |
'borrowers', $hold_borrowernumber |
| 153 |
} |
| 154 |
); |
| 155 |
C4::Message->enqueue($letter, $patron->unblessed, 'email'); |
| 126 |
} elsif ( not $item ) { |
156 |
} elsif ( not $item ) { |
| 127 |
push @messages, { type => 'alert', code => 'hold_placed_at_biblio_level'}; |
157 |
push @messages, { type => 'alert', code => 'hold_placed_at_biblio_level'}; |
| 128 |
} # else the url parameters have been modified and the user is not allowed to continue |
158 |
} # else the url parameters have been modified and the user is not allowed to continue |