Bugzilla – Attachment 161816 Details for
Bug 34063
items.paidfor and deleteditems.paidfor still sometimes exist
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34063: Add system information warning
Bug-34063-Add-system-information-warning.patch (text/plain), 8.18 KB, created by
Pedro Amorim
on 2024-02-07 15:33:54 UTC
(
hide
)
Description:
Bug 34063: Add system information warning
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-02-07 15:33:54 UTC
Size:
8.18 KB
patch
obsolete
>From d8bdae4e116c9d376d053b4ffe49bbdcdf67c3db Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Wed, 7 Feb 2024 15:31:49 +0000 >Subject: [PATCH] Bug 34063: Add system information warning > >If the table columns differ, we should at least provide a warning in the system information tab of the about page. > >Test plan: >1) Run the following SQL: >alter table deleteditems add column paidfor longtext; >2) visit the issue stats page: >/cgi-bin/koha/reports/issues_stats.pl >3) press 'Submit' >4) Notice it causes a 500 error. >5) Apply patch >6) Visit the about page and check the 'System information' tab >7) Notice the warning is there. >8) fix the issue, run >alter table deleteditems drop column paidfor; >9) Repeat steps 2+3 confirm it no longer errors >10) Repeat step 6 and notice there's no longer a warning >--- > about.pl | 16 ++++++++++++++++ > .../intranet-tmpl/prog/en/modules/about.tt | 18 ++++++++++++++++-- > 2 files changed, 32 insertions(+), 2 deletions(-) > >diff --git a/about.pl b/about.pl >index 218c384b389..8765f255843 100755 >--- a/about.pl >+++ b/about.pl >@@ -33,6 +33,7 @@ use Search::Elasticsearch; > use Try::Tiny qw( catch try ); > use YAML::XS; > use Encode; >+use Array::Utils qw( array_diff ); > > use C4::Output qw( output_html_with_http_headers ); > use C4::Auth qw( get_template_and_user get_user_subpermissions ); >@@ -649,6 +650,21 @@ $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; > } > } > >+# BZ 34063: Warn administrators if there are columns in items that are not in deleteditems or vice-versa >+{ >+ my $dbh = C4::Context->dbh; >+ >+ my $items_columns = $dbh->selectall_arrayref( qq|SHOW COLUMNS FROM items|, { Slice => {} } ); >+ my @items_column_names = map( $_->{Field}, @{$items_columns} ); >+ >+ my $deleted_items_columns = $dbh->selectall_arrayref( qq|SHOW COLUMNS FROM deleteditems|, { Slice => {} } ); >+ my @deleted_items_column_names = map( $_->{Field}, @{$deleted_items_columns} ); >+ >+ my @array_diff = array_diff( @items_column_names, @deleted_items_column_names ); >+ >+ $template->param( itemsTablesColumnsMismatch => \@array_diff ) if @array_diff; >+} >+ > #BZ 28267: Warn administrators if there are database rows with a format other than 'DYNAMIC' > { > $template->param( warnDbRowFormat => C4::Installer->has_non_dynamic_row_format ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >index 4e916f75a3d..c8462dcd6f4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -274,7 +274,7 @@ > [% SET warnMissingCompiledFiles = 1 %] > [% END %] > [% WRAPPER tab_panel tabname= "sysinfo" %] >- [% IF weasyprint_missing || warnPrefRequireChoosingExistingAuthority || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || warnPrefPatronSelfRegistrationDefaultCategory || invalid_yesno.count || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || warnI18nMissing || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || warnConnectBroker || elasticsearch_has_missing || warnMissingCompiledFiles || warnDbRowFormat %] >+ [% IF weasyprint_missing || warnPrefRequireChoosingExistingAuthority || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || warnPrefPatronSelfRegistrationDefaultCategory || invalid_yesno.count || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || warnI18nMissing || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || warnConnectBroker || elasticsearch_has_missing || warnMissingCompiledFiles || warnDbRowFormat || itemsTablesColumnsMismatch %] > [% IF ( warnDbRowFormat ) %] > <h2>Database row format incorrect</h2> > <p>Database tables with a row format other than 'DYNAMIC': [% warnDbRowFormat | html %]</p> >@@ -408,7 +408,7 @@ > Contact your system administrator. > [% END # /IF warnConnectBroker %] > >- [% IF weasyprint_missing || warnPrefRequireChoosingExistingAuthority || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || warnPrefPatronSelfRegistrationDefaultCategory || invalid_yesno.count || warnNoActiveCurrency || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || warnXSLT || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || warnFastCataloging %] >+ [% IF weasyprint_missing || warnPrefRequireChoosingExistingAuthority || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || warnPrefPatronSelfRegistrationDefaultCategory || invalid_yesno.count || warnNoActiveCurrency || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || warnXSLT || oauth2_missing_deps || bad_yaml_prefs || warnIssuingRules || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || warnFastCataloging || itemsTablesColumnsMismatch %] > <h2>Warnings regarding the system configuration</h2> > <table> > <caption>Preferences and parameters</caption> >@@ -619,6 +619,20 @@ > </td> > </tr> > [% END %] >+ [% IF itemsTablesColumnsMismatch %] >+ <tr> >+ <th scope="row"> >+ <strong>Warning</strong> >+ </th> >+ <td> >+ Database tables for <strong>items</strong> and <strong>deleteditems</strong> should match, but do not. Mismatching columns: <strong> >+ [% FOREACH column IN itemsTablesColumnsMismatch %] >+ [% column | html %] >+ [% END %] >+ </strong> >+ </td> >+ </tr> >+ [% END # /IF itemsTablesColumnsMismatch %] > </table> > [% END # /IF warnPrefRequireChoosingExistingAuthority %] > >-- >2.30.2
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 34063
: 161816