Bugzilla – Attachment 77508 Details for
Bug 20366
More information about orders linked to subscriptions on "Acquisition details" tab
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20366: Add new method Koha::Acquisition::Order->subscription
Bug-20366-Add-new-method-KohaAcquisitionOrder-subs.patch (text/plain), 2.89 KB, created by
Jonathan Druart
on 2018-08-06 21:11:49 UTC
(
hide
)
Description:
Bug 20366: Add new method Koha::Acquisition::Order->subscription
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-08-06 21:11:49 UTC
Size:
2.89 KB
patch
obsolete
>From c731537e82bad0478914c42535d1f05026207f89 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 8 May 2018 13:30:44 -0300 >Subject: [PATCH] Bug 20366: Add new method > Koha::Acquisition::Order->subscription > >Can be moved to a separate bug report. > >Sponsored-by: BULAC - http://www.bulac.fr/ > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/Acquisition/Order.pm | 16 ++++++++++++++++ > t/db_dependent/Koha/Acquisition/Order.t | 31 ++++++++++++++++++++++++++++++- > 2 files changed, 46 insertions(+), 1 deletion(-) > >diff --git a/Koha/Acquisition/Order.pm b/Koha/Acquisition/Order.pm >index c35fcdf1f1..5620cf61be 100644 >--- a/Koha/Acquisition/Order.pm >+++ b/Koha/Acquisition/Order.pm >@@ -22,6 +22,7 @@ use Carp qw( croak ); > use Koha::Acquisition::Baskets; > use Koha::Acquisition::Funds; > use Koha::Acquisition::Invoices; >+use Koha::Subscriptions; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string output_pref ); > >@@ -151,6 +152,21 @@ sub invoice { > return Koha::Acquisition::Invoice->_new_from_dbic( $invoice_rs ); > } > >+=head3 subscription >+ >+ my $subscription = $order->subscription >+ >+Returns the subscription associated to the order. >+ >+=cut >+ >+sub subscription { >+ my ( $self ) = @_; >+ my $subscription_rs = $self->_result->subscriptionid; >+ return unless $subscription_rs; >+ return Koha::Subscription->_new_from_dbic( $subscription_rs ); >+} >+ > =head2 Internal methods > > =head3 _type >diff --git a/t/db_dependent/Koha/Acquisition/Order.t b/t/db_dependent/Koha/Acquisition/Order.t >index c662e798c5..75d369aae3 100644 >--- a/t/db_dependent/Koha/Acquisition/Order.t >+++ b/t/db_dependent/Koha/Acquisition/Order.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 5; > > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -143,3 +143,32 @@ subtest 'invoice' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'subscription' => sub { >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ my $o = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ value => { subscriptionid => undef }, # not linked to a subscription >+ } >+ ); >+ >+ my $order = Koha::Acquisition::Orders->find( $o->ordernumber ); >+ is( $order->subscription, undef, >+ '->subscription should return undef if not created from a subscription'); >+ >+ $o = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Orders', >+ # Will be linked to a subscription by TestBuilder >+ } >+ ); >+ >+ $order = Koha::Acquisition::Orders->find( $o->ordernumber ); >+ is( ref( $order->subscription ), 'Koha::Subscription', >+ '->subscription should return a Koha::Subscription object if created from a subscription'); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.11.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 20366
:
75174
|
75175
|
75176
|
77438
|
77439
|
77440
|
77441
|
77452
|
77453
|
77454
|
77455
|
77508
|
77509
|
77510
|
77511
|
78070
|
78071
|
78072
|
78073