Bugzilla – Attachment 181912 Details for
Bug 39832
Add $basket->vendor() method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39832: Add $basket->vendor method
Bug-39832-Add-basket-vendor-method.patch (text/plain), 1.98 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-05-05 12:15:59 UTC
(
hide
)
Description:
Bug 39832: Add $basket->vendor method
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-05-05 12:15:59 UTC
Size:
1.98 KB
patch
obsolete
>From dd010a8a2521a8877bbe2374c0d54043e7c5a734 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 5 May 2025 08:56:37 -0300 >Subject: [PATCH] Bug 39832: Add $basket->vendor method > >This patch adds the method to be used on the API for embedding. >Tests are added. > >To test: >1. Apply this patch >2. Run: > $ ktd --shell > k$ prove t/db_dependent/Koha/Acquisition/Basket.t >=> SUCCESS: Tests pass! >3. Sign off :-D >--- > Koha/Acquisition/Basket.pm | 15 +++++++++++++++ > Koha/Schema/Result/Aqbasket.pm | 7 +++++++ > 2 files changed, 22 insertions(+) > >diff --git a/Koha/Acquisition/Basket.pm b/Koha/Acquisition/Basket.pm >index b22aa924409..a5452414b6e 100644 >--- a/Koha/Acquisition/Basket.pm >+++ b/Koha/Acquisition/Basket.pm >@@ -22,6 +22,7 @@ use Modern::Perl; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string ); > use Koha::Acquisition::BasketGroups; >+use Koha::Acquisition::Booksellers; > use Koha::Acquisition::Orders; > use Koha::Exceptions::Acquisition::Basket; > use Koha::Patrons; >@@ -51,6 +52,20 @@ sub bookseller { > return Koha::Acquisition::Bookseller->_new_from_dbic($bookseller_rs); > } > >+=head3 vendor >+ >+ my $vendor = $basket->vendor; >+ >+Returns the related I<Koha::Acquisition::Bookseller> object. >+ >+=cut >+ >+sub vendor { >+ my ($self) = @_; >+ my $vendor_rs = $self->_result->vendor; >+ return Koha::Acquisition::Bookseller->_new_from_dbic($vendor_rs); >+} >+ > =head3 creator > > my $creator = $basket->creator; >diff --git a/Koha/Schema/Result/Aqbasket.pm b/Koha/Schema/Result/Aqbasket.pm >index 6a2bb68e044..f4d160f555e 100644 >--- a/Koha/Schema/Result/Aqbasket.pm >+++ b/Koha/Schema/Result/Aqbasket.pm >@@ -379,6 +379,13 @@ __PACKAGE__->has_many( > { cascade_copy => 0, cascade_delete => 0 }, > ); > >+__PACKAGE__->belongs_to( >+ "vendor", >+ "Koha::Schema::Result::Aqbookseller", >+ { id => "booksellerid" }, >+ { is_deferrable => 1, on_delete => "RESTRICT", on_update => "CASCADE" }, >+); >+ > =head2 koha_object_class > > Missing POD for koha_object_class. >-- >2.49.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 39832
:
181911
|
181912
|
181949
|
181950
|
182060
|
182061
|
182088
|
182089