Bugzilla – Attachment 10544 Details for
Bug 7571
Maintain exchange rate history
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 7571 Maintain exchange rate history
SIGNED-OFF-Bug-7571-Maintain-exchange-rate-history.patch (text/plain), 3.60 KB, created by
Marc Véron
on 2012-06-27 15:14:56 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 7571 Maintain exchange rate history
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2012-06-27 15:14:56 UTC
Size:
3.60 KB
patch
obsolete
>From 169225b1e9400b32681e2c0d1f4f7c7fc6f34c14 Mon Sep 17 00:00:00 2001 >From: Sagar <sagar.br@osslabs.biz> >Date: Thu, 14 Jun 2012 14:09:23 +0530 >Subject: [PATCH] [SIGNED-OFF] Bug 7571 Maintain exchange rate history >Content-Type: text/plain; charset="utf-8" > >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(+), 0 deletions(-) > >diff --git a/admin/currency.pl b/admin/currency.pl >index e24f6b6..381e8ce 100755 >--- a/admin/currency.pl >+++ b/admin/currency.pl >@@ -175,6 +175,21 @@ sub add_form { > $template->param( 'timestamp' => format_date($date) ); > } > >+ 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; > } > >@@ -188,6 +203,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'); > } >@@ -204,6 +226,7 @@ q|UPDATE currency SET rate = ?, symbol = ?, active = ? WHERE currency = ? |, > $rec->{active}, > $rec->{currency} > ); >+ > } else { > $dbh->do( > q|INSERT INTO currency (currency, rate, symbol, active) VALUES (?,?,?,?) |, >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index d06a188..ebe6042 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5392,6 +5392,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+$DBversion = "3.09.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($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); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >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 4834ff3..d98ab3e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt >@@ -133,6 +133,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 ) %] >-- >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 7571
:
10271
|
10544
|
39225