@EXPORT = qw(
&NewSubscription &ModSubscription &DelSubscription
&GetSubscription &CountSubscriptionFromBiblionumber &GetSubscriptionsFromBiblionumber
- &SearchSubscriptions &GetItemnumberFromSerialId
+ &SearchSubscriptions
&GetFullSubscriptionsFromBiblionumber &GetFullSubscription &ModSubscriptionHistory
&HasSubscriptionStrictlyExpired &HasSubscriptionExpired &GetExpirationDate &abouttoexpire
&GetSubscriptionHistoryFromSubscriptionId
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)
--- /dev/null
+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;
--- /dev/null
+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;
use C4::Serials;
use C4::Search qw/enabled_staff_search_views/;
use Koha::DateUtils;
+use Koha::Serial::Items;
use List::MoreUtils qw/uniq/;
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]);