Bugzilla – Attachment 77386 Details for
Bug 20509
Data consistency - authority types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20509: Search for not defined authority codes
Bug-20509-Search-for-not-defined-authority-codes.patch (text/plain), 2.05 KB, created by
Katrin Fischer
on 2018-08-01 16:24:04 UTC
(
hide
)
Description:
Bug 20509: Search for not defined authority codes
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2018-08-01 16:24:04 UTC
Size:
2.05 KB
patch
obsolete
>From 5136b4389d77d730789981f6bc6be5cadf65856b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 27 Jun 2018 15:35:57 -0300 >Subject: [PATCH] Bug 20509: Search for not defined authority codes > >This patch adds a new check in >misc/maintenance/search_for_data_inconsistencies.pl to search for not >defined authority codes. > >Test plan: >Set some auth_header.authtypecode to not defined authority codes in Koha >(UPDATE auth_header SET authtypecode="XXX" WHERE authid=42;) >Then run `misc/maintenance/search_for_data_inconsistencies.pl` > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > misc/maintenance/search_for_data_inconsistencies.pl | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > >diff --git a/misc/maintenance/search_for_data_inconsistencies.pl b/misc/maintenance/search_for_data_inconsistencies.pl >index 2c8861e..f93c6d2 100755 >--- a/misc/maintenance/search_for_data_inconsistencies.pl >+++ b/misc/maintenance/search_for_data_inconsistencies.pl >@@ -18,6 +18,7 @@ > use Modern::Perl; > > use Koha::Items; >+use Koha::Authorities; > > { > my $items = Koha::Items->search({ -or => { homebranch => undef, holdingbranch => undef }}); >@@ -34,6 +35,17 @@ use Koha::Items; > if ( $items->count ) { new_hint("Edit these items and set valid homebranch and/or holdingbranch")} > } > >+{ >+ # No join possible, FK is missing at DB level >+ my @auth_types = Koha::Authority::Types->search->get_column('authtypecode'); >+ my $authorities = Koha::Authorities->search({authtypecode => { 'not in' => \@auth_types } }); >+ if ( $authorities->count ) {new_section("Invalid auth_header.authtypecode")} >+ while ( my $authority = $authorities->next ) { >+ new_item(sprintf "Authority with authid=%s does not have a code defined (%s)", $authority->authid, $authority->authtypecode); >+ } >+ if ( $authorities->count ) {new_hint("Go to 'Home ⺠Administration ⺠Authority types' to define them")} >+} >+ > sub new_section { > my ( $name ) = @_; > say "\n== $name =="; >-- >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 20509
:
76534
|
76538
| 77386 |
77387