Bugzilla – Attachment 92350 Details for
Bug 14570
Make it possible to add multiple guarantors to a record
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14570: Add about.pl entry for wrong relationship data
Bug-14570-Add-aboutpl-entry-for-wrong-relationship.patch (text/plain), 5.90 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-08-19 15:20:23 UTC
(
hide
)
Description:
Bug 14570: Add about.pl entry for wrong relationship data
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-08-19 15:20:23 UTC
Size:
5.90 KB
patch
obsolete
>From d9cc9e7986ffe1cd35ccab24280f8cfb68528ff7 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 19 Aug 2019 10:32:06 -0300 >Subject: [PATCH] Bug 14570: Add about.pl entry for wrong relationship data > >This patch adds a check and an entry to the about.pl, for bad >relationship data. The checks are: > >- 'relationship' containing '_bad_data' (generated by the atomicupdate > on undef relationships. >- 'relationship' values that are not in the borrowerRelationship >syspref. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > about.pl | 46 +++++++++++++++++++ > .../intranet-tmpl/prog/en/modules/about.tt | 19 +++++++- > 2 files changed, 64 insertions(+), 1 deletion(-) > >diff --git a/about.pl b/about.pl >index 4738c32ad0..eca275b7fc 100755 >--- a/about.pl >+++ b/about.pl >@@ -460,6 +460,52 @@ $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; > ); > } > } >+ >+# Guarantor relationships warnings >+{ >+ my $dbh = C4::Context->dbh; >+ my ($bad_relationships_count) = $dbh->selectall_arrayref(q{ >+ SELECT COUNT(*) >+ FROM ( >+ SELECT relationship FROM borrower_relationships WHERE relationship='_bad_data' >+ UNION ALL >+ SELECT relationship FROM borrowers WHERE relationship='_bad_data') a >+ }); >+ >+ $bad_relationships_count = $bad_relationships_count->[0]->[0]; >+ >+ my @existing_relationships = $dbh->selectall_array(q{ >+ SELECT DISTINCT(relationship) >+ FROM ( >+ SELECT relationship FROM borrower_relationships WHERE relationship IS NOT NULL >+ UNION ALL >+ SELECT relationship FROM borrowers WHERE relationship IS NOT NULL) a >+ }); >+ >+ my %valid_relationships = map { $_ => 1 } split( /,|\|/, C4::Context->preference('borrowerRelationship') ); >+ $valid_relationships{ _bad_data } = 1; # we handle this case in another way >+ >+ my @wrong_relationships = grep { !$valid_relationships{ $_->[0] } } @existing_relationships; >+ >+ if ( @wrong_relationships or $bad_relationships_count ) { >+ >+ $template->param( >+ warnRelationships => 1, >+ ); >+ >+ if ( @wrong_relationships ) { >+ $template->param( >+ wrong_relationships => \@wrong_relationships >+ ); >+ } >+ if ($bad_relationships_count) { >+ $template->param( >+ bad_relationships_count => $bad_relationships_count, >+ ); >+ } >+ } >+} >+ > my %versions = C4::Context::get_versions(); > > $template->param( >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >index 712dce775b..5b8c1c431e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -184,7 +184,7 @@ > </div> > > <div id="sysinfo"> >- [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs %] >+ [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships %] > [% IF (warnIsRootUser) %] > <h2>Warning regarding current user</h2> > <p>You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.</p> >@@ -229,6 +229,23 @@ > <br/> > [% END %] > >+ [% IF warnRelationships %] >+ <h2>Patron relationship problems</h2> >+ [% IF bad_relationships_count %] >+ <p>Your database contained guarantee/guarantor pairs with no defined relationship. They have been set the value '_bad_data' in the [% "borrowers.relationship" | $HtmlTags tag="strong" %] and/or [% "borrower_relationships.relationship" | $HtmlTags tag="strong" %] columns. Fix them manually by recreating those relationships, or have your system's administrator correct the values.</p> >+ [% END %] >+ >+ [% IF wrong_relationships %] >+ <p>The following values have been used for guarantee/guarantor relationships, but do not exist in the 'borrowerRelationship' system preference:</p> >+ <ul> >+ [% FOR rel IN wrong_relationships %] >+ <li>[% rel.0 | html %]</li> >+ [% END %] >+ </ul> >+ <p>If the relationship is one you want, please add it to the 'borrowerRelationship' system preference, otherwise have your system's administrator correct the values in [% "borrowers.relationship" | $HtmlTags tag="strong" %] and/or [% "borrower_relationships.relationship" | $HtmlTags tag="strong" %] in the database.</p> >+ [% END %] >+ [% END %] >+ > [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules %] > <h2>Warnings regarding the system configuration</h2> > <table> >-- >2.22.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 14570
:
52400
|
52401
|
52402
|
52403
|
52406
|
52407
|
58146
|
58147
|
58159
|
58202
|
58391
|
58399
|
58412
|
58688
|
58689
|
58739
|
58762
|
58763
|
58764
|
58834
|
58835
|
58836
|
58837
|
58838
|
58839
|
58949
|
58950
|
58951
|
58952
|
58953
|
58954
|
58972
|
58973
|
58974
|
58975
|
58976
|
58977
|
58978
|
58979
|
58980
|
62450
|
62451
|
62452
|
64124
|
64125
|
64126
|
71160
|
71161
|
71162
|
71163
|
73283
|
73284
|
73583
|
73584
|
74950
|
74951
|
74952
|
74953
|
74954
|
74976
|
74977
|
74978
|
74979
|
77029
|
77030
|
77031
|
77032
|
77033
|
77034
|
77040
|
77041
|
77042
|
77043
|
77044
|
77045
|
77046
|
77047
|
77048
|
77049
|
77067
|
77068
|
77069
|
77070
|
77071
|
77072
|
77073
|
77074
|
77075
|
77076
|
77077
|
77078
|
77290
|
77291
|
77346
|
77347
|
77348
|
80842
|
80849
|
81932
|
81933
|
85411
|
85412
|
85431
|
89889
|
89890
|
89891
|
89892
|
89909
|
89910
|
89911
|
89912
|
89921
|
89922
|
89929
|
90048
|
91231
|
91439
|
91440
|
91441
|
91442
|
91443
|
91444
|
91445
|
91694
|
91695
|
91696
|
91697
|
91698
|
91699
|
91700
|
92157
|
92158
|
92161
|
92162
|
92163
|
92180
|
92181
|
92182
|
92183
|
92232
|
92233
|
92234
|
92235
|
92277
|
92278
|
92279
|
92280
|
92281
|
92282
|
92283
|
92284
|
92285
|
92286
|
92287
|
92288
|
92289
|
92290
|
92291
|
92292
|
92298
|
92299
|
92300
|
92301
|
92302
|
92303
|
92304
|
92305
|
92306
|
92307
|
92308
|
92309
|
92310
|
92311
|
92312
|
92313
|
92314
|
92315
|
92316
|
92317
|
92318
|
92319
|
92320
|
92321
|
92322
|
92323
|
92324
|
92325
|
92346
|
92347
|
92348
|
92349
| 92350