Bugzilla – Attachment 19325 Details for
Bug 10490
Overdue fines cap (amount) in circulation rules is saved incorrectly (rounded)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10490: Overdue fines cap can't store decimal values
Bug-10490-Overdue-fines-cap-cant-store-decimal-val.patch (text/plain), 3.48 KB, created by
Katrin Fischer
on 2013-07-01 20:12:53 UTC
(
hide
)
Description:
Bug 10490: Overdue fines cap can't store decimal values
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2013-07-01 20:12:53 UTC
Size:
3.48 KB
patch
obsolete
>From d841efb73e6a52fc9c991cf7e2ccf9731943fc4b Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <Katrin.Fischer.83@web.de> >Date: Mon, 1 Jul 2013 21:58:57 +0200 >Subject: [PATCH] Bug 10490: Overdue fines cap can't store decimal values > >When overduefinescap was added to the issuingrules the datatype >given was decimal. This translates in MySQL to decimal(10,0). >This doesn't allow you to store decimal values and therefore >values like 4.5 are saved as 5 in the database. > >To test: > >On a current installation: >1) Try to enter 4.5 as Overdue fines cap. Verify that the value > is not correctly saved. >2) Apply patch and run database update. >3) Try adding/changing an issuing rule setting Overdue fines cap > to 4.5 again. >4) Verify the value is saved correctly. > >Create a new Koha installation from scratch: >1) Verify that the issuingrules table has been created correctly > and that you can add/mofidy issuingrules correctly. > >Because this bug can create data loss, the old database update >has also been changed to avoid this problem for people updating >at a later point in time. Checkout an older version of Koha >pre 3.09.00.027. > >1) Run the database updates. >2) Verify again, that adding/modifying issuingrules works correctly. >--- > installer/data/mysql/kohastructure.sql | 2 +- > installer/data/mysql/updatedatabase.pl | 10 +++++++++- > 2 files changed, 10 insertions(+), 2 deletions(-) > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index d7eebdd..733b8b3 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1130,7 +1130,7 @@ CREATE TABLE `issuingrules` ( -- circulation and fine rules > `renewalperiod` int(4) default NULL, -- renewal period in the unit set in issuingrules.lengthunit > `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed > `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode) >- overduefinescap decimal default NULL, -- the maximum amount of an overdue fine >+ overduefinescap decimal(28,6) default NULL, -- the maximum amount of an overdue fine > PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`), > KEY `categorycode` (`categorycode`), > KEY `itemtype` (`itemtype`) >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 5963d24..e323b2f 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5561,7 +5561,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > > $DBversion = '3.09.00.027'; > if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >- $dbh->do("ALTER TABLE issuingrules ADD overduefinescap decimal DEFAULT NULL"); >+ $dbh->do("ALTER TABLE issuingrules ADD overduefinescap decimal(28,6) DEFAULT NULL"); > my $maxfine = C4::Context->preference('MaxFine'); > if ($maxfine && $maxfine < 900) { # an arbitrary value that tells us it's not "some huge value" > $dbh->do("UPDATE issuingrules SET overduefinescap=?",undef,$maxfine); >@@ -7010,6 +7010,14 @@ CREATE TABLE IF NOT EXISTS borrower_files ( > SetVersion($DBversion); > } > >+ >+$DBversion = "3.13.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do("ALTER TABLE issuingrules MODIFY COLUMN overduefinescap decimal(28,6) DEFAULT NULL;"); >+ print "Upgrade to $DBversion done (Bug 10490: Correct datatype for overduefinescap in issuingrules)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >-- >1.7.9.5
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 10490
:
19325
|
19510
|
19601