Bugzilla – Attachment 81384 Details for
Bug 21474
Add the Koha::Subscription->frequency method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21474: Add the Koha::Subscription->frequency method
Bug-21474-Add-the-KohaSubscription-frequency-metho.patch (text/plain), 5.58 KB, created by
Katrin Fischer
on 2018-10-28 01:00:38 UTC
(
hide
)
Description:
Bug 21474: Add the Koha::Subscription->frequency method
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-10-28 01:00:38 UTC
Size:
5.58 KB
patch
obsolete
>From c943962ef14e0ead7ca10c404492135cd2276830 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 2 Oct 2018 12:34:25 -0300 >Subject: [PATCH] Bug 21474: Add the Koha::Subscription->frequency method >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >And the 2 modules for the subscriptions' frequencies > >Test plan: > prove t/db_dependent/Koha/Subscription.t >must return green > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >https://bugs.koha-community.org/show_bug.cgi?id=21475 >--- > Koha/Subscription.pm | 15 ++++++++++++ > Koha/Subscription/Frequencies.pm | 50 ++++++++++++++++++++++++++++++++++++++ > Koha/Subscription/Frequency.pm | 44 +++++++++++++++++++++++++++++++++ > t/db_dependent/Koha/Subscription.t | 15 +++++++++++- > 4 files changed, 123 insertions(+), 1 deletion(-) > create mode 100644 Koha/Subscription/Frequencies.pm > create mode 100644 Koha/Subscription/Frequency.pm > >diff --git a/Koha/Subscription.pm b/Koha/Subscription.pm >index 512e018353..27d926dcb8 100644 >--- a/Koha/Subscription.pm >+++ b/Koha/Subscription.pm >@@ -24,6 +24,7 @@ use Carp; > use Koha::Database; > use Koha::Biblios; > use Koha::Acquisition::Booksellers; >+use Koha::Subscription::Frequencies; > > use base qw(Koha::Object); > >@@ -106,6 +107,20 @@ sub remove_subscriber { > $subscriber->delete if $subscriber; > } > >+=head3 frequency >+ >+my $frequency = $subscription->frequency >+ >+Return the subscription frequency >+ >+=cut >+ >+sub frequency { >+ my($self)=@_; >+ my $frequency_rs= $self->_result->periodicity; >+ return Koha::Subscription::Frequency->_new_from_dbic($frequency_rs); >+} >+ > =head3 type > > =cut >diff --git a/Koha/Subscription/Frequencies.pm b/Koha/Subscription/Frequencies.pm >new file mode 100644 >index 0000000000..27489a6030 >--- /dev/null >+++ b/Koha/Subscription/Frequencies.pm >@@ -0,0 +1,50 @@ >+package Koha::Subscription::Frequencies; >+ >+# 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 Carp; >+ >+use Koha::Database; >+ >+use Koha::Subscription::Frequency; >+ >+use base qw(Koha::Objects); >+ >+=head1 NAME >+ >+Koha::Subscription::Frequencies - Koha Subscription Frequency Object set class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 type >+ >+=cut >+ >+sub _type { >+ return 'SubscriptionFrequency'; >+} >+ >+sub object_class { >+ return 'Koha::Subscription::Frequency'; >+} >+ >+1; >diff --git a/Koha/Subscription/Frequency.pm b/Koha/Subscription/Frequency.pm >new file mode 100644 >index 0000000000..4450715487 >--- /dev/null >+++ b/Koha/Subscription/Frequency.pm >@@ -0,0 +1,44 @@ >+package Koha::Subscription::Frequency; >+ >+# 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 Carp; >+ >+use Koha::Database; >+ >+use base qw(Koha::Object); >+ >+=head1 NAME >+ >+Koha::Subscription::Frequency - Koha Subscription Frequency Object class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 type >+ >+=cut >+ >+sub _type { >+ return 'SubscriptionFrequency'; >+} >+ >+1; >diff --git a/t/db_dependent/Koha/Subscription.t b/t/db_dependent/Koha/Subscription.t >index a8c1a4c556..1218e05619 100644 >--- a/t/db_dependent/Koha/Subscription.t >+++ b/t/db_dependent/Koha/Subscription.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > > use Koha::Subscriptions; > use Koha::Biblio; >@@ -88,6 +88,19 @@ subtest 'Koha::Subscription->vendor' => sub { > is( $object->vendor->id, $subscription->{aqbooksellerid}, 'Koha::Subscription->vendor should return the correct vendor' ); > }; > >+subtest 'Koha::Subscription->frequency' => sub { >+ plan tests => 2; >+ my $frequency = $builder->build_object( { class => 'Koha::Subscription::Frequencies' } ); >+ my $subscription = $builder->build_object( >+ { >+ class => 'Koha::Subscriptions', >+ value => { periodicity => $frequency->id } >+ } >+ ); >+ is( ref($subscription->frequency), 'Koha::Subscription::Frequency', 'Koha::Subscription->frequency should return a Koha::Subscription::Frequency' ); >+ is( $subscription->frequency->id, $frequency->id, 'Koha::Subscription->frequency should return the correct frequency' ); >+}; >+ > $schema->storage->txn_rollback; > > 1; >-- >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 21474
:
79827
|
79849
|
80726
| 81384