| Summary: | Error 500 in issues_stats.pl | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Eugene Espinoza <eugenegf> |
| Component: | Reports | Assignee: | Bugs List <koha-bugs> |
| Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
| Severity: | enhancement | ||
| Priority: | P5 - low | CC: | m.de.rooy |
| Version: | 22.11 | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
|
Description
Eugene Espinoza
2023-05-23 03:01:21 UTC
Additionally, after updating to 22.11.06, we are getting the error message below in plack-error.log: CGI::Compile::ROOT::usr_share_koha_intranet_cgi_2dbin_reports_issues_stats_2epl::calculate(): DBI Exception: DBD::mysql::st execute failed: The used SELECT statements have a different number of columns at /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 92 Hi! I've reread my first comment, it should be "/cgi-bin/koha/reports/issues_stats.pl" and "/cgi-bin/koha/reports/borrowers_stats.pl" (In reply to Eugene Espinoza from comment #1) > Additionally, after updating to 22.11.06, we are getting the error message > below in plack-error.log: > CGI::Compile::ROOT:: > usr_share_koha_intranet_cgi_2dbin_reports_issues_stats_2epl::calculate(): > DBI Exception: DBD::mysql::st execute failed: The used SELECT statements > have a different number of columns at > /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 92 Eugene, This SQL error seems to be caused by a UNION statement. The only one in this script is in the calculate routine (called on L92). If you go there, you will see: $strcalc .= "LEFT JOIN (SELECT * FROM items UNION SELECT * FROM deleteditems) items ON statistics.itemnumber=items.itemnumber " You could try SELECT * FROM items UNION SELECT * FROM deleteditems in MySQL client to see if it works. It does on current master. If it doesnt, please compare the columns of items and deleteditems in your database, and tell us the differences. Did you make modifications to the tables? Marcel, Thanks for commenting! I am missing the paidfor column in my deleteditems table. As far as I can remember, we did not delete any columns in tables for this Koha instance. This Koha instance was upgraded from 20.11 then 22.11 then 23.05. I wander why the paidfor field was not included in the upgrade? Anyway closing this bug, as it is an isolated case. Thank you very much! Here is a pointer:
$DBversion = '20.06.00.041';
if ( CheckVersion($DBversion) ) {
if ( column_exists( 'items', 'paidfor' ) ) {
my ($count) = $dbh->selectrow_array(
q|
SELECT COUNT(*)
FROM items
WHERE paidfor IS NOT NULL AND paidfor <> ""
|
);
if ($count) {
warn "Warning - Cannot remove column items.paidfor. At least one value exists";
}
else {
$dbh->do(q|ALTER TABLE items DROP COLUMN paidfor|);
$dbh->do(q|UPDATE marc_subfield_structure SET kohafield = '' WHERE kohafield = 'items.paidfor'|);
}
}
if ( column_exists( 'deleteditems', 'paidfor' ) ) {
my ($count) = $dbh->selectrow_array(
q|
SELECT COUNT(*)
FROM deleteditems
WHERE paidfor IS NOT NULL AND paidfor <> ""
|
);
if ($count) {
warn "Warning - Cannot remove column deleteditems.paidfor. At least one value exists";
}
else {
$dbh->do(q|ALTER TABLE deleteditems DROP COLUMN paidfor|);
}
}
NewVersion( $DBversion, 26268, "Remove items.paidfor field" );
}
The field paidfor should not be present anymore.
|