Bugzilla – Attachment 125599 Details for
Bug 28352
Errors in search_for_data_inconsistencies.pl relating to authorised values and frameworks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28352: Only check authorised values mapped to DB fields
Bug-28352-Only-check-authorised-values-mapped-to-D.patch (text/plain), 4.38 KB, created by
Marcel de Rooy
on 2021-10-01 09:54:45 UTC
(
hide
)
Description:
Bug 28352: Only check authorised values mapped to DB fields
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-10-01 09:54:45 UTC
Size:
4.38 KB
patch
obsolete
>From 812e51e44036e831509fd7b36322f140ffe2058f Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 26 May 2021 11:42:02 +0000 >Subject: [PATCH] Bug 28352: Only check authorised values mapped to DB fields >Content-Type: text/plain; charset=utf-8 > >The errors reported seem to be caused by authorised values mapped to MARC fields >but not mapped to a koha field. > >We should additionally make sure to check the Default framework > >Also, adding comment to indicate we only check records with items, because we do > >TO test: >1 - In a framework that is not the default map a MARC field to an authorised value, but not a koha field >2 - In SQL, force the kohafield to NULL for the mapping you just make > UPDATE marc_subfield_structure SET kohafield = NULL WHERE frameworkcode='BKS' and authorised_value='HINGS_AS' >3 - perl misc/maintenance/search_for_data_inconsistencies.pl >4 - get the following errors: >Use of uninitialized value $tmp_kohafield in pattern match (m//) at /kohadevbox/koha/misc/maintenance/search_for_data_inconsistencies.pl line 151. >Use of uninitialized value $tmp_kohafield in substitution (s///) at /kohadevbox/koha/misc/maintenance/search_for_data_inconsistencies.pl line 154. >Can't call method "get_column" on an undefined value at /kohadevbox/koha/misc/maintenance/search_for_data_inconsistencies.pl line 157. >5 - Apply patch >6 - Repeat >7 - No more errors > >Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../search_for_data_inconsistencies.pl | 25 ++++++++++++++----- > 1 file changed, 19 insertions(+), 6 deletions(-) > >diff --git a/misc/maintenance/search_for_data_inconsistencies.pl b/misc/maintenance/search_for_data_inconsistencies.pl >index a23e7abdc7..22b0889549 100755 >--- a/misc/maintenance/search_for_data_inconsistencies.pl >+++ b/misc/maintenance/search_for_data_inconsistencies.pl >@@ -132,10 +132,21 @@ use C4::Biblio qw( GetMarcFromKohaField ); > } > > { >- my $frameworks = Koha::BiblioFrameworks->search; >+ my @framework_codes = Koha::BiblioFrameworks->search()->get_column('frameworkcode'); >+ push @framework_codes,""; # The default is not stored in frameworks, we need to force it >+ > my $invalid_av_per_framework = {}; >- while ( my $framework = $frameworks->next ) { >- my $msss = Koha::MarcSubfieldStructures->search({ frameworkcode => $framework->frameworkcode, authorised_value => { '!=' => [ -and => ( undef, '' ) ]} }); >+ foreach my $frameworkcode ( @framework_codes ) { >+ # We are only checking fields that are mapped to DB fields >+ my $msss = Koha::MarcSubfieldStructures->search({ >+ frameworkcode => $frameworkcode, >+ authorised_value => { >+ '!=' => [ -and => ( undef, '' ) ] >+ }, >+ kohafield => { >+ '!=' => [ -and => ( undef, '' ) ] >+ } >+ }); > while ( my $mss = $msss->next ) { > my $kohafield = $mss->kohafield; > my $av = $mss->authorised_value; >@@ -143,7 +154,7 @@ use C4::Biblio qw( GetMarcFromKohaField ); > > my $avs = Koha::AuthorisedValues->search_by_koha_field( > { >- frameworkcode => $framework->frameworkcode, >+ frameworkcode => $frameworkcode, > kohafield => $kohafield, > } > ); >@@ -154,6 +165,8 @@ use C4::Biblio qw( GetMarcFromKohaField ); > $tmp_kohafield =~ s|items|me|; > } > # replace items.attr with me.attr >+ >+ # We are only checking biblios with items > my $items = Koha::Items->search( > { > $tmp_kohafield => >@@ -161,12 +174,12 @@ use C4::Biblio qw( GetMarcFromKohaField ); > -not_in => [ $avs->get_column('authorised_value'), '' ], > '!=' => undef, > }, >- 'biblio.frameworkcode' => $framework->frameworkcode >+ 'biblio.frameworkcode' => $frameworkcode > }, > { join => [ 'biblioitem', 'biblio' ] } > ); > if ( $items->count ) { >- $invalid_av_per_framework->{ $framework->frameworkcode }->{$av} = >+ $invalid_av_per_framework->{ $frameworkcode }->{$av} = > { items => $items, kohafield => $kohafield }; > } > } >-- >2.20.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 28352
:
121424
|
123447
| 125599