Bug 8128

Summary: can't seem to run new sql reports
Product: Koha Reporter: Nicole C. Engard <nengard>
Component: ReportsAssignee: Kyle M Hall <kyle.m.hall>
Status: CLOSED FIXED QA Contact:
Severity: blocker    
Priority: P5 - low CC: jonathan.druart, koha.sekjal, kyle.m.hall, magnus, paul.poulain, wizzyrea
Version: 3.10   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 7249    
Attachments: Bug 8128 - can't seem to run new sql reports
[SIGNED-OFF] Bug 8128 - can't seem to run new sql reports
Bug 8128 - can't seem to run new sql reports
Bug 8128 - Followup - Change default value for cache_expiry
Bug 8128 - [SIGNED-OFF]Followup - Change default value for cache_expiry

Description Nicole C. Engard 2012-05-18 18:39:28 UTC
I'm on master. I paste this to create an sql report.

select count(*) as circs from statistics where type in ('issue','localuse') and datetime between <<Circed between (yyyy-mm-dd)>> and <<and (yyyy-mm-dd)>>

It appears to save. I click 'Run Report' at the top and get this:



Software error:

execute_query failed to return sth for report :  at /home/nengard/kohaclone/reports/guided_reports.pl line 602.

For help, please send mail to the webmaster (webmaster@debian), giving this error message and the time and date of the error.




When I go back the report did not save.
Comment 1 Kyle M Hall 2012-05-18 18:51:48 UTC
The reports aren't getting saved:


guided_reports.pl: DBD::mysql::db do failed: Column 'cache_expiry' cannot be null at /home/koha/kohaclone/C4/Reports/Guided.pm line 480., referer: http://kohadev:8080/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL
Comment 2 Kyle M Hall 2012-05-18 19:03:45 UTC Comment hidden (obsolete)
Comment 3 Nicole C. Engard 2012-05-18 19:35:27 UTC Comment hidden (obsolete)
Comment 4 Liz Rea 2012-05-18 19:38:43 UTC
Created attachment 9650 [details] [review]
Bug 8128 - can't seem to run new sql reports

Reports cannot be saved because saved_sql.cache_expiry cannot be null.
Fixed by setting default to 0 if a cache_expiry value is not
passed into the function.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
passes t xt

Verified original bug, patch resolves issue.
Comment 5 Magnus Enger 2012-05-18 21:53:11 UTC
I think this is related to:

Bug 7248 - Caching for services
Bug 7249 - Report webservices

The latter got pushed, but the former has gone through some iterations.
Comment 6 Jared Camins-Esakov 2012-05-18 22:07:58 UTC
(In reply to comment #5)
> I think this is related to:
> 
> Bug 7248 - Caching for services
> Bug 7249 - Report webservices
> 
> The latter got pushed, but the former has gone through some iterations.

They've both been pushed, but somewhere in the process the database update got changed. Kyle came up with a fix that doesn't require a database update, which is what Nicole and Liz signed off on.
Comment 7 Magnus Enger 2012-05-19 07:40:07 UTC
Ah, sorry, I was a bit too quick there...
Comment 8 Jonathan Druart 2012-05-22 09:07:45 UTC
Hi Kyle,
Why do you initialize the cache expiry with 0 whereas the field in DB have a default value = 300 ?
Comment 9 Kyle M Hall 2012-05-22 12:22:55 UTC Comment hidden (obsolete)
Comment 10 Kyle M Hall 2012-05-22 12:24:01 UTC
(In reply to comment #8)
> Hi Kyle,
> Why do you initialize the cache expiry with 0 whereas the field in DB have a
> default value = 300 ?

I was not aware of the default. I've submitted a followup to fix this. Thanks!
Comment 11 Jonathan Druart 2012-05-23 08:27:08 UTC
Created attachment 9736 [details] [review]
Bug 8128 - [SIGNED-OFF]Followup - Change default value for cache_expiry

Change default value for cache_expiry from 0 to 300.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 12 Ian Walls 2012-05-23 14:54:52 UTC
Adds a default value for an otherwise-possibly-NULL field.  marking as Passed QA.