Lines 21-26
use Modern::Perl;
Link Here
|
21 |
|
21 |
|
22 |
use Koha::Exceptions::Booking; |
22 |
use Koha::Exceptions::Booking; |
23 |
use Koha::DateUtils qw( dt_from_string ); |
23 |
use Koha::DateUtils qw( dt_from_string ); |
|
|
24 |
use Koha::Items; |
25 |
use Koha::Patrons; |
26 |
use Koha::Libraries; |
27 |
|
28 |
use C4::Letters; |
24 |
|
29 |
|
25 |
use base qw(Koha::Object); |
30 |
use base qw(Koha::Object); |
26 |
|
31 |
|
Lines 239-244
sub to_api_mapping {
Link Here
|
239 |
return {}; |
244 |
return {}; |
240 |
} |
245 |
} |
241 |
|
246 |
|
|
|
247 |
=head3 delete |
248 |
|
249 |
$booking->delete(); |
250 |
|
251 |
=cut |
252 |
|
253 |
sub delete { |
254 |
my ( $self ) = @_; |
255 |
|
256 |
my $deleted = $self->SUPER::delete($self); |
257 |
my $patron = Koha::Patrons->find( $self->patron_id ); |
258 |
my $item = Koha::Items->find( $self->item_id ); |
259 |
my $library = Koha::Libraries->find( $self->pickup_library_id ); |
260 |
|
261 |
my $letter = C4::Letters::GetPreparedLetter( |
262 |
module => 'bookings', |
263 |
letter_code => 'BOOKING_CANCELLATION', |
264 |
message_transport_type => 'email', |
265 |
branchcode => $patron->branchcode, |
266 |
lang => $patron->lang, |
267 |
tables => { |
268 |
branches => $library->branchcode, |
269 |
borrowers => $patron->borrowernumber, |
270 |
items => $item->itemnumber, |
271 |
biblio => $item->biblionumber, |
272 |
biblioitems => $item->biblionumber, |
273 |
bookings => $self->unblessed, |
274 |
} |
275 |
); |
276 |
|
277 |
if ($letter) { |
278 |
C4::Letters::EnqueueLetter( |
279 |
{ |
280 |
letter => $letter, |
281 |
borrowernumber => $patron->borrowernumber, |
282 |
message_transport_type => 'email', |
283 |
} |
284 |
); |
285 |
} |
286 |
return $deleted; |
287 |
} |
288 |
|
242 |
=head2 Internal methods |
289 |
=head2 Internal methods |
243 |
|
290 |
|
244 |
=head3 _type |
291 |
=head3 _type |