Bug 31299: Fix duplicate output in search_for_data_inconsistencies.pl

In search_for_data_inconsistencies.pl when there are several inconsistencies on same framework, the second output of items contains the first one.

Looks like it is since Bug 21466

Test plan using koha-testing-docker :
1) Create 2 inconsistencies on the same item via SQL :
   update items set itemlost = 9 where itemnumber=900;
   update items set notforloan = 8 where itemnumber=900;
2) Without patch
3) Run ./misc/maintenance/search_for_data_inconsistencies.pl
=> You see duplicate output :
== Wrong values linked to authorised values ==
	* The Framework *BKS* is using the authorised value's category *NOT_LOAN*, but the following items.notforloan do not have a value defined ({itemnumber => value }):
 {900 => 8}
	* The Framework *BKS* is using the authorised value's category *LOST*, but the following items.itemlost do not have a value defined ({itemnumber => value }):
 {900 => 8} {900 => 9}

4) Apply patch
5) Run ./misc/maintenance/search_for_data_inconsistencies.pl
=> Fixed :D
== Wrong values linked to authorised values ==
	* The Framework *BKS* is using the authorised value's category *LOST*, but the following items.itemlost do not have a value defined ({itemnumber => value }):
 {900 => 9}
	* The Framework *BKS* is using the authorised value's category *NOT_LOAN*, but the following items.notforloan do not have a value defined ({itemnumber => value }):
 {900 => 8}

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 3d0015fe69)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e731d4cff4)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
Fridolin Somers 2022-08-05 08:36:50 -10:00 committed by Arthur Suzuki
parent ee132c0808
commit 5a5595483e
1 changed files with 1 additions and 1 deletions

View File

@ -187,11 +187,11 @@ use C4::Biblio qw( GetMarcFromKohaField );
if (%$invalid_av_per_framework) {
new_section('Wrong values linked to authorised values');
for my $frameworkcode ( keys %$invalid_av_per_framework ) {
my $output;
while ( my ( $av_category, $v ) = each %{$invalid_av_per_framework->{$frameworkcode}} ) {
my $items = $v->{items};
my $kohafield = $v->{kohafield};
my ( $table, $column ) = split '\.', $kohafield;
my $output;
while ( my $i = $items->next ) {
my $value = $table eq 'items'
? $i->$column