Bugzilla – Attachment 170386 Details for
Bug 36915
Send email notification when a booking is cancelled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36915: (follow-up) Pass object to GetPreparedLetter
Bug-36915-follow-up-Pass-object-to-GetPreparedLett.patch (text/plain), 3.02 KB, created by
Martin Renvoize (ashimema)
on 2024-08-15 14:37:12 UTC
(
hide
)
Description:
Bug 36915: (follow-up) Pass object to GetPreparedLetter
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-08-15 14:37:12 UTC
Size:
3.02 KB
patch
obsolete
>From f3fe762836135e2c8de5b184a087f74584c92426 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 26 Jun 2024 15:27:14 +0100 >Subject: [PATCH] Bug 36915: (follow-up) Pass object to GetPreparedLetter > >This patch updates the logic to pass the object to be deleted through to >GetPreparedLetter. > >This way, as we add fields and accessors to the object in the future, >they will automatically become available to the notices. > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Booking.pm | 47 ++++++++++++++++++++--------------------------- > 1 file changed, 20 insertions(+), 27 deletions(-) > >diff --git a/Koha/Booking.pm b/Koha/Booking.pm >index 0d0d1fc8aac..e5297d8d17b 100644 >--- a/Koha/Booking.pm >+++ b/Koha/Booking.pm >@@ -246,43 +246,36 @@ sub to_api_mapping { > > =head3 delete > >-$booking->delete(); >+ my $deleted = $booking->delete(); > > =cut > > sub delete { >- my ( $self ) = @_; >+ my ($self) = @_; > >- my $deleted = $self->SUPER::delete($self); >- my $patron = Koha::Patrons->find( $self->patron_id ); >- my $item = Koha::Items->find( $self->item_id ); >- my $library = Koha::Libraries->find( $self->pickup_library_id ); >+ my $patron = $self->patron; >+ my $pickup_library = $self->pickup_library; > > my $letter = C4::Letters::GetPreparedLetter( >- module => 'bookings', >- letter_code => 'BOOKING_CANCELLATION', >- message_transport_type => 'email', >- branchcode => $patron->branchcode, >- lang => $patron->lang, >- tables => { >- branches => $library->branchcode, >- borrowers => $patron->borrowernumber, >- items => $item->itemnumber, >- biblio => $item->biblionumber, >- biblioitems => $item->biblionumber, >- bookings => $self->unblessed, >+ module => 'bookings', >+ letter_code => 'BOOKING_CANCELLATION', >+ message_transport_type => 'email', >+ branchcode => $pickup_library->branchcode, >+ lang => $patron->lang, >+ objects => { booking => $self } >+ ); >+ >+ if ($letter) { >+ C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $patron->borrowernumber, >+ message_transport_type => 'email', > } > ); >+ } > >- if ($letter) { >- C4::Letters::EnqueueLetter( >- { >- letter => $letter, >- borrowernumber => $patron->borrowernumber, >- message_transport_type => 'email', >- } >- ); >- } >+ my $deleted = $self->SUPER::delete($self); > return $deleted; > } > >-- >2.46.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36915
:
167010
|
167013
|
168149
|
168150
|
168155
|
170058
|
170077
|
170078
|
170079
|
170080
|
170099
|
170155
|
170203
|
170204
|
170205
|
170206
|
170207
|
170208
|
170385
| 170386 |
170387
|
170388
|
170389
|
170390
|
170391