Bugzilla – Attachment 161902 Details for
Bug 35248
Bookings needs unit tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35248: Drop ->place_booking
Bug-35248-Drop--placebooking.patch (text/plain), 3.99 KB, created by
Nick Clemens (kidclamp)
on 2024-02-08 13:10:34 UTC
(
hide
)
Description:
Bug 35248: Drop ->place_booking
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-02-08 13:10:34 UTC
Size:
3.99 KB
patch
obsolete
>From a880f31ff7110bce28ff59f28c9723973fe6a8a6 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >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. > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Biblio.pm | 40 ---------------------------------------- > Koha/Item.pm | 43 +------------------------------------------ > 2 files changed, 1 insertion(+), 82 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 ab7f269db33..11e4fb89c44 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -535,7 +535,7 @@ Find the first booking that would conflict with the passed checkout dates for th > FIXME: This can be simplified, it was originally intended to iterate all biblio level bookings > to catch cases where this item may be the last available to satisfy a biblio level only booking. > However, we dropped the biblio level functionality prior to push as bugs were found in it's >-implimentation. >+implementation. > > =cut > >@@ -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.30.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 35248
:
161061
|
161062
|
161608
|
161611
|
161620
|
161621
|
161632
|
161636
|
161651
|
161652
|
161653
|
161654
|
161655
|
161656
|
161657
|
161658
|
161659
|
161660
|
161821
|
161822
|
161823
|
161824
|
161825
|
161826
|
161827
|
161828
|
161829
|
161830
|
161831
|
161861
|
161862
|
161863
|
161864
|
161865
|
161866
|
161867
|
161868
|
161869
|
161870
|
161871
|
161890
|
161891
|
161893
|
161894
|
161895
|
161896
|
161897
|
161898
|
161899
|
161900
|
161901
| 161902 |
161903
|
161904
|
161905
|
161906
|
161907
|
161908
|
161909
|
161910
|
161911
|
161912