To test: Enable strict mode Disable/stop memcached Create a report (note you don't see the cache expiry option) Try to edit the report It fails Enable memcached You get the cache expiry option back You can edit
Created attachment 98714 [details] [review] Bug 24614: Add tests
Created attachment 98715 [details] [review] Bug 24614: Use Koha::Reports from save_report and update_sql In order to get the default value defined at DBMS level, we use Koha::Reports (to inherit from Koha::Object->store) from the 2 add/edit methods of C4::Reports::Guided. A second step would be to remove completely those CRUD subroutines and use directly Koha::Reports instead. Test plan: 1. Add and edit some reports 2. Disable memcached, create a report, edit it => Should not crash 3. Make sure the tests make sense and that they pass after the second patch. The error was: DBD::mysql::db do failed: Column 'cache_expiry' cannot be null [for Statement "UPDATE saved_sql SET savedsql = ?, last_modified = now(), report_name = ?, report_group = ?, report_subgroup = ?, notes = ?, cache_expiry = ?, public = ? WHERE id = ? "] at /kohadevbox/koha/C4/Reports/Guided.pm line 633.
Created attachment 101700 [details] [review] Bug 24614: Add tests Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 101701 [details] [review] Bug 24614: Use Koha::Reports from save_report and update_sql In order to get the default value defined at DBMS level, we use Koha::Reports (to inherit from Koha::Object->store) from the 2 add/edit methods of C4::Reports::Guided. A second step would be to remove completely those CRUD subroutines and use directly Koha::Reports instead. Test plan: 1. Add and edit some reports 2. Disable memcached, create a report, edit it => Should not crash 3. Make sure the tests make sense and that they pass after the second patch. The error was: DBD::mysql::db do failed: Column 'cache_expiry' cannot be null [for Statement "UPDATE saved_sql SET savedsql = ?, last_modified = now(), report_name = ?, report_group = ?, report_subgroup = ?, notes = ?, cache_expiry = ?, public = ? WHERE id = ? "] at /kohadevbox/koha/C4/Reports/Guided.pm line 633. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Does the trick, Signing off.
Created attachment 101764 [details] [review] Bug 24614: Add tests Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 101765 [details] [review] Bug 24614: Use Koha::Reports from save_report and update_sql In order to get the default value defined at DBMS level, we use Koha::Reports (to inherit from Koha::Object->store) from the 2 add/edit methods of C4::Reports::Guided. A second step would be to remove completely those CRUD subroutines and use directly Koha::Reports instead. Test plan: 1. Add and edit some reports 2. Disable memcached, create a report, edit it => Should not crash 3. Make sure the tests make sense and that they pass after the second patch. The error was: DBD::mysql::db do failed: Column 'cache_expiry' cannot be null [for Statement "UPDATE saved_sql SET savedsql = ?, last_modified = now(), report_name = ?, report_group = ?, report_subgroup = ?, notes = ?, cache_expiry = ?, public = ? WHERE id = ? "] at /kohadevbox/koha/C4/Reports/Guided.pm line 633. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Nice work everyone! Pushed to master for 20.05
Created attachment 102013 [details] [review] Bug 24614: Fix Reports/Guided.t DBD::mysql::st execute failed: Column 'public' cannot be null [for Statement "UPDATE `saved_sql` SET `last_modified` = ?, `notes` = ?, `public` = ?, `report_group` = ?, `report_name` = ?, `report_subgroup` = ?, `savedsql` = ? WHERE ( `id` = ? )" with ParamValues: 0='2020-03-27T16:03:04', 1=undef, 2=undef, 3=undef, 4='Just another report', 5=undef, 6=undef, 7=25] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836. # Looks like you planned 17 tests but ran 6. update_sql expect all the paramters to be set, otherwise it will be nulled. The best way to fix it is at test level. There is only 1 occurrence in controller/module, and it sends all the parameters. That is the correct way to do and will make things easier when we will removed them to use Koha::Reports directly
backported to 19.11.x for 19.11.05
backported to 19.05.x for 19.05.10
Normal patch will not be backported to 18.11.x series