From c83fc95539ec86965dd8b17f93faf94c49bb679c Mon Sep 17 00:00:00 2001 From: Thibaud Guillot Date: Thu, 30 May 2024 11:19:12 +0200 Subject: [PATCH] Bug 36789: Pass param to prevent notification on checkout transformation --- Koha/Booking.pm | 33 ++++++++++++++++++--------------- circ/circulation.pl | 2 +- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Koha/Booking.pm b/Koha/Booking.pm index 85b8616898f..c2170f8e54f 100644 --- a/Koha/Booking.pm +++ b/Koha/Booking.pm @@ -336,28 +336,29 @@ $booking->delete(); =cut sub delete { - my ( $self ) = @_; + my ( $self, $params ) = @_; 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 ); + if ( not defined( $params->{'transform_to_checkout'} ) ) { 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 => $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( @@ -368,6 +369,8 @@ sub delete { } ); } + } + return $deleted; } diff --git a/circ/circulation.pl b/circ/circulation.pl index 6958c507278..c2ef6e56a2a 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -558,7 +558,7 @@ if (@$barcodes && $op eq 'cud-checkout') { } if($from_booking){ my $booking = Koha::Bookings->find( $query->param('booking_id') ); - $booking->delete; + $booking->delete( { 'transform_to_checkout' => 1 } ); } } -- 2.30.2