X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FElements%2FEditTimeValue;h=4891b556d562bec7f50e79f946fe3ff4935a8eed;hb=44dd00a3ff974a17999e86e64488e996edc71e3c;hp=fc87813223ba50b87187f8ba70d685e4ceded53e;hpb=7588a4ac90a9b07c08a3107cd1107d773be1c991;p=freeside.git diff --git a/rt/share/html/Elements/EditTimeValue b/rt/share/html/Elements/EditTimeValue index fc8781322..4891b556d 100644 --- a/rt/share/html/Elements/EditTimeValue +++ b/rt/share/html/Elements/EditTimeValue @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2019 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; }