Bugzilla – Attachment 168149 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: Send email notification when a booking is cancelled
Bug-36915-Send-email-notification-when-a-booking-i.patch (text/plain), 5.68 KB, created by
Martin Renvoize (ashimema)
on 2024-06-26 14:39:03 UTC
(
hide
)
Description:
Bug 36915: Send email notification when a booking is cancelled
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-26 14:39:03 UTC
Size:
5.68 KB
patch
obsolete
>From 0865898724d622e42b5e9b0f8173fb46d8594d75 Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Wed, 22 May 2024 09:59:51 +0200 >Subject: [PATCH] Bug 36915: Send email notification when a booking is > cancelled >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >When a booking is cancelled, patron received an email based on specific >letter. > >Test plan: > >1) Create a letter with code "BOOKING_CANCELLATION" on "Notices and > slips" tool. >2) Add booking or go on item already booked in advance. >3) Cancel it >4) Verify in message_queue table directly or go on patron page and click > on "Notices" tab section. > >Sponsored by: Association de Gestion des Ã…uvres Sociales d'Inria (AGOS) >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Booking.pm | 47 +++++++++++++++++++ > .../prog/en/modules/tools/letter.tt | 7 +++ > tools/letter.pl | 2 + > 3 files changed, 56 insertions(+) > >diff --git a/Koha/Booking.pm b/Koha/Booking.pm >index f1004ae1f73..0d0d1fc8aac 100644 >--- a/Koha/Booking.pm >+++ b/Koha/Booking.pm >@@ -21,6 +21,11 @@ use Modern::Perl; > > use Koha::Exceptions::Booking; > use Koha::DateUtils qw( dt_from_string ); >+use Koha::Items; >+use Koha::Patrons; >+use Koha::Libraries; >+ >+use C4::Letters; > > use base qw(Koha::Object); > >@@ -239,6 +244,48 @@ sub to_api_mapping { > return {}; > } > >+=head3 delete >+ >+$booking->delete(); >+ >+=cut >+ >+sub delete { >+ 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 $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, >+ } >+ ); >+ >+ if ($letter) { >+ C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $patron->borrowernumber, >+ message_transport_type => 'email', >+ } >+ ); >+ } >+ return $deleted; >+} >+ > =head2 Internal methods > > =head3 _type >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >index 22379532e50..eb6e0a3e9d2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt >@@ -182,6 +182,7 @@ > <li><a href="/cgi-bin/koha/tools/letter.pl?op=add_form&module=suggestions">Suggestions</a></li> > <li><a href="/cgi-bin/koha/tools/letter.pl?op=add_form&module=pos">Point of sale</a></li> > <li><a href="/cgi-bin/koha/tools/letter.pl?op=add_form&module=report">Reports</a></li> >+ <li><a href="/cgi-bin/koha/tools/letter.pl?op=add_form&module=bookings">Bookings</a></li> > </ul> > </div> > </div> <!-- /#toolbar --> >@@ -243,6 +244,7 @@ > [% CASE 'suggestions' %]<span>Suggestions</span> > [% CASE 'pos' %]<span>Point of sale</span> > [% CASE 'report' %]<span>Reports</span> >+ [% CASE 'bookings' %]<span>Bookings</span> > [% CASE %]<span>[% lette.module | html %]</span> > [% END %] > </td> >@@ -441,6 +443,11 @@ > [% ELSE %] > <option value="report">Reports</option> > [% END %] >+ [% IF ( module == "bookings" ) %] >+ <option value="bookings" selected="selected">Bookings</option> >+ [% ELSE %] >+ <option value="bookings" >Bookings</option> >+ [% END %] > </select> > </li> > <li> >diff --git a/tools/letter.pl b/tools/letter.pl >index 9e9b9e386fa..c3ed7e432fd 100755 >--- a/tools/letter.pl >+++ b/tools/letter.pl >@@ -254,6 +254,8 @@ sub add_form { > add_fields( 'branches', 'biblio', 'biblioitems', 'borrowers', 'subscription', 'serial' ); > } elsif ( $module eq 'suggestions' ) { > push @{$field_selection}, add_fields( 'suggestions', 'borrowers', 'biblio' ); >+ } elsif ( $module eq 'bookings' ) { >+ push @{$field_selection}, add_fields( 'borrowers', 'bookings', 'biblio', 'biblioitems', 'items' ); > } else { > push @{$field_selection}, add_fields( 'biblio', 'biblioitems' ), > add_fields('items'), >-- >2.45.2
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