Bugzilla – Attachment 55471 Details for
Bug 7677
Subscriptions: Ability to define default itemtype and automatically change itemtype of older issues on receive of next issue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 7677 [QA Followup] - Replace GetItemnumberFromSerialId with use of Koha::Serial::Item(s)
PASSED-QA-Bug-7677-QA-Followup---Replace-GetItemnu.patch (text/plain), 5.72 KB, created by
Katrin Fischer
on 2016-09-10 11:20:46 UTC
(
hide
)
Description:
[PASSED QA] Bug 7677 [QA Followup] - Replace GetItemnumberFromSerialId with use of Koha::Serial::Item(s)
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2016-09-10 11:20:46 UTC
Size:
5.72 KB
patch
obsolete
>From f4df474b43b0aac5682994dd2d362e06be8559a6 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 29 Jan 2016 01:46:02 +0000 >Subject: [PATCH] [PASSED QA] Bug 7677 [QA Followup] - Replace > GetItemnumberFromSerialId with use of Koha::Serial::Item(s) > >GetItemnumberFromSerialId has no unit tests. It would be better to start >using our object system here. > >Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> >--- > C4/Serials.pm | 27 +---------------------- > Koha/Serial/Item.pm | 52 ++++++++++++++++++++++++++++++++++++++++++++ > Koha/Serial/Items.pm | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ > serials/serials-edit.pl | 5 ++++- > 4 files changed, 115 insertions(+), 27 deletions(-) > create mode 100644 Koha/Serial/Item.pm > create mode 100644 Koha/Serial/Items.pm > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 3408c47..3c76cd8 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -66,7 +66,7 @@ BEGIN { > @EXPORT = qw( > &NewSubscription &ModSubscription &DelSubscription > &GetSubscription &CountSubscriptionFromBiblionumber &GetSubscriptionsFromBiblionumber >- &SearchSubscriptions &GetItemnumberFromSerialId >+ &SearchSubscriptions > &GetFullSubscriptionsFromBiblionumber &GetFullSubscription &ModSubscriptionHistory > &HasSubscriptionStrictlyExpired &HasSubscriptionExpired &GetExpirationDate &abouttoexpire > &GetSubscriptionHistoryFromSubscriptionId >@@ -183,33 +183,8 @@ sub GetSerialStatusFromSerialId { > return $dbh->prepare($query); > } > >-=head2 GetItemnumberFromSerialId >- >-$itemnumber = GetSerialInformation($serialid); >-this function returns the itemnumber, given a serialid in parameter >-return : itemnumber >- >-=cut >- >-sub GetItemnumberFromSerialId { >- my ($serialid) = @_; >- my $dbh = C4::Context->dbh; >- my $query = qq| >- SELECT itemnumber >- FROM serialitems >- WHERE serialid = ? >- |; >- my $sth = $dbh->prepare($query); >- $sth->execute($serialid); >- my ($result) = $sth->fetchrow; >- return ($result); >-} >- >- >- > =head2 GetSerialInformation > >- > $data = GetSerialInformation($serialid); > returns a hash_ref containing : > items : items marcrecord (can be an array) >diff --git a/Koha/Serial/Item.pm b/Koha/Serial/Item.pm >new file mode 100644 >index 0000000..3509b3d >--- /dev/null >+++ b/Koha/Serial/Item.pm >@@ -0,0 +1,52 @@ >+package Koha::Serial::Item; >+ >+# Copyright ByWater Solutions 2016 >+# >+# 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::Serial::Item - Koha Serial Item Object class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 type >+ >+=cut >+ >+sub type { >+ return 'Serialitem'; >+} >+ >+=head1 AUTHOR >+ >+Kyle M Hall <kyle@bywatersolutions.com> >+ >+=cut >+ >+1; >diff --git a/Koha/Serial/Items.pm b/Koha/Serial/Items.pm >new file mode 100644 >index 0000000..fbd6227 >--- /dev/null >+++ b/Koha/Serial/Items.pm >@@ -0,0 +1,58 @@ >+package Koha::Serial::Items; >+ >+# Copyright ByWater Solutions 2016 >+# >+# 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::Serial::Item; >+ >+use base qw(Koha::Objects); >+ >+=head1 NAME >+ >+Koha::Serial::Items - Koha Serial Items Object class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 type >+ >+=cut >+ >+sub type { >+ return 'Serialitem'; >+} >+ >+sub object_class { >+ return 'Koha::Serial::Item'; >+} >+ >+=head1 AUTHOR >+ >+Kyle M Hall <kyle@bywatersolutions.com> >+ >+=cut >+ >+1; >diff --git a/serials/serials-edit.pl b/serials/serials-edit.pl >index 125c701..12efa67 100755 >--- a/serials/serials-edit.pl >+++ b/serials/serials-edit.pl >@@ -74,6 +74,7 @@ use C4::Context; > use C4::Serials; > use C4::Search qw/enabled_staff_search_views/; > use Koha::DateUtils; >+use Koha::Serial::Items; > > use List::MoreUtils qw/uniq/; > >@@ -256,7 +257,9 @@ if ( $op and $op eq 'serialchangestatus' ) { > my $previous = GetPreviousSerialid($subscriptionids[$i]); > if ($previous) { > >- if (my $itemnumber = GetItemnumberFromSerialId($previous)) { >+ my $serialitem = Koha::Serial::Items->find( $previous ); >+ my $itemnumber = $serialitem ? $serialitem->itemnumber : undef; >+ if ($itemnumber) { > > # Getting the itemtype to set from the database > my $subscriptioninfos = GetSubscription($subscriptionids[$i]); >-- >2.7.4
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 7677
:
16339
|
16425
|
16456
|
20537
|
20538
|
24099
|
24635
|
25980
|
25981
|
25983
|
27774
|
28950
|
28951
|
28952
|
28953
|
29570
|
29571
|
29572
|
34220
|
34221
|
34222
|
34223
|
34665
|
36389
|
36446
|
36448
|
36449
|
36450
|
36451
|
36452
|
36453
|
36679
|
36680
|
36681
|
36682
|
36683
|
42923
|
42924
|
45938
|
45939
|
45940
|
45941
|
45942
|
45943
|
46216
|
47475
|
52010
|
54876
|
55000
|
55323
|
55466
|
55467
|
55468
|
55469
|
55470
| 55471 |
55472
|
55473
|
55474
|
55475