Bugzilla – Attachment 59159 Details for
Bug 9988
Leave larger authority merges to merge_authorities cronjob (pref AuthorityMergeLimit)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9988: Add Koha objects for table need_merge_authorities
Bug-9988-Add-Koha-objects-for-table-needmergeautho.patch (text/plain), 5.79 KB, created by
Marcel de Rooy
on 2017-01-18 13:03:51 UTC
(
hide
)
Description:
Bug 9988: Add Koha objects for table need_merge_authorities
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-01-18 13:03:51 UTC
Size:
5.79 KB
patch
obsolete
>From a3f96218a63e2dc84bc252f3420773f7500f1611 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Sun, 1 Jan 2017 11:50:44 +0100 >Subject: [PATCH] Bug 9988: Add Koha objects for table need_merge_authorities >Content-Type: text/plain; charset=utf-8 > >Test plan: >Run t/db_dependent/Koha/Authorities.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Authority.pm | 22 ++++++++---- > Koha/AuthorityMergeRequest.pm | 60 ++++++++++++++++++++++++++++++++ > Koha/AuthorityMergeRequests.pm | 72 +++++++++++++++++++++++++++++++++++++++ > t/db_dependent/Koha/Authorities.t | 20 +++++++++-- > 4 files changed, 166 insertions(+), 8 deletions(-) > create mode 100644 Koha/AuthorityMergeRequest.pm > create mode 100644 Koha/AuthorityMergeRequests.pm > >diff --git a/Koha/Authority.pm b/Koha/Authority.pm >index b533fd7..e9fc8d8 100644 >--- a/Koha/Authority.pm >+++ b/Koha/Authority.pm >@@ -19,13 +19,8 @@ package Koha::Authority; > > use Modern::Perl; > >-use Carp; >- >-use Koha::Database; >-use C4::Context; >-use MARC::Record; >- > use base qw(Koha::Object); >+use Koha::AuthorityMergeRequest; > > =head1 NAME > >@@ -33,6 +28,21 @@ Koha::Authority - Koha Authority Object class > > =head1 API > >+=head2 Instance Methods >+ >+=cut >+ >+=head3 add_merge_request >+ >+=cut >+ >+sub add_merge_request { >+ my ( $self ) = @_; >+ if( $self->in_storage ) { >+ Koha::AuthorityMergeRequest->new({ authid => $self->authid })->store; >+ } >+} >+ > =head2 Class Methods > > =cut >diff --git a/Koha/AuthorityMergeRequest.pm b/Koha/AuthorityMergeRequest.pm >new file mode 100644 >index 0000000..52a86cd >--- /dev/null >+++ b/Koha/AuthorityMergeRequest.pm >@@ -0,0 +1,60 @@ >+package Koha::AuthorityMergeRequest; >+ >+# Copyright Rijksmuseum 2017 >+# >+# 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 parent qw(Koha::Object); >+ >+=head1 NAME >+ >+Koha::AuthorityMergeRequest - Koha::Object class for single need_merge_authorities record >+ >+=head1 SYNOPSIS >+ >+use Koha::AuthorityMergeRequest; >+ >+=head1 DESCRIPTION >+ >+Description >+ >+=head1 METHODS >+ >+=head2 INSTANCE METHODS >+ >+=head2 CLASS METHODS >+ >+=head3 _type >+ >+Returns name of corresponding DBIC resultset >+ >+=cut >+ >+sub _type { >+ return 'NeedMergeAuthority'; >+} >+ >+=head1 AUTHOR >+ >+Marcel de Rooy (Rijksmuseum) >+ >+Koha Development Team >+ >+=cut >+ >+1; >diff --git a/Koha/AuthorityMergeRequests.pm b/Koha/AuthorityMergeRequests.pm >new file mode 100644 >index 0000000..9d7b971 >--- /dev/null >+++ b/Koha/AuthorityMergeRequests.pm >@@ -0,0 +1,72 @@ >+package Koha::AuthorityMergeRequests; >+ >+# Copyright Rijksmuseum 2017 >+# >+# 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 Koha::AuthorityMergeRequest; >+ >+use parent qw(Koha::Objects); >+ >+=head1 NAME >+ >+Koha::AuthorityMergeRequests - Koha::Objects class for need_merge_authorities >+ >+=head1 SYNOPSIS >+ >+use Koha::AuthorityMergeRequests; >+ >+=head1 DESCRIPTION >+ >+Description >+ >+=head1 METHODS >+ >+=head2 INSTANCE METHODS >+ >+=head2 CLASS METHODS >+ >+=head3 _type >+ >+Returns name of corresponding DBIC resultset >+ >+=cut >+ >+sub _type { >+ return 'NeedMergeAuthority'; >+} >+ >+=head3 object_class >+ >+Returns name of corresponding Koha object class >+ >+=cut >+ >+sub object_class { >+ return 'Koha::AuthorityMergeRequest'; >+} >+ >+=head1 AUTHOR >+ >+Marcel de Rooy (Rijksmuseum) >+ >+Koha Development Team >+ >+=cut >+ >+1; >diff --git a/t/db_dependent/Koha/Authorities.t b/t/db_dependent/Koha/Authorities.t >index 7210713..20ceaab 100644 >--- a/t/db_dependent/Koha/Authorities.t >+++ b/t/db_dependent/Koha/Authorities.t >@@ -19,10 +19,11 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 4; > > use Koha::Authority; > use Koha::Authorities; >+use Koha::AuthorityMergeRequests; > use Koha::Authority::Type; > use Koha::Authority::Types; > use Koha::Database; >@@ -51,5 +52,20 @@ is( Koha::Authorities->search->count, $nb_of_authorities + 2, 'The 2 au > $new_authority_1->delete; > is( Koha::Authorities->search->count, $nb_of_authorities + 1, 'Delete should have deleted the library' ); > >+subtest 'Add merge request' => sub { >+ plan tests => 2; >+ >+ my $count = Koha::AuthorityMergeRequests->count; >+ $new_authority_2->add_merge_request; >+ is( Koha::AuthorityMergeRequests->count, >+ $count+1, >+ 'Merge request added' ); >+ my $new_authority_3 = Koha::Authority->new; >+ $new_authority_3->add_merge_request; >+ is( Koha::AuthorityMergeRequests->count, >+ $count+1, >+ 'No additional merge request added (not in storage)' ); >+ >+}; >+ > $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 9988
:
59158
|
59159
|
60256
|
60257
|
60258
|
60259
|
60594
|
60595
|
60596
|
60597
|
60598
|
60599
|
60600
|
60601
|
60602
|
60603
|
60604
|
60605
|
60606
|
60607
|
60668
|
60669
|
60670
|
60671
|
60672
|
60673
|
60674
|
60675
|
61306
|
61307
|
61308
|
61309
|
61779
|
61780
|
61781
|
61782
|
61783
|
61784
|
61785
|
61786
|
61787
|
61788
|
61789
|
61790
|
61791
|
61792
|
61890
|
61891
|
61892
|
61893
|
61894
|
61895
|
61897
|
61898
|
61899
|
61900
|
61901
|
61902
|
61903
|
61904
|
61912
|
61913
|
61914
|
61915
|
61916
|
61917
|
61918
|
61919
|
61920
|
61921
|
61922
|
61923
|
61924
|
61925
|
62055
|
62123
|
62124
|
62125
|
62126
|
62127
|
62128
|
62129
|
62130
|
62131
|
62132
|
62133
|
62134
|
62135
|
62136
|
62137