Bugzilla – Attachment 39225 Details for
Bug 7571
Maintain exchange rate history
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7571 Maintain exchange rate history
Bug-7571-Maintain-exchange-rate-history.patch (text/plain), 3.54 KB, created by
Mark Tompsett
on 2015-05-15 20:03:40 UTC
(
hide
)
Description:
Bug 7571 Maintain exchange rate history
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-05-15 20:03:40 UTC
Size:
3.54 KB
patch
obsolete
>From 7d5fb2a7f61d0fd73e64138aac60bf64cbb79c7f Mon Sep 17 00:00:00 2001 >From: Sagar <sagar.br@osslabs.biz> >Date: Thu, 14 Jun 2012 14:09:23 +0530 >Subject: [PATCH] Bug 7571 Maintain exchange rate history > >Keep track of changes to exchange rates for accounting purposes. >History is displayed with each currency. > >Behaviour is as expected. > >Signed-off-by: Marc Veron <veron@veron.ch> >--- > admin/currency.pl | 23 ++++++++++++++++++++++ > installer/data/mysql/updatedatabase.pl | 7 +++++++ > .../prog/en/modules/admin/currency.tt | 15 ++++++++++++++ > 3 files changed, 45 insertions(+) > >diff --git a/admin/currency.pl b/admin/currency.pl >index f62f761..2c4a236 100755 >--- a/admin/currency.pl >+++ b/admin/currency.pl >@@ -169,6 +169,21 @@ sub add_form { > } > } > >+ my $dbh = C4::Context->dbh; >+ my $query = " >+ SELECT currency,timestamp,rate >+ FROM ex_rates where currency=?; >+ "; >+ my $sth = $dbh->prepare($query); >+ $sth->execute($curr); >+ my @results = (); >+ while ( my $data = $sth->fetchrow_hashref ) { >+ push( @results, $data ); >+ } >+ $template->param( >+ ex_result => \@results, >+ ); >+ > return; > } > >@@ -183,6 +198,13 @@ sub add_validate { > currency => $input->param('currency'), > }; > >+ $dbh->do( >+q|INSERT INTO ex_rates (currency, rate, timestamp) VALUES (?,?,now()) |, >+ {}, >+ $rec->{currency}, >+ $rec->{rate} >+ ); >+ > if ( $rec->{active} == 1 ) { > $dbh->do('UPDATE currency SET active = 0'); > } >@@ -200,6 +222,7 @@ q|UPDATE currency SET rate = ?, symbol = ?, isocode = ?, active = ? WHERE curren > $rec->{active}, > $rec->{currency} > ); >+ > } else { > $dbh->do( > q|INSERT INTO currency (currency, rate, symbol, isocode, active) VALUES (?,?,?,?,?) |, >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 13c03d5..c88def1 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -10425,6 +10425,13 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.19.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do("create table ex_rates(currency varchar(10) not null REFERENCES currency(currency) ON UPDATE CASCADE ON DELETE CASCADE,rate float(15,5) default null,timestamp timestamp not null,UNIQUE(currency,timestamp));"); >+ print "Upgrade to $DBversion done (Insert currency details into ex_rates for exchage rate history)\n"; >+ SetVersion ($DBversion); >+} >+ > # DEVELOPER PROCESS, search for anything to execute in the db_update directory > # SEE bug 13068 > # if there is anything in the atomicupdate, read and execute it. >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >index 57c38cf..f5e010b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >@@ -122,6 +122,21 @@ > </fieldset> > </form> > >+ [% IF ( searchfield ) %] >+ <h2>Exchange rates History [% searchfield %] </h2> >+ <table> >+ <tr> >+ <th>Date</th> >+ <th>Rate</th> >+ </tr> >+ [% FOREACH loo IN ex_result %] >+ <tr> >+ <td>[% loo.timestamp %]</td> >+ <td>[% loo.rate %]</td> >+ </tr> >+ [% END %] >+ </table> >+ [% END %] > [% END %] > > [% IF ( delete_confirm ) %] >-- >2.1.4
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 7571
:
10271
|
10544
| 39225