Bugzilla – Attachment 97632 Details for
Bug 24464
Add K::A::Basket->creator
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24464: Add K::A::Basket->creator
Bug-24464-Add-KABasket-creator.patch (text/plain), 2.54 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-01-20 19:03:25 UTC
(
hide
)
Description:
Bug 24464: Add K::A::Basket->creator
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-01-20 19:03:25 UTC
Size:
2.54 KB
patch
obsolete
>From 09b9f18ff70aa8c0f5ffbd973cb9a1fa9d672935 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 20 Jan 2020 16:00:05 -0300 >Subject: [PATCH] Bug 24464: Add K::A::Basket->creator > >This patch adds a ->creator method to Koha::Acquisition::Basket to >retrieve the related Koha::Patron object. > >Note: this should be re-done once 22658 is pushed, but at the time >being, there's not patch submitted, and it is not a trivial task because >of the column type missmatch. That said, the implementation of ->creator >in this class is simple enough to just rewrite it once 22658 is >submitted, and the tests will reflect the expected/unchanged behavior. > >To test: >1. Apply this patches >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Acquisition/Basket.t >=> SUCCESS: Tests pass! >3. Sign off :-D >--- > Koha/Acquisition/Basket.pm | 23 +++++++++++++++++++---- > 1 file changed, 19 insertions(+), 4 deletions(-) > >diff --git a/Koha/Acquisition/Basket.pm b/Koha/Acquisition/Basket.pm >index acdf544c38..40b39867c2 100644 >--- a/Koha/Acquisition/Basket.pm >+++ b/Koha/Acquisition/Basket.pm >@@ -21,6 +21,7 @@ use Modern::Perl; > > use Koha::Database; > use Koha::Acquisition::BasketGroups; >+use Koha::Patrons; > > use base qw( Koha::Object Koha::Object::Mixin::AdditionalFields ); > >@@ -30,7 +31,7 @@ Koha::Acquisition::Basket - Koha Basket Object class > > =head1 API > >-=head2 Class Methods >+=head2 Class methods > > =cut > >@@ -46,6 +47,20 @@ sub bookseller { > return Koha::Acquisition::Bookseller->_new_from_dbic( $bookseller_rs ); > } > >+=head3 creator >+ >+ my $creator = $basket->creator; >+ >+Returns the I<Koha::Patron> for the basket creator. >+ >+=cut >+ >+sub creator { >+ my ($self) = @_; >+ return Koha::Patrons->find( $self->authorisedby ) >+ if $self->authorisedby; >+} >+ > =head3 basket_group > > Returns the basket group associated to this basket >@@ -109,11 +124,11 @@ sub to_api_mapping { > creationdate => 'creation_date', > closedate => 'close_date', > booksellerid => 'vendor_id', >- authorisedby => 'authorised_by', >+ authorisedby => 'creator_id', > booksellerinvoicenumber => undef, > basketgroupid => 'basket_group_id', >- deliveryplace => 'delivery_place', >- billingplace => 'billing_place', >+ deliveryplace => 'delivery_library_id', >+ billingplace => 'billing_library_id', > branch => 'library_id', > is_standing => 'standing' > }; >-- >2.25.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 24464
:
97631
|
97632
|
98272
|
98275
|
98276
|
101316
|
101317
|
101409
|
101410
|
101411