[Koha-patches] [PATCH] bug_5911: Javascript and error messages corrections
Srdjan
srdjan at catalyst.net.nz
Tue Jul 24 01:57:46 CEST 2012
---
C4/HoldsQueue.pm | 8 ++++++--
.../prog/en/modules/admin/transport-cost-matrix.tt | 4 ++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm
index 05095d8..d7696dd 100755
--- a/C4/HoldsQueue.pm
+++ b/C4/HoldsQueue.pm
@@ -94,8 +94,12 @@ sub UpdateTransportCostMatrix {
my $cost = $_->{cost};
my $from = $_->{frombranch};
my $to = $_->{tobranch};
- if ( !defined ($cost) || ($cost !~ m/(0|[1-9][0-9]*)(\.[0-9]*)?/o) ) {
- warn "Invalid $from -> $to cost $cost - nust be a number in 0 to 1 range, disablig";
+ if ($_->{disable_transfer}) {
+ $cost ||= 0;
+ }
+ elsif ( !defined ($cost) || ($cost !~ m/(0|[1-9][0-9]*)(\.[0-9]*)?/o) ) {
+ warn "Invalid $from -> $to cost $cost - must be a number >= 0, disablig";
+ $cost = 0;
$_->{disable_transfer} = 1;
}
$sth->execute( $from, $to, $cost, $_->{disable_transfer} ? 1 : 0 );
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt
index db9cf24..8d12419 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/transport-cost-matrix.tt
@@ -28,7 +28,7 @@ function enable_cost_input(cost_id) {
$(cell).removeClass('disabled-transfer');
$('#celldiv_'+cost_id).html(
- '<input name="cost_'+cost_id+'" onblur="check_transport_cost(this);" size="4" value="'+$.trim(cost)+'" />'+
+ '<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);
@@ -106,7 +106,7 @@ $(document).ready(function() {
[% ELSE %]
<div id="celldiv_[% bt.id %]">
[% END %]
- <div onclick="enable_cost_input('[% bt.id %]');">[% !bt.disabled && bt.value > '' ? bt.value : ' ' %]</div>
+ <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" />
--
1.7.9.5
More information about the Koha-patches
mailing list