X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FElements%2FEditTimeValue;h=d7a6e2aaa17775d3179f2b11e290e5e92131b37b;hb=9ce482da3960ee43decee41fba53b78c12c3e52c;hp=40e3b677adb8591843d3a66127cec8709e51ef65;hpb=85e677b86fc37c54e6de2b06340351a28f5a5916;p=freeside.git diff --git a/rt/share/html/Elements/EditTimeValue b/rt/share/html/Elements/EditTimeValue index 40e3b677a..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-2012 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; }