Bugzilla – Attachment 75175 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::Basket->basket_group
Bug-20366-Add-new-method-KohaAcquisitionBasket-bas.patch (text/plain), 5.68 KB, created by
Jonathan Druart
on 2018-05-08 16:50:55 UTC
(
hide
)
Description:
Bug 20366: Add new method Koha::Acquisition::Basket->basket_group
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-05-08 16:50:55 UTC
Size:
5.68 KB
patch
obsolete
>From 42dd83ee5c9e5eced65a5ce1955e1412ee1b3383 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 8 May 2018 13:32:47 -0300 >Subject: [PATCH] Bug 20366: Add new method > Koha::Acquisition::Basket->basket_group > >Can be moved to a separate bug report. >--- > Koha/Acquisition/Basket.pm | 13 +++++++++ > Koha/Acquisition/BasketGroup.pm | 44 ++++++++++++++++++++++++++++ > Koha/Acquisition/BasketGroups.pm | 49 ++++++++++++++++++++++++++++++++ > t/db_dependent/Koha/Acquisition/Basket.t | 33 +++++++++++++++++++-- > 4 files changed, 137 insertions(+), 2 deletions(-) > create mode 100644 Koha/Acquisition/BasketGroup.pm > create mode 100644 Koha/Acquisition/BasketGroups.pm > >diff --git a/Koha/Acquisition/Basket.pm b/Koha/Acquisition/Basket.pm >index 98e4bd45b5..d5e6b8ccb1 100644 >--- a/Koha/Acquisition/Basket.pm >+++ b/Koha/Acquisition/Basket.pm >@@ -20,6 +20,7 @@ package Koha::Acquisition::Basket; > use Modern::Perl; > > use Koha::Database; >+use Koha::Acquisition::BasketGroups; > > use base qw( Koha::Object ); > >@@ -45,6 +46,18 @@ sub bookseller { > return Koha::Acquisition::Bookseller->_new_from_dbic( $bookseller_rs ); > } > >+=head3 basket_group >+ >+Returns the basket group associated to this basket >+ >+=cut >+ >+sub basket_group { >+ my ($self) = @_; >+ my $basket_group_rs = $self->_result->basketgroupid; >+ return unless $basket_group_rs; >+ return Koha::Acquisition::BasketGroup->_new_from_dbic( $basket_group_rs ); >+} > > =head3 effective_create_items > >diff --git a/Koha/Acquisition/BasketGroup.pm b/Koha/Acquisition/BasketGroup.pm >new file mode 100644 >index 0000000000..a63d8299c4 >--- /dev/null >+++ b/Koha/Acquisition/BasketGroup.pm >@@ -0,0 +1,44 @@ >+package Koha::Acquisition::BasketGroup; >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Koha::Database; >+ >+use base qw( Koha::Object ); >+ >+=head1 NAME >+ >+Koha::Acquisition::BasketGroup - Koha Basket group Object class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head2 Internal methods >+ >+=head3 _type >+ >+=cut >+ >+sub _type { >+ return 'Aqbasketgroup'; >+} >+ >+1; >diff --git a/Koha/Acquisition/BasketGroups.pm b/Koha/Acquisition/BasketGroups.pm >new file mode 100644 >index 0000000000..186c5fbd74 >--- /dev/null >+++ b/Koha/Acquisition/BasketGroups.pm >@@ -0,0 +1,49 @@ >+package Koha::Acquisition::BasketGroups; >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Koha::Database; >+use Koha::Acquisition::BasketGroup; >+ >+use base qw( Koha::Objects ); >+ >+=head1 NAME >+ >+Koha::Acquisition::BasketGroups - Koha Basket groups object set class >+ >+=head1 API >+ >+=head2 Internal methods >+ >+=head3 _type >+ >+=cut >+ >+sub _type { >+ return 'Aqbasketgroup'; >+} >+ >+=head3 object_class >+ >+=cut >+ >+sub object_class { >+ return 'Koha::Acquisition::BasketGroup'; >+} >+ >+1; >diff --git a/t/db_dependent/Koha/Acquisition/Basket.t b/t/db_dependent/Koha/Acquisition/Basket.t >index 8965c891b0..e262e2d1f2 100644 >--- a/t/db_dependent/Koha/Acquisition/Basket.t >+++ b/t/db_dependent/Koha/Acquisition/Basket.t >@@ -1,6 +1,6 @@ > #!/usr/bin/perl > >-# Copyright 2017 Koha Development team >+# Copyright 2018 Koha Development team > # > # This file is part of Koha > # >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > use t::lib::TestBuilder; > use t::lib::Mocks; > >@@ -78,3 +78,32 @@ subtest 'create_items + effective_create_items tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'basket_group' => sub { >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ my $b = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Baskets', >+ value => { basketgroupid => undef }, # not linked to a basketgroupid >+ } >+ ); >+ >+ my $basket = Koha::Acquisition::Baskets->find( $b->basketno ); >+ is( $basket->basket_group, undef, >+ '->basket_group should return undef if not linked to a basket group'); >+ >+ $b = $builder->build_object( >+ { >+ class => 'Koha::Acquisition::Baskets', >+ # Will be linked to a basket group by TestBuilder >+ } >+ ); >+ >+ $basket = Koha::Acquisition::Baskets->find( $b->basketno ); >+ is( ref( $basket->basket_group ), 'Koha::Acquisition::BasketGroup', >+ '->basket_group should return a Koha::Acquisition::BasketGroup object if linked to a basket group'); >+ >+ $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