Bugzilla – Attachment 45933 Details for
Bug 15380
Move the authority types related code to Koha::Authority::Type[s] - part 1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15380: Introduce Koha::Authorit[y|ies] and Koha::Authority::Type[s]
Bug-15380-Introduce-KohaAuthorityies-and-KohaAutho.patch (text/plain), 8.39 KB, created by
Martin Renvoize (ashimema)
on 2015-12-23 05:48:18 UTC
(
hide
)
Description:
Bug 15380: Introduce Koha::Authorit[y|ies] and Koha::Authority::Type[s]
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2015-12-23 05:48:18 UTC
Size:
8.39 KB
patch
obsolete
>From d582e9117422c0eee89cc0c33db90bac30e1bba2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 15 Dec 2015 11:41:24 +0000 >Subject: [PATCH] Bug 15380: Introduce Koha::Authorit[y|ies] and > Koha::Authority::Type[s] >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Based on Koha::Objects. > >Signed-off-by: Marc Véron <veron@veron.ch> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Authorities.pm | 56 +++++++++++++++++++++++++++++++++++++++ > Koha/Authority.pm | 46 ++++++++++++++++++++++++++++++++ > Koha/Authority/Type.pm | 49 ++++++++++++++++++++++++++++++++++ > Koha/Authority/Types.pm | 50 ++++++++++++++++++++++++++++++++++ > t/db_dependent/Koha/Authorities.t | 55 ++++++++++++++++++++++++++++++++++++++ > 5 files changed, 256 insertions(+) > create mode 100644 Koha/Authorities.pm > create mode 100644 Koha/Authority.pm > create mode 100644 Koha/Authority/Type.pm > create mode 100644 Koha/Authority/Types.pm > create mode 100644 t/db_dependent/Koha/Authorities.t > >diff --git a/Koha/Authorities.pm b/Koha/Authorities.pm >new file mode 100644 >index 0000000..c2a75b9 >--- /dev/null >+++ b/Koha/Authorities.pm >@@ -0,0 +1,56 @@ >+package Koha::Authorities; >+ >+# Copyright 2015 Koha Development Team >+# >+# 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::Authority; >+ >+use base qw(Koha::Objects); >+ >+=head1 NAME >+ >+Koha::Authorities - Koha Authority object set class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 type >+ >+=cut >+ >+sub type { >+ return 'AuthHeader'; >+} >+ >+=head3 object_class >+ >+=cut >+ >+sub object_class { >+ return 'Koha::Authority'; >+} >+ >+1; >diff --git a/Koha/Authority.pm b/Koha/Authority.pm >new file mode 100644 >index 0000000..c46ab9e >--- /dev/null >+++ b/Koha/Authority.pm >@@ -0,0 +1,46 @@ >+package Koha::Authority; >+ >+# Copyright 2015 Koha Development Team >+# >+# 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::Authority - Koha Authority Object class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 type >+ >+=cut >+ >+sub type { >+ return 'AuthHeader'; >+} >+ >+1; >diff --git a/Koha/Authority/Type.pm b/Koha/Authority/Type.pm >new file mode 100644 >index 0000000..73045fc >--- /dev/null >+++ b/Koha/Authority/Type.pm >@@ -0,0 +1,49 @@ >+package Koha::Authority::Type; >+ >+# 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::Authority::Type - Koha Authority Type Object class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+sub auth_tag_structures { >+ my ( $self ) = @_; >+ return $self->_result->auth_tag_structures; >+} >+ >+=head3 type >+ >+=cut >+ >+sub type { >+ return 'AuthType'; >+} >+ >+1; >diff --git a/Koha/Authority/Types.pm b/Koha/Authority/Types.pm >new file mode 100644 >index 0000000..2df7d24 >--- /dev/null >+++ b/Koha/Authority/Types.pm >@@ -0,0 +1,50 @@ >+package Koha::Authority::Types; >+ >+# 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::Authority::Type; >+ >+use base qw(Koha::Objects); >+ >+=head1 NAME >+ >+Koha::Authority::Types - Koha Authority Type Object set class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 type >+ >+=cut >+ >+sub type { >+ return 'AuthType'; >+} >+ >+sub object_class { >+ return 'Koha::Authority::Type'; >+} >+ >+1; >diff --git a/t/db_dependent/Koha/Authorities.t b/t/db_dependent/Koha/Authorities.t >new file mode 100644 >index 0000000..7210713 >--- /dev/null >+++ b/t/db_dependent/Koha/Authorities.t >@@ -0,0 +1,55 @@ >+#!/usr/bin/perl >+ >+# Copyright 2015 Koha Development team >+# >+# 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, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 3; >+ >+use Koha::Authority; >+use Koha::Authorities; >+use Koha::Authority::Type; >+use Koha::Authority::Types; >+use Koha::Database; >+ >+use t::lib::TestBuilder; >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+my $builder = t::lib::TestBuilder->new; >+my $nb_of_authorities = Koha::Authorities->search->count; >+my $nb_of_authority_types = Koha::Authority::Types->search->count; >+my $new_authority_type_1 = Koha::Authority::Type->new( >+ { authtypecode => 'my_ac_1', >+ authtypetext => 'my authority type text 1', >+ auth_tag_to_report => '100', >+ summary => 'my summary for authority 1', >+ } >+)->store; >+my $new_authority_1 = Koha::Authority->new( { authtypecode => $new_authority_type_1->authtypecode, } )->store; >+my $new_authority_2 = Koha::Authority->new( { authtypecode => $new_authority_type_1->authtypecode, } )->store; >+ >+is( Koha::Authority::Types->search->count, $nb_of_authority_types + 1, 'The authority type should have been added' ); >+is( Koha::Authorities->search->count, $nb_of_authorities + 2, 'The 2 authorities should have been added' ); >+ >+$new_authority_1->delete; >+is( Koha::Authorities->search->count, $nb_of_authorities + 1, 'Delete should have deleted the library' ); >+ >+$schema->storage->txn_rollback; >+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 15380
:
45702
|
45703
|
45704
|
45780
|
45781
|
45782
|
45932
| 45933 |
45934