Bugzilla – Attachment 10369 Details for
Bug 8253
fix fine doubling, when upgrading from 3.6 to 3.8 (or later)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8253 - Fine doubling
Bug-8253---Fine-doubling.patch (text/plain), 2.39 KB, created by
Kyle M Hall
on 2012-06-19 19:50:59 UTC
(
hide
)
Description:
Bug 8253 - Fine doubling
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2012-06-19 19:50:59 UTC
Size:
2.39 KB
patch
obsolete
>From 582cb4233f0110d212212e4dd486bed8a3150c45 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 19 Jun 2012 13:06:24 -0400 >Subject: [PATCH] Bug 8253 - Fine doubling > >This issue only occurs when upgrading from pre-3.8 to post 3.8 Koha. > >The issue is caused by the change from dates to datetimes that was >neccesary to implement hourly loans. All pre-3.8 fines have the date >in the description. This date is how the fines script know which fine >to update. If the fine script does not locate an existing row to update, >it creates a new row. > >The switch from dates to datetimes means the fines script now looks >for a format such as 'YYYY-MM-DD 00:00' ( for iso ), but all the previous >fines are still in the format 'YYYY-MM-DD' and so it fails to find >the matching row, and creates a new row instead. > >This commit consists of a database update that alters the dates >in the accountlines description field to be datetimes instead. This >eliminates future fine doubling. It is also safe to run on a system >that has been previously upgraded, it will ignore any rows where >the date is already of the format 'YYYY-MM-DD 00:00' ( or whichever >date format you have chosen ). >--- > installer/data/mysql/updatedatabase.pl | 22 ++++++++++++++++++++++ > 1 files changed, 22 insertions(+), 0 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 9b02cb9..709e388 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5369,6 +5369,28 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion ="3.09.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ my $pref = C4::Context->preference('dateformat'); >+ my $date_format; >+ >+ if ( $pref =~ /^iso/ ) { >+ $date_format = '____-__-__'; >+ } >+ elsif ( $pref =~ /^metric/ ) { >+ $date_format = '__/__/____'; >+ } >+ elsif ( $pref =~ /^us/ ) { >+ $date_format = '__/__/____'; >+ } >+ else { >+ $date_format = '____-__-__'; >+ } >+ >+ $dbh->do("UPDATE accountlines SET description = CONCAT( description, ' 00:00' ) WHERE description LIKE '%$date_format%' AND description NOT LIKE '%$date_format%__:__%'"); >+ print "Upgrade to $DBversion done (Fix fine descriptions)\n"; >+ SetVersion($DBversion); >+} > > =head1 FUNCTIONS > >-- >1.7.2.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 8253
:
10369
|
10405
|
10416
|
10429
|
10436
|
11087
|
11127
|
11660
|
12653
|
12665
|
12666
|
12667
|
12685
|
12686