From 7dd83fc1f2b27943d6e2b3cc90308c285cdae819 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Thu, 27 Oct 2016 15:15:21 +0300 Subject: [PATCH] Bug 17164: Lower maximum digits of enrolmentfee and reservefee in categories If the values are too high, Patron Categories page will crash with: Software error: Template process failed: undef error - round() overflow. Try smaller precision or use Math::BigFloat at /home/vagrant/kohaclone/Koha/Number/Price.pm line 44. This is likely caused by test builder setting random huge numbers when creating categories. I found out that 19 digits is the maximum that can be handled. Surely it is enough for both enrolmentfee and reservefee. This patch lowers the maximum number of significant digits in order to avoid this crash. To test: 1. Set category enrolmentfee with a high value, like 3862694923528880000000.0000 2. Go to cgi-bin/koha/admin/categories.pl 3. Observe Software error 4. Apply patch and run updatedatabase.pl 5. Reload the page 6. Observe that software error is gone --- .../Bug_17164-Lower_enrolmentfee_and_reservefee_max_digits.sql | 3 +++ installer/data/mysql/kohastructure.sql | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/Bug_17164-Lower_enrolmentfee_and_reservefee_max_digits.sql diff --git a/installer/data/mysql/atomicupdate/Bug_17164-Lower_enrolmentfee_and_reservefee_max_digits.sql b/installer/data/mysql/atomicupdate/Bug_17164-Lower_enrolmentfee_and_reservefee_max_digits.sql new file mode 100644 index 0000000..33846a4 --- /dev/null +++ b/installer/data/mysql/atomicupdate/Bug_17164-Lower_enrolmentfee_and_reservefee_max_digits.sql @@ -0,0 +1,3 @@ +ALTER TABLE `categories` +CHANGE COLUMN `enrolmentfee` `enrolmentfee` DECIMAL(19,6) NULL DEFAULT NULL , +CHANGE COLUMN `reservefee` `reservefee` DECIMAL(19,6) NULL DEFAULT NULL ; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 6b6fe57..71b6081 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -322,10 +322,10 @@ CREATE TABLE `categories` ( -- this table shows information related to Koha patr `dateofbirthrequired` tinyint(1) default NULL, -- the minimum age required for the patron category `finetype` varchar(30) default NULL, -- unused in Koha `bulk` tinyint(1) default NULL, - `enrolmentfee` decimal(28,6) default NULL, -- enrollment fee for the patron + `enrolmentfee` decimal(19,6) default NULL, -- enrollment fee for the patron `overduenoticerequired` tinyint(1) default NULL, -- are overdue notices sent to this patron category (1 for yes, 0 for no) `issuelimit` smallint(6) default NULL, -- unused in Koha - `reservefee` decimal(28,6) default NULL, -- cost to place holds + `reservefee` decimal(19,6) default NULL, -- cost to place holds `hidelostitems` tinyint(1) NOT NULL default '0', -- are lost items shown to this category (1 for yes, 0 for no) `category_type` varchar(1) NOT NULL default 'A', -- type of Koha patron (Adult, Child, Professional, Organizational, Statistical, Staff) `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL default '-1', -- wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions -- 1.9.1