[Rt-commit] rt branch, 4.0-trunk, updated. rt-4.0.1-137-g7101be5

Alex Vandiver alexmv at bestpractical.com
Thu Jul 28 12:32:20 EDT 2011


The branch, 4.0-trunk has been updated
       via  7101be5e6b2f16c1ecd0cdee593f0237434f7721 (commit)
       via  0bffa2a69e697a24817e79cce64021041538ab66 (commit)
       via  ab6203b1cda0e32e02d318dc9e083536a6f38eab (commit)
      from  a77f514fa386a83480a413c1c842d1549185e94c (commit)

Summary of changes:
 etc/RT_Config.pm.in                 |    2 +-
 lib/RT/Config.pm                    |   10 ++++++++++
 share/html/Elements/EditTimeValue   |    4 ++--
 share/html/Elements/SelectTimeUnits |    2 +-
 4 files changed, 14 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit ab6203b1cda0e32e02d318dc9e083536a6f38eab
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jul 21 12:26:37 2011 -0400

    %g can lose minutes and produce scientific notation
    
    As documented in printf(3), %g treats a .3 precision as the maximum
    number of significant digits instead of maximum number of digits after
    the radix.  This means large enough time values loose minutes when the
    DefaultTimeUnitsToHours option is enabled.
    
    Additionally, %g can sometimes produce scientific notation, which
    completely breaks RT's parsing.

diff --git a/share/html/Elements/EditTimeValue b/share/html/Elements/EditTimeValue
index 8e2e645..b28ae36 100644
--- a/share/html/Elements/EditTimeValue
+++ b/share/html/Elements/EditTimeValue
@@ -59,7 +59,7 @@ $ValueName ||= $Name;
 $UnitName  ||= ($Name||$ValueName) . '-TimeUnits';
 
 if ($InputUnits eq 'minutes' && RT->Config->Get('DefaultTimeUnitsToHours')) {
-    $Default = sprintf '%.3g', $Default / 60
+    $Default = sprintf '%.3f', $Default / 60
         unless $Default eq '';
 }
 </%INIT>

commit 0bffa2a69e697a24817e79cce64021041538ab66
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jul 21 12:30:05 2011 -0400

    Turn DefaultTimeUnitsToHours into a user preference
    
    This makes manually adding time worked to a ticket so much easier when
    you don't use the update page's ability to add time worked.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index c508b7d..cdfe938 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1921,7 +1921,7 @@ Set($AmbiguousDayInFuture, 0);
 =item C<$DefaultTimeUnitsToHours>
 
 Use this to set the default units for time entry to hours instead of
-minutes.
+minutes.  Note that this only effects entry, not display.
 
 =cut
 
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index d1102fb..79d357f 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -255,6 +255,16 @@ our %META = (
             Hints => "When the WYSIWYG editor is not enabled, this setting determines whether automatic line wraps in the ticket message box are sent to RT or not.",              # loc
         },
     },
+    DefaultTimeUnitsToHours => {
+        Section         => 'Ticket composition', #loc
+        Overridable     => 1,
+        SortOrder       => 9,
+        Widget          => '/Widgets/Form/Boolean',
+        WidgetArguments => {
+            Description => 'Enter time in hours by default', #loc
+            Hints       => 'Only for entry, not display', #loc
+        },
+    },
     SearchResultsRefreshInterval => {
         Section         => 'General',                       #loc
         Overridable     => 1,
diff --git a/share/html/Elements/EditTimeValue b/share/html/Elements/EditTimeValue
index b28ae36..65ba8c5 100644
--- a/share/html/Elements/EditTimeValue
+++ b/share/html/Elements/EditTimeValue
@@ -58,7 +58,7 @@ $InputUnits => 'minutes'
 $ValueName ||= $Name;
 $UnitName  ||= ($Name||$ValueName) . '-TimeUnits';
 
-if ($InputUnits eq 'minutes' && RT->Config->Get('DefaultTimeUnitsToHours')) {
+if ($InputUnits eq 'minutes' && RT->Config->Get('DefaultTimeUnitsToHours', $session{'CurrentUser'})) {
     $Default = sprintf '%.3f', $Default / 60
         unless $Default eq '';
 }
diff --git a/share/html/Elements/SelectTimeUnits b/share/html/Elements/SelectTimeUnits
index 714c5a4..b4c69f2 100755
--- a/share/html/Elements/SelectTimeUnits
+++ b/share/html/Elements/SelectTimeUnits
@@ -55,7 +55,7 @@
 </select>
 <%INIT>
 $Name .= '-TimeUnits' unless $Name =~ /-TimeUnits$/io;
-my $HoursDefault = RT->Config->Get('DefaultTimeUnitsToHours');
+my $HoursDefault = RT->Config->Get('DefaultTimeUnitsToHours', $session{'CurrentUser'});
 </%INIT>
 <%ARGS>
 $Name => ''

commit 7101be5e6b2f16c1ecd0cdee593f0237434f7721
Merge: a77f514 0bffa2a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 28 12:31:57 2011 -0400

    Merge branch '4.0/default-time-units' into 4.0-trunk


-----------------------------------------------------------------------


More information about the Rt-commit mailing list