Bugzilla – Attachment 42117 Details for
Bug 14616
Introducing Koha::Object subclasses
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14616 - Squashable
Bug-14616---Squashable.patch (text/plain), 5.65 KB, created by
Olli-Antti Kivilahti
on 2015-08-31 12:45:17 UTC
(
hide
)
Description:
Bug 14616 - Squashable
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2015-08-31 12:45:17 UTC
Size:
5.65 KB
patch
obsolete
>From 6890174ac3388076514526abffbbbb7f510ee50e Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Mon, 31 Aug 2015 15:44:20 +0300 >Subject: [PATCH] Bug 14616 - Squashable > >--- > Koha/Serial/Serial.pm | 68 +++++++++++++++++++++++++++++++++++++++++++++++ > Koha/Serial/SerialItem.pm | 62 ++++++++++++++++++++++++++++++++++++++++++ > Koha/Serial/Serials.pm | 40 ++++++++++++++++++++++++++++ > 3 files changed, 170 insertions(+) > create mode 100644 Koha/Serial/Serial.pm > create mode 100644 Koha/Serial/SerialItem.pm > create mode 100644 Koha/Serial/Serials.pm > >diff --git a/Koha/Serial/Serial.pm b/Koha/Serial/Serial.pm >new file mode 100644 >index 0000000..02f7549 >--- /dev/null >+++ b/Koha/Serial/Serial.pm >@@ -0,0 +1,68 @@ >+package Koha::Serial::Serial; >+ >+# Copyright KohaSuomi 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); >+ >+sub type { >+ return 'Serial'; >+} >+ >+sub item { >+ my ($self, $item) = @_; >+ >+ if ($item) { >+ $item = Koha::Items->cast($item); >+ $self->{item} = $item; >+ $self->set({item => $item->_result()->id}); >+ $self->store(); >+ } >+ >+ unless ($self->{item}) { >+ my $item = $self->_result()->serialitems()->itemnumber(); #itemnumber actually returns the Item-resultset :) >+ $self->{item} = Koha::Items->cast($item); >+ } >+ >+ return $self->{item}; >+} >+ >+sub subscription { >+ my ($self, $subscription) = @_; >+ >+ if ($subscription) { >+ $subscription = Koha::Serial::Subscriptions->cast($subscription); >+ $self->{subscription} = $subscription; >+ $self->set({subscription => $subscription->_result()->id}); >+ $self->store(); >+ } >+ >+ unless ($self->{subscription}) { >+ my $subscription = $self->_result()->subscription(); >+ $self->{subscription} = Koha::Serial::Subscriptions->cast($subscription); >+ } >+ >+ return $self->{subscription}; >+} >+ >+1; >diff --git a/Koha/Serial/SerialItem.pm b/Koha/Serial/SerialItem.pm >new file mode 100644 >index 0000000..3bdb0ee >--- /dev/null >+++ b/Koha/Serial/SerialItem.pm >@@ -0,0 +1,62 @@ >+package Koha::Serial::SerialItem; >+ >+# Copyright KohaSuomi 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::Items; >+use Koha::Serial::Serials; >+ >+use Koha::Exception::BadParameter; >+ >+=head SerialItem >+ >+=head SYNOPSIS >+ >+This class deals with displaying Serials, whether or not they have Items or not. >+ >+=cut >+ >+sub new { >+ my ($class, $serial, $item) = @_; >+ >+ my $self = {}; >+ bless($self, $class); >+ >+ Koha::Exception::BadParameter->throw(error => __PACKAGE__."->new():> You must give a Serial-object as a parameter!") >+ unless $serial; >+ $self->{serial} = Koha::Serial::Serials->cast($serial) if $serial; >+ $item = $serial->_result->serialitems->itemnumber unless $item; >+ $self->{item} = Koha::Items->cast($item) if $item; >+ >+ return $self; >+} >+ >+#sub getItem { >+# my ($self) = @_; >+# return $self->{item}; >+#} >+ >+#sub getSerial { >+# my ($self) = @_; >+# return $self->{serial}; >+#} >+ >+1; >diff --git a/Koha/Serial/Serials.pm b/Koha/Serial/Serials.pm >new file mode 100644 >index 0000000..5fab778 >--- /dev/null >+++ b/Koha/Serial/Serials.pm >@@ -0,0 +1,40 @@ >+package Koha::Serial::Serials; >+ >+# Copyright KohaSuomi 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::Serial::Serial; >+ >+use base qw(Koha::Objects); >+ >+sub type { >+ return 'Serial'; >+} >+ >+sub object_class { >+ return 'Koha::Serial::Serial'; >+} >+ >+sub _get_castable_unique_columns { >+ return ['serialid']; >+} >+ >+1; >-- >1.9.1
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 14616
:
41223
|
41252
|
41532
|
42110
| 42117 |
44321
|
44406