Bugzilla – Attachment 55176 Details for
Bug 17249
Koha::AuthorisedValues - Remove GetKohaAuthorisedValuesFromField
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add classes MarcSubfieldStructure[s]
Bug-17249-Remove-GetKohaAuthorisedValuesFromField-.patch (text/plain), 5.57 KB, created by
Jonathan Druart
on 2016-09-05 15:20:38 UTC
(
hide
)
Description:
Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add classes MarcSubfieldStructure[s]
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-09-05 15:20:38 UTC
Size:
5.57 KB
patch
obsolete
>From b666f7edbe55842cc9eeff313fb180a3670fdff7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 10 Aug 2016 09:07:26 +0100 >Subject: [PATCH] Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add > classes MarcSubfieldStructure[s] > >This patch adds the 2 Koha::Object based classes for the >marc_subfield_structure table >--- > Koha/MarcSubfieldStructure.pm | 44 +++++++++++++++++++++ > Koha/MarcSubfieldStructures.pm | 50 ++++++++++++++++++++++++ > t/db_dependent/Koha/MarcSubfieldStructures.t | 57 ++++++++++++++++++++++++++++ > 3 files changed, 151 insertions(+) > create mode 100644 Koha/MarcSubfieldStructure.pm > create mode 100644 Koha/MarcSubfieldStructures.pm > create mode 100644 t/db_dependent/Koha/MarcSubfieldStructures.t > >diff --git a/Koha/MarcSubfieldStructure.pm b/Koha/MarcSubfieldStructure.pm >new file mode 100644 >index 0000000..f55da04 >--- /dev/null >+++ b/Koha/MarcSubfieldStructure.pm >@@ -0,0 +1,44 @@ >+package Koha::MarcSubfieldStructure; >+ >+# 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::MarcSubfieldStructure - Koha MarcSubfieldStructure Object class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 type >+ >+=cut >+ >+sub _type { >+ return 'MarcSubfieldStructure'; >+} >+ >+1; >diff --git a/Koha/MarcSubfieldStructures.pm b/Koha/MarcSubfieldStructures.pm >new file mode 100644 >index 0000000..c2f5656 >--- /dev/null >+++ b/Koha/MarcSubfieldStructures.pm >@@ -0,0 +1,50 @@ >+package Koha::MarcSubfieldStructures; >+ >+# 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::MarcSubfieldStructure; >+ >+use base qw(Koha::Objects); >+ >+=head1 NAME >+ >+Koha::MarcSubfieldStructures - Koha MarcSubfieldStructure Object set class >+ >+=head1 API >+ >+=head2 Class Methods >+ >+=cut >+ >+=head3 type >+ >+=cut >+ >+sub _type { >+ return 'MarcSubfieldStructure'; >+} >+ >+sub object_class { >+ return 'Koha::MarcSubfieldStructure'; >+} >+ >+1; >diff --git a/t/db_dependent/Koha/MarcSubfieldStructures.t b/t/db_dependent/Koha/MarcSubfieldStructures.t >new file mode 100644 >index 0000000..b61837a >--- /dev/null >+++ b/t/db_dependent/Koha/MarcSubfieldStructures.t >@@ -0,0 +1,57 @@ >+#!/usr/bin/perl >+ >+# Copyright 2016 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::MarcSubfieldStructure; >+use Koha::MarcSubfieldStructures; >+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_fields = Koha::MarcSubfieldStructures->search->count; >+my $framework = $builder->build({ source => 'BiblioFramework' }); >+my $new_field_1 = Koha::MarcSubfieldStructure->new({ >+ frameworkcode => $framework->{frameworkcode}, >+ tagfield => 200, >+ tagsubfield => 'a', >+})->store; >+my $new_field_2 = Koha::MarcSubfieldStructure->new({ >+ frameworkcode => $framework->{frameworkcode}, >+ tagfield => 245, >+ tagsubfield => 'a', >+})->store; >+ >+is( Koha::MarcSubfieldStructures->search->count, $nb_of_fields + 2, 'The 2 fields should have been added' ); >+ >+my $retrieved_fields = Koha::MarcSubfieldStructures->search({ frameworkcode => $framework->{frameworkcode}, tagfield => 200, tagsubfield => 'a' }); >+is( $retrieved_fields->count, 1, 'Search for a field by frameworkcode, tagfield and tagsubfield should return the field' ); >+ >+$retrieved_fields->next->delete; >+is( Koha::MarcSubfieldStructures->search->count, $nb_of_fields + 1, 'Delete should have deleted the field' ); >+ >+$schema->storage->txn_rollback; >+ >+1; >-- >2.8.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 17249
:
55176
|
55177
|
55178
|
55179
|
55180
|
55181
|
55182
|
55428
|
55429
|
55430
|
55431
|
55432
|
55433
|
55434
|
56380
|
56381
|
56382
|
56383
|
56384
|
56385
|
56386