Koha/koha-tmpl/intranet-tmpl/prog/en/modules/admin/currency.tt
Amit Gupta 581cf9cd52 Bug 8166 - Adding new currencies & exchange rates
if not fill any field it save blank record

To Test:
1) Go to Currencies & Exchange rates.
2) Create New currency
3) If you not fill any field for ex: (Currency, rate, symbol)
   it will not save the record.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-06-10 13:57:19 +02:00

231 lines
7.7 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; Currencies &amp; Exchange rates &rsaquo;
[% IF ( add_form ) %][% IF ( searchfield ) %]Modify currency '[% searchfield %]'[% ELSE %]New currency[% END %][% END %]
[% IF ( delete_confirm ) %]Confirm deletion of currency '[% searchfield %]'[% END %]
[% IF ( delete_confirmed ) %]Currency deleted[% END %]
[% IF ( else ) %]Currencies[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript">
//<![CDATA[
function toUC(f) {
var x=f.value.toUpperCase();
f.value=x;
return true;
}
function Check(f) {
var _alertString="";
var alertString2;
if (f.currency.value.length==0) {
_alertString += _("- Currency name missing") + "\n";
}
if (f.rate.value.length==0) {
_alertString += _("- Rate missing") + "\n";
}
if (f.symbol.value.length==0) {
_alertString += _("- Symbol missing") + "\n";
}
if (_alertString.length==0) {
document.Aform.submit();
} else {
alertString2 = _("Form not submitted because of the following problem(s)") + "\n";
alertString2 += "------------------------------------------------------------------------------------\n";
alertString2 += _alertString;
alert(alertString2);
}
}
function check_currency(val) {
if ( val == 1.0 ) {
$("#active").removeAttr('disabled');
$("#hint").html("");
} else {
$("#active").removeAttr('checked');
$("#active").attr('disabled','disabled');
$("#hint").html(_("The active currency must have a rate of 1.0"));
}
}
$(document).ready(function() {
new YAHOO.widget.Button("newcurrency");
// prevents users to check active with a currency != 1
$("#rate").keyup(function() {
check_currency( $(this).val() );
});
check_currency( $("#rate").val() );
});
//]]>
</script>
</head>
<body id="admin_currency" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'currencies-admin-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; <a href="/cgi-bin/koha/admin/currency.pl">Currencies &amp; Exchange rates</a> &rsaquo; [% IF ( add_form ) %][% IF ( searchfield ) %]Modify currency '[% searchfield %]'[% ELSE %]New currency[% END %][% END %]
[% IF ( delete_confirm ) %]Confirm deletion of currency '<span class="ex">[% searchfield %]</span>'[% END %]
[% IF ( delete_confirmed ) %]Currency deleted[% END %]
[% IF ( else ) %]Currencies[% END %]
</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF ( else ) %]
<div id="toolbar">
<ul class="toolbar">
<li><a id="newcurrency" href="[% script_name %]?op=add_form">New currency</a></li>
</ul></div>
[% END %]
[% IF ( add_form ) %]
<form action="[% script_name %]" name="Aform" method="post">
<input type="hidden" name="op" value="save" />
<fieldset class="rows">
<legend>[% IF ( searchfield ) %]
Modify currency
[% ELSE %]
New currency
[% END %]</legend>
<ol>
<li>
[% IF ( searchfield ) %]
<span class="label">Currency: </span>
<input type="hidden" name="currency" id="currency" value="[% searchfield %]" />[% searchfield %]
[% ELSE %]
<label for="currency">Currency: </label>
<input type="text" name="currency" id="currency" size="50" maxlength="50" onblur="toUC(this);" />
[% END %]
</li>
<li>
<label for="rate">Rate: </label>
<input type="text" name="rate" id="rate" size="10" maxlength="10" value="[% rate %]" />
</li>
<li>
<label for="symbol">Symbol: </label>
<input type="text" name="symbol" id="symbol" size="5" maxlength="5" value="[% symbol %]" />
</li>
<li>
<span class="label">Last updated: </span>[% timestamp %]
</li>
<li>
<label for="active">Active: </label>
[% IF ( active ) %]
<input type="checkbox" id="active" name="active" value="1" checked="checked" />
[% ELSE %]
<input type="checkbox" id="active" name="active" value="1" />
[% END %]
<span id="hint" class="hint"></span>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Submit" onclick="Check(this.form); return false;" />
<a href="/cgi-bin/koha/admin/currency.pl" class="cancel">Cancel</a>
</fieldset>
</form>
[% END %]
[% IF ( delete_confirm ) %]
[% IF ( totalgtzero ) %]
<div class="dialog message">
<h3>Cannot delete currency <span class="ex">'[% searchfield %]'</span></h3>
<p>This currency is used [% total %] times. Deletion not possible</p>
<form action="[% script_name %]" method="post">
<input type="submit" value="OK" class="approve" />
</form>
</div>
[% ELSE %]
<div class="dialog alert">
<h3>Confirm deletion of currency <span class="ex">'[% searchfield %]'</span></h3>
<table>
<tr><th>Currency</th>
<td>[% searchfield %]</td>
</tr>
<tr><th>Rate</th>
<td>[% rate %]</td>
</tr>
</table>
<form action="[% script_name %]" method="post">
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="searchfield" value="[% searchfield %]" />
<input type="submit" class="approve" value="Delete this Currency" />
</form>
<form action="[% script_name %]" method="post">
<input type="submit" class="deny" value="No, Do Not Delete" />
</form>
</div>
[% END %]
[% END %]
[% IF ( delete_confirmed ) %]
<div class="dialog message"><h3>Currency deleted</h3>
<form action="[% script_name %]" method="post">
<input type="submit" class="approve" value="OK" />
</form></div>
[% END %]
[% IF ( else ) %]
<h2>Currencies and exchange rates</h2>
[% IF ( loop ) %][% UNLESS ( activecurrency ) %]<div class="dialog alert"><h3>No active currency is defined</h3><p>Please edit one currency and mark it as active.</p></div>[% END %][% END %]
[% IF ( searchfield ) %]
You searched for [% searchfield %]</span>
[% END %]
<table>
<tr>
<th>Currency</th>
<th>Rate</th>
<th>Symbol</th>
<th>Last updated</th>
<th>Active</th>
<th colspan="2">Actions&nbsp;</th>
</tr>
[% FOREACH loo IN loop %]
[% UNLESS ( loop.odd ) %]
<tr class="highlight">
[% ELSE %]
<tr>
[% END %]
<td>[% loo.currency %]</td>
<td>[% loo.rate %]</td>
<td>[% loo.symbol |html %]</td>
<td>[% loo.timestamp %]</td>
<td style="color:green;">[% IF ( loo.active ) %]✓[% END %]</td>
<td><a href="[% loo.script_name %]?op=add_form&amp;searchfield=[% loo.currency %]">Edit</a></td>
<td><a href="[% loo.script_name %]?op=delete_confirm&amp;searchfield=[% loo.currency %]">Delete</a></td>
</tr>
[% END %]
</table>
<br />
[% IF ( offsetgtzero ) %]
<a href="[% script_name %]?offset=[% prevpage %]">&lt;&lt; Previous</a>
[% END %]
[% IF ( ltcount ) %]
<a href="[% script_name %]?offset=[% nextpage %]">Next &gt;&gt;</a>
[% END %]
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'admin-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]