X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FElements%2FEditTimeValue;h=d7a6e2aaa17775d3179f2b11e290e5e92131b37b;hb=7322f2afedcc2f427e997d1535a503613a83f088;hp=ac27665fbf8b86b5a9077b57423b1877b70b9839;hpb=73a6a80a9ca5edbd43d139b7cb25bfee4abfd35e;p=freeside.git diff --git a/rt/share/html/Elements/EditTimeValue b/rt/share/html/Elements/EditTimeValue index ac27665fb..d7a6e2aaa 100644 --- a/rt/share/html/Elements/EditTimeValue +++ b/rt/share/html/Elements/EditTimeValue @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -46,20 +46,22 @@ %# %# END BPS TAGGED BLOCK }}} -<& /Elements/SelectTimeUnits, Name => $UnitName &> +<& /Elements/SelectTimeUnits, Name => $UnitName, Default => $InUnits &> <%ARGS> $Default => '' $Name => '' $ValueName => '' $UnitName => '' -$InputUnits => 'minutes' +$InUnits => '' <%INIT> $ValueName ||= $Name; $UnitName ||= ($Name||$ValueName) . '-TimeUnits'; +$InUnits ||= $m->request_args->{ $UnitName }; +$InUnits ||= RT->Config->Get('DefaultTimeUnitsToHours', $session{'CurrentUser'}) ? 'hours' : 'minutes'; -if ($InputUnits eq 'minutes' && RT->Config->Get('DefaultTimeUnitsToHours', $session{'CurrentUser'})) { - $Default = sprintf '%.3f', $Default / 60 - unless $Default eq ''; +if ($Default && $InUnits eq 'hours') { + # 0+ here is to remove the ending 0s + $Default = 0 + sprintf '%.3f', $Default / 60; }