Bugzilla – Attachment 46128 Details for
Bug 12375
Store serials enumeration data in separate fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12375 [7] - Update to use Koha::Object classes
Bug-12375-7---Update-to-use-KohaObject-classes.patch (text/plain), 11.93 KB, created by
Kyle M Hall (khall)
on 2015-12-31 12:31:52 UTC
(
hide
)
Description:
Bug 12375 [7] - Update to use Koha::Object classes
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-12-31 12:31:52 UTC
Size:
11.93 KB
patch
obsolete
>From 3128151713128985e6dbf2e54ce75bbd0c329a0f Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 31 Dec 2015 12:27:15 +0000 >Subject: [PATCH] Bug 12375 [7] - Update to use Koha::Object classes > >This code was written before the introduction of Koha::Object(s) > >Considering the triviality of updating the code, we should go ahead >and switch this code to use Koha::Object(s) now. >--- > C4/Serials.pm | 37 ++++++++++++++------------- > Koha/Serial.pm | 52 +++++++++++++++++++++++++++++++++++++ > Koha/Serials.pm | 58 ++++++++++++++++++++++++++++++++++++++++++ > Koha/Subscription.pm | 52 +++++++++++++++++++++++++++++++++++++ > Koha/Subscription/Histories.pm | 58 ++++++++++++++++++++++++++++++++++++++++++ > Koha/Subscription/History.pm | 52 +++++++++++++++++++++++++++++++++++++ > Koha/Subscriptions.pm | 58 ++++++++++++++++++++++++++++++++++++++++++ > 7 files changed, 349 insertions(+), 18 deletions(-) > create mode 100644 Koha/Serial.pm > create mode 100644 Koha/Serials.pm > create mode 100644 Koha/Subscription.pm > create mode 100644 Koha/Subscription/Histories.pm > create mode 100644 Koha/Subscription/History.pm > create mode 100644 Koha/Subscriptions.pm > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index b162ae1..c09a198 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -32,7 +32,9 @@ use C4::Serials::Frequency; > 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); > >@@ -1447,8 +1449,7 @@ sub NewSubscription { > # 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'}, >@@ -1460,7 +1461,7 @@ sub NewSubscription { > planneddate => $firstacquidate, > publisheddate => $firstacquidate, > } >- ); >+ )->store(); > > logaction( "SERIAL", "ADD", $subscriptionid, "" ) if C4::Context->preference("SubscriptionLog"); > >@@ -1560,27 +1561,27 @@ sub NewIssue { > > 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(); > >diff --git a/Koha/Serial.pm b/Koha/Serial.pm >new file mode 100644 >index 0000000..d6342cc >--- /dev/null >+++ b/Koha/Serial.pm >@@ -0,0 +1,52 @@ >+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; >diff --git a/Koha/Serials.pm b/Koha/Serials.pm >new file mode 100644 >index 0000000..5d16628 >--- /dev/null >+++ b/Koha/Serials.pm >@@ -0,0 +1,58 @@ >+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; >diff --git a/Koha/Subscription.pm b/Koha/Subscription.pm >new file mode 100644 >index 0000000..1ba0c16 >--- /dev/null >+++ b/Koha/Subscription.pm >@@ -0,0 +1,52 @@ >+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; >diff --git a/Koha/Subscription/Histories.pm b/Koha/Subscription/Histories.pm >new file mode 100644 >index 0000000..c7e1c8c >--- /dev/null >+++ b/Koha/Subscription/Histories.pm >@@ -0,0 +1,58 @@ >+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; >diff --git a/Koha/Subscription/History.pm b/Koha/Subscription/History.pm >new file mode 100644 >index 0000000..b282fa3 >--- /dev/null >+++ b/Koha/Subscription/History.pm >@@ -0,0 +1,52 @@ >+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; >diff --git a/Koha/Subscriptions.pm b/Koha/Subscriptions.pm >new file mode 100644 >index 0000000..316bec7 >--- /dev/null >+++ b/Koha/Subscriptions.pm >@@ -0,0 +1,58 @@ >+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; >-- >2.1.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 12375
:
28675
|
28676
|
28677
|
28678
|
28679
|
28680
|
28681
|
28682
|
28683
|
28843
|
28844
|
28845
|
28846
|
29928
|
29929
|
30099
|
30100
|
30101
|
30102
|
30103
|
30104
|
30108
|
35155
|
35156
|
35157
|
35158
|
35159
|
35160
|
35161
|
40710
|
40711
|
40712
|
40713
|
40714
|
40715
|
40716
|
46122
|
46123
|
46124
|
46125
|
46126
|
46127
| 46128 |
46319