83e9a8e73b
This patch fixes the problem reported. To test: 1) Apply the patch 2) Update translations for your preffered language, xx-YY 3) Check new entries egrep -Rn "Cost must be expressed as a decimal number|Invalid value for" misc/translator/xx-YY* 4) Check no regression on alert, go to Administration > Transport cost matrix Edit some value and put a negative value & save, alert must show up 5) On errors, part of the error string is now on TT file, no regressions expected here Verified that changes appear in translated language (de-CH) as appropriate. No regressions found by testing en en de-CH. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Tested both, entering a numeric value < 0 and non-numeric values, no regressions found. Passes tests and QA script. Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
129 lines
4.9 KiB
Text
129 lines
4.9 KiB
Text
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Administration › Transport cost matrix</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
function check_transport_cost(e) {
|
|
var val = e.value;
|
|
if (val && val != '' && !isNaN(parseFloat(val)) && val >= 0.0) {
|
|
return;
|
|
}
|
|
alert(_("Cost must be expressed as a decimal number >= 0"));
|
|
}
|
|
function disable_transport_cost_chg(e, cost_id) {
|
|
disable_transport_cost(cost_id, e.checked);
|
|
}
|
|
function disable_transport_cost(cost_id, disable) {
|
|
if (disable) {
|
|
$('#celldiv_'+cost_id).find('input[type=text]').attr("disabled","disabled").addClass('disabled-transfer');
|
|
} else {
|
|
$('#celldiv_'+cost_id).find('input:disabled').removeAttr("disabled").removeClass('disabled-transfer');
|
|
}
|
|
}
|
|
function enable_cost_input(cost_id) {
|
|
var cell = $('#celldiv_'+cost_id);
|
|
var cost = $(cell).text();
|
|
var disabled = $(cell).hasClass('disabled-transfer');
|
|
$(cell).removeClass('disabled-transfer');
|
|
|
|
$('#celldiv_'+cost_id).html(
|
|
'<input type="text" name="cost_'+cost_id+'" onblur="check_transport_cost(this);" size="4" value="'+$.trim(cost)+'" />'+
|
|
'<br/>Disable <input name="disable_'+cost_id+'" value="1" onchange="disable_transport_cost_chg(this, \''+cost_id+'\');" type="checkbox" '+(disabled ? 'checked' : '')+' />'
|
|
);
|
|
disable_transport_cost(cost_id, disabled);
|
|
}
|
|
|
|
function form_submit (f) {
|
|
$(f).find('input:disabled').removeAttr("disabled");
|
|
return true;
|
|
}
|
|
//]]>
|
|
</script>
|
|
<style type="text/css">
|
|
.disabled-transfer {
|
|
background-color: #FF8888;
|
|
}
|
|
</style>
|
|
|
|
</head>
|
|
<body>
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › Transport cost matrix</div>
|
|
|
|
<div id="doc3" class="yui-t1">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
<h1 class="parameters">
|
|
Defining transport costs between libraries
|
|
</h1>
|
|
[% IF ( WARNING_transport_cost_matrix_off ) %]
|
|
<div class="dialog message">Because the "UseTransportCostMatrix" system preference is currently not enabled, the transport cost matrix is not being used. Go <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=UseTransportCostMatrix">here</a> if you wish to enable this feature.</div>
|
|
[% END %]
|
|
|
|
[% IF ( errors ) %]<div class="dialog alert">
|
|
<h4>There were problems with your submission</h4>
|
|
<ul>
|
|
[% FOR e IN errors %]
|
|
<li>Invalid value for [% e %]</li>
|
|
[% END %]
|
|
</ul>
|
|
</div>[% END %]
|
|
|
|
<form method="post" action="?" onsubmit="return form_submit(this);">
|
|
<input type="hidden" name="op" value="set-cost-matrix" />
|
|
<fieldset id="transport-cost-matrix">
|
|
<div class="help">
|
|
<p>Costs are decimal values between some arbitrary maximum value (e.g. 1 or 100) and 0 which is the minimum (no) cost.</p>
|
|
<p>Red cells signify no transfer allowed.</p>
|
|
<p>Click on individual cells to edit.</p>
|
|
</div>
|
|
|
|
<table>
|
|
<tr>
|
|
<th>From \ To</th>
|
|
[% FOR b IN branchloop %]
|
|
<th>[% b.name %]</th>
|
|
[% END %]
|
|
</tr>
|
|
[% FOR bf IN branchfromloop %]
|
|
<tr>
|
|
<th>[% bf.name %]</th>
|
|
[% FOR bt IN bf.branchtoloop %]
|
|
<td>
|
|
[% IF bt.skip %]
|
|
|
|
[% ELSE %]
|
|
[% IF bt.disabled %]
|
|
<div id="celldiv_[% bt.id %]" class="disabled-transfer">
|
|
[% ELSE %]
|
|
<div id="celldiv_[% bt.id %]">
|
|
[% END %]
|
|
<div onclick="enable_cost_input('[% bt.id %]');">[% bt.disabled ? ' ' : bt.value %]</div>
|
|
<input type="hidden" name="cost_[% bt.id %]" value="[% bt.value %]" />
|
|
[% IF bt.disabled %]
|
|
<input type="hidden" name="disable_[% bt.id %]" value="1" />
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
</td>
|
|
[% END %]
|
|
</tr>
|
|
[% END %]
|
|
</table>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="submit" value="Save" class="submit" /> <a href="/cgi-bin/koha/admin/transport-cost-matrix.pl" class="cancel">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
[% INCLUDE 'admin-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|