Bugzilla – Attachment 161836 Details for
Bug 35836
search_for_data_inconsistencies.pl - Search for loops in dependencies
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35836 - search_for_data_inconsistencies.pl - Search for loops in dependencies.
Bug-35836-searchfordatainconsistenciespl---Search-.patch (text/plain), 4.67 KB, created by
Matthias Le Gac
on 2024-02-07 17:29:15 UTC
(
hide
)
Description:
Bug 35836 - search_for_data_inconsistencies.pl - Search for loops in dependencies.
Filename:
MIME Type:
Creator:
Matthias Le Gac
Created:
2024-02-07 17:29:15 UTC
Size:
4.67 KB
patch
obsolete
>From d045b7762cf760065ac31021f1fe8fc11164f414 Mon Sep 17 00:00:00 2001 >From: Matthias Le Gac <matthias.le-gac@inlibro.com> >Date: Wed, 7 Feb 2024 12:07:33 -0500 >Subject: [PATCH] Bug 35836: search_for_data_inconsistencies.pl - Search for > loops in dependencies - test tidiness > >--- > .../search_for_data_inconsistencies.pl | 91 +++++++++++++++++++ > 1 file changed, 91 insertions(+) > >diff --git a/misc/maintenance/search_for_data_inconsistencies.pl b/misc/maintenance/search_for_data_inconsistencies.pl >index ddc6b457dd..2e8dc1c8a2 100755 >--- a/misc/maintenance/search_for_data_inconsistencies.pl >+++ b/misc/maintenance/search_for_data_inconsistencies.pl >@@ -326,6 +326,97 @@ use C4::Biblio qw( GetMarcFromKohaField ); > } > } > >+{ >+ my @loop_borrowers_relationships; >+ my @relationships = Koha::Patron::Relationships->search(); >+ my @patrons_guarantors = Koha::Patron::Relationships::guarantors(@relationships)->as_list; >+ my @patrons_guarantees = Koha::Patron::Relationships::guarantees(@relationships)->as_list; >+ >+ foreach my $patron_guarantor (@patrons_guarantors) { >+ foreach my $patron_guarantee (@patrons_guarantees) { >+ if ($patron_guarantor->borrowernumber == $patron_guarantee->borrowernumber) { >+ >+ my $relationship_id; >+ my $guarantee_id; >+ my $size_list; >+ my $tmp_garantor_id = $patron_guarantor->borrowernumber; >+ my @relationship_ids; >+ my @guarantor_to_find; >+ >+ push @guarantor_to_find, $patron_guarantor->borrowernumber; >+ >+ do { >+ my @relationship_for_go = Koha::Patron::Relationships->search( >+ { >+ -or => [ >+ 'guarantor_id' => { '=', $tmp_garantor_id }, >+ ] >+ }, >+ )->as_list; >+ $size_list = scalar @relationship_for_go; >+ >+ foreach my $relation (@relationship_for_go) { >+ $relationship_id = $relation->id; >+ unless (grep { $_ == $relationship_id } @relationship_ids) { >+ push @relationship_ids, $relationship_id; >+ } >+ $guarantee_id = $relation->guarantee_id; >+ >+ if (grep { $_ eq $guarantee_id } @guarantor_to_find) { >+ last; >+ } >+ >+ my @relationship_for_go = Koha::Patron::Relationships->search( >+ { >+ -or => [ >+ 'guarantor_id' => { '=', $guarantee_id }, >+ ] >+ }, >+ )->as_list; >+ $size_list = scalar @relationship_for_go; >+ >+ push @guarantor_to_find, $guarantee_id; >+ >+ foreach my $relation (@relationship_for_go) { >+ $relationship_id = $relation->id; >+ unless (grep { $_ == $relationship_id } @relationship_ids) { >+ push @relationship_ids, $relationship_id; >+ } >+ $guarantee_id = $relation->guarantee_id; >+ >+ if (grep { $_ eq $guarantee_id } @guarantor_to_find) { >+ last; >+ } >+ } >+ if (grep { $_ eq $guarantee_id } @guarantor_to_find) { >+ last; >+ } >+ } >+ >+ $tmp_garantor_id = $guarantee_id; >+ } while ((!grep { $_ eq $guarantee_id } @guarantor_to_find) && $size_list > 0); >+ >+ if ($patron_guarantor->borrowernumber == $guarantee_id) { >+ unless (grep { join("", sort @$_) eq join("", sort @relationship_ids) } @loop_borrowers_relationships) { >+ push @loop_borrowers_relationships, \@relationship_ids; >+ } >+ } >+ } >+ } >+ } >+ >+ if (scalar @loop_borrowers_relationships > 0) { >+ new_section("The list of relationships id with guarantors who are also guarantee."); >+ foreach my $table (@loop_borrowers_relationships) { >+ new_item( >+ sprintf "Relationships connected : %s |", >+ join(" | ", @$table) >+ ); >+ } >+ new_hint("Relationships that form guarantor loops must be deleted"); >+ } >+} >+ > sub new_section { > my ( $name ) = @_; > say "\n== $name =="; >-- >2.34.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 35836
:
161249
|
161307
|
161351
|
161836
|
161837
|
161838
|
161839
|
161840
|
161841
|
161842
|
161843
|
161844
|
162284
|
162341
|
162344
|
163368
|
164817
|
164818
|
166751
|
166752
|
166825