[freeside-commits] branch FREESIDE_3_BRANCH updated. 35f1450398aec28d59643ca4e0b99dd638e8838c

Mark Wells mark at 420.am
Mon Apr 7 16:19:14 PDT 2014


The branch, FREESIDE_3_BRANCH has been updated
       via  35f1450398aec28d59643ca4e0b99dd638e8838c (commit)
      from  c8d94e67465c81cbdef6e85f6fe303cc3a403e63 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 35f1450398aec28d59643ca4e0b99dd638e8838c
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Apr 7 16:18:56 2014 -0700

    avoid creating Set TimeWorked transactions where new value is empty, #28459

diff --git a/FS/FS/TicketSystem.pm b/FS/FS/TicketSystem.pm
index fa54e0b..3c972d0 100644
--- a/FS/FS/TicketSystem.pm
+++ b/FS/FS/TicketSystem.pm
@@ -357,6 +357,16 @@ sub _upgrade_data {
     warn "Removed $rows dangling ticket-$table links\n" if $rows > 0;
   }
 
+  # Fix ticket transactions on the Time* fields where the NewValue (or
+  # OldValue, though this is not known to happen) is an empty string
+  foreach (qw(newvalue oldvalue)) {
+    my $rows = $dbh->do(
+      "UPDATE transactions SET $_ = '0' WHERE objecttype='RT::Ticket' AND ".
+      "field IN ('TimeWorked', 'TimeEstimated', 'TimeLeft') AND $_ = ''"
+    ) or die $dbh->errstr;
+    warn "Fixed $rows transactions with empty time values\n" if $rows > 0;
+  }
+
   return;
 }
 
diff --git a/rt/lib/RT/Interface/Web_Vendor.pm b/rt/lib/RT/Interface/Web_Vendor.pm
index e9c6346..245df12 100644
--- a/rt/lib/RT/Interface/Web_Vendor.pm
+++ b/rt/lib/RT/Interface/Web_Vendor.pm
@@ -284,6 +284,14 @@ sub ProcessTicketBasics {
         }
     }
 
+    # RT core _will_ allow Set transactions that change these 
+    # fields to empty strings, but internally change the values 
+    # to zero.  This is sloppy and causes some problems.
+    foreach my $field (qw(TimeWorked TimeEstimated TimeLeft)) {
+      $ARGSRef->{$field} =~ s/\s//g;
+      $ARGSRef->{$field} ||= 0;
+    }
+
     my @results = UpdateRecordObject(
         AttributesRef => \@attribs,
         Object        => $TicketObj,

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

Summary of changes:
 FS/FS/TicketSystem.pm             |   10 ++++++++++
 rt/lib/RT/Interface/Web_Vendor.pm |    8 ++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)




More information about the freeside-commits mailing list