Bug 16227: Fix regression from bug 15084 - select currencies correctly

This patch fixes a regression introduced by bug 15084: The currency
dropdown lists are not correctly built.
The selected currencies are wrong.

Test plan:
Create a vendor, the selected currencies should be the default one
Edit the vendor, the selected currencies should be the ones defined for
 this vendor
Create an order, the selected currency should be the 'List prices' of
 the vendor
Edit an order, the selected currency should be the one defined for this
 order

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-04-08 11:42:15 +01:00 committed by Brendan Gallagher
parent 40ec26dc6c
commit fd9f9f9be1
3 changed files with 19 additions and 17 deletions

View File

@ -352,6 +352,8 @@ $template->param(
cur_active_sym => $active_currency->symbol,
cur_active => $active_currency->currency,
currencies => \@currencies,
currency => $data->{currency},
vendor_currency => $bookseller->{listprice},
orderexists => ( $new eq 'yes' ) ? 0 : 1,
title => $data->{'title'},
author => $data->{'author'},

View File

@ -302,8 +302,8 @@ $(document).ready(function()
<input type="hidden" name="suggestionid" value="[% suggestionid %]" />
<input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
[% FOREACH currency IN currencies %]
<input type="hidden" id="currency_rate_[% currency.currency %]" name="[% currency.currency %]" value="[% currency.rate %]" />
[% FOREACH c IN currencies %]
<input type="hidden" id="currency_rate_[% c.currency %]" name="[% c.currency %]" value="[% c.rate %]" />
[% END %]
<ol><li>
@ -523,11 +523,11 @@ $(document).ready(function()
[% ELSE %]
<label for="currency">Currency:</label>
<select name="currency" id="currency" onchange="updateCosts();">
[% FOREACH currency IN currencies %]
[% IF ordernumber and currency.currency == listprice or not ordernumber and currency.active %]
<option value="[% currency.currency %]" selected="selected">[% currency.currency %]</option>
[% ELSIF not currency.archived %]
<option value="[% currency.currency %]">[% currency.currency %]</option>
[% FOREACH c IN currencies %]
[% IF ordernumber and c.currency == currency or not ordernumber and c.currency == vendor_currency %]
<option value="[% c.currency %]" selected="selected">[% c.currency %]</option>
[% ELSIF not c.archived %]
<option value="[% c.currency %]">[% c.currency %]</option>
[% END %]
[% END %]
</select>

View File

@ -222,22 +222,22 @@ function delete_contact(ev) {
<ol>
<li><label for="list_currency">List prices are: </label>
<select name="list_currency" id="list_currency">
[% FOREACH currency IN currencies %]
[% IF booksellerid and currency.currency == listprice or not booksellerid and currency.active %]
<option value="[% currency.currency %]" selected="selected">[% currency.currency %]</option>
[% ELSIF not currency.archived %]
<option value="[% currency.currency %]" selected="selected">[% currency.currency %]</option>
[% FOREACH c IN currencies %]
[% IF booksellerid and c.currency == listprice or not booksellerid and c.active %]
<option value="[% c.currency %]" selected="selected">[% c.currency %]</option>
[% ELSIF not c.archived %]
<option value="[% c.currency %]">[% c.currency %]</option>
[% END %]
[% END %]
</select>
</li>
<li><label for="invoice_currency">Invoice prices are: </label>
<select name="invoice_currency" id="invoice_currency">
[% FOREACH currency IN currencies %]
[% IF booksellerid and currency.currency == invoiceprice or not booksellerid and currency.active %]
<option value="[% currency.currency %]" selected="selected">[% currency.currency %]</option>
[% ELSIF not currency.archived %]
<option value="[% currency.currency %]" selected="selected">[% currency.currency %]</option>
[% FOREACH c IN currencies %]
[% IF booksellerid and c.currency == invoiceprice or not booksellerid and c.active %]
<option value="[% c.currency %]" selected="selected">[% c.currency %]</option>
[% ELSIF not c.archived %]
<option value="[% c.currency %]">[% c.currency %]</option>
[% END %]
[% END %]
</select>