use C4::Serials::Numberpattern;
use Koha::AdditionalField;
use Koha::DateUtils;
-use Koha::Database;
+use Koha::Serial;
+use Koha::Subscriptions;
+use Koha::Subscription::Histories;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# calculate issue number
my $serialseq = GetSeq($subscription, $pattern) || q{};
- my $serial_rs = Koha::Database->new()->schema()->resultset('Serial');
- $serial_rs->create(
+ Koha::Serial->new(
{
serialseq => $serialseq,
serialseq_x => $subscription->{'lastvalue1'},
planneddate => $firstacquidate,
publisheddate => $firstacquidate,
}
- );
+ )->store();
logaction( "SERIAL", "ADD", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog");
my $schema = Koha::Database->new()->schema();
- my $subscription = $schema->resultset('Subscription')->find( $subscriptionid );
+ my $subscription = Koha::Subscriptions->find( $subscriptionid );
- my $serial = $schema->resultset('Serial')->create(
+ my $serial = Koha::Serial->new(
{
- serialseq => $serialseq,
- serialseq_x => $subscription->lastvalue1(),
- serialseq_y => $subscription->lastvalue2(),
- serialseq_z => $subscription->lastvalue3(),
- subscriptionid => $subscriptionid,
- biblionumber => $biblionumber,
- status => $status,
- planneddate => $planneddate,
- publisheddate => $publisheddate,
+ serialseq => $serialseq,
+ serialseq_x => $subscription->lastvalue1(),
+ serialseq_y => $subscription->lastvalue2(),
+ serialseq_z => $subscription->lastvalue3(),
+ subscriptionid => $subscriptionid,
+ biblionumber => $biblionumber,
+ status => $status,
+ planneddate => $planneddate,
+ publisheddate => $publisheddate,
publisheddatetext => $publisheddatetext,
- notes => $notes,
+ notes => $notes,
}
- );
+ )->store();
my $serialid = $serial->id();
- my $subscription_history = $schema->resultset('Subscriptionhistory')->find($subscriptionid);
+ my $subscription_history = Koha::Subscription::Histories->find($subscriptionid);
my $missinglist = $subscription_history->missinglist();
my $recievedlist = $subscription_history->recievedlist();
--- /dev/null
+package Koha::Serial;
+
+# Copyright ByWater Solutions 2015
+#
+# 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 - Koha Serial Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub type {
+ return 'Serial';
+}
+
+=head1 AUTHOR
+
+Kyle M Hall <kyle@bywatersolutions.com>
+
+=cut
+
+1;
--- /dev/null
+package Koha::Serials;
+
+# Copyright ByWater Solutions 2015
+#
+# 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;
+
+use base qw(Koha::Objects);
+
+=head1 NAME
+
+Koha::Serial - Koha Serial Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub type {
+ return 'Serial';
+}
+
+sub object_class {
+ return 'Koha::Serial';
+}
+
+=head1 AUTHOR
+
+Kyle M Hall <kyle@bywatersolutions.com>
+
+=cut
+
+1;
--- /dev/null
+package Koha::Subscription;
+
+# Copyright ByWater Solutions 2015
+#
+# 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 - Koha Subscription Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub type {
+ return 'Subscription';
+}
+
+=head1 AUTHOR
+
+Kyle M Hall <kyle@bywatersolutions.com>
+
+=cut
+
+1;
--- /dev/null
+package Koha::Subscription::Histories;
+
+# Copyright ByWater Solutions 2015
+#
+# 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::History;
+
+use base qw(Koha::Objects);
+
+=head1 NAME
+
+Koha::Subscription::Histories - Koha Subscription Histories Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub type {
+ return 'Subscriptionhistory';
+}
+
+sub object_class {
+ return 'Koha::Subscription::History';
+}
+
+=head1 AUTHOR
+
+Kyle M Hall <kyle@bywatersolutions.com>
+
+=cut
+
+1;
--- /dev/null
+package Koha::Subscription::History;
+
+# Copyright ByWater Solutions 2015
+#
+# 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::History - Koha Subscription History Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub type {
+ return 'Subscriptionhistory';
+}
+
+=head1 AUTHOR
+
+Kyle M Hall <kyle@bywatersolutions.com>
+
+=cut
+
+1;
--- /dev/null
+package Koha::Subscriptions;
+
+# Copyright ByWater Solutions 2015
+#
+# 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;
+
+use base qw(Koha::Objects);
+
+=head1 NAME
+
+Koha::Subscription - Koha Subscription Object class
+
+=head1 API
+
+=head2 Class Methods
+
+=cut
+
+=head3 type
+
+=cut
+
+sub type {
+ return 'Subscription';
+}
+
+sub object_class {
+ return 'Koha::Subscription';
+}
+
+=head1 AUTHOR
+
+Kyle M Hall <kyle@bywatersolutions.com>
+
+=cut
+
+1;