From 7a9fa930ebcd2b07ce90f8ce8ed12711a5ef051c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 30 Jan 2024 07:34:56 +0000 Subject: [PATCH] Bug 35248: Drop ->place_booking These methods were introduced and used in an earlier iteration of the code, they are no longer called from anywhere (the code in Koha::Booking->store handles all cases instead) and thus I choose to remove them rather than add unit tests for them.. They are simple methods that could be re-introduced as required at a future date. --- Koha/Biblio.pm | 40 ---------------------------------------- Koha/Item.pm | 41 ----------------------------------------- 2 files changed, 81 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 7d0b2440856..72cbc07e8a5 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -321,46 +321,6 @@ sub assign_item_for_booking { return $bookable_items->single->itemnumber; } -=head3 place_booking - - my $booking = $biblio->place_booking( - { - patron => $patron, - start_date => $datetime, - end_date => $datetime - } - ); - -Add a booking for this item for the dates passed. - -Returns the Koha::Booking object or throws an exception if the item cannot be booked for the given dates. - -=cut - -sub place_booking { - my ( $self, $params ) = @_; - - # check for mandatory params - my @mandatory = ( 'start_date', 'end_date', 'patron' ); - for my $param (@mandatory) { - unless ( defined( $params->{$param} ) ) { - Koha::Exceptions::MissingParameter->throw( error => "The $param parameter is mandatory" ); - } - } - my $patron = $params->{patron}; - - # New booking object - my $booking = Koha::Booking->new( - { - start_date => $params->{start_date}, - end_date => $params->{end_date}, - patron_id => $patron->borrowernumber, - biblio_id => $self->biblionumber - } - )->store(); - return $booking; -} - =head3 can_be_transferred $biblio->can_be_transferred({ to => $to_library, from => $from_library }) diff --git a/Koha/Item.pm b/Koha/Item.pm index f470d1dae62..9f150d30ee9 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -662,47 +662,6 @@ sub check_booking { return $bookings_count ? 0 : 1; } -=head3 place_booking - - my $booking = $item->place_booking( - { - patron => $patron, - start_date => $datetime, - end_date => $datetime - } - ); - -Add a booking for this item for the dates passed. - -Returns the Koha::Booking object or throws an exception if the item cannot be booked for the given dates. - -=cut - -sub place_booking { - my ( $self, $params ) = @_; - - # check for mandatory params - my @mandatory = ( 'start_date', 'end_date', 'patron' ); - for my $param (@mandatory) { - unless ( defined( $params->{$param} ) ) { - Koha::Exceptions::MissingParameter->throw( error => "The $param parameter is mandatory" ); - } - } - my $patron = $params->{patron}; - - # New booking object - my $booking = Koha::Booking->new( - { - start_date => $params->{start_date}, - end_date => $params->{end_date}, - patron_id => $patron->borrowernumber, - biblio_id => $self->biblionumber, - item_id => $self->itemnumber, - } - )->store(); - return $booking; -} - =head3 request_transfer my $transfer = $item->request_transfer( -- 2.43.0