[Rt-commit] rt branch, 4.0/rest-undef-values, created. rt-4.0.6-126-g4daad45

Alex Vandiver alexmv at bestpractical.com
Thu Jun 7 21:35:08 EDT 2012


The branch, 4.0/rest-undef-values has been created
        at  4daad456a115829433a5f7a2f9db8df60bca3ef6 (commit)

- Log -----------------------------------------------------------------
commit 4daad456a115829433a5f7a2f9db8df60bca3ef6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 7 21:31:27 2012 -0400

    Protect against undef field values in REST
    
    SQLite is the only schema which allows NULL values in relevant columns,
    which manifests as warnings when running tests under sqlite.  Protect
    against this by factoring out the column check and providing a sane
    default.

diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default
index 9a2212b..fe74779 100755
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -292,8 +292,10 @@ else {
         elsif (exists $simple{$key}) {
             $key = $simple{$key};
             $set = "Set$key";
+            my $current = $ticket->$key;
+            $current = '' unless defined $current;
 
-            next if (($val eq ($ticket->$key||''))|| ($ticket->$key =~ /^\d+$/ && $val =~ /^\d+$/ && $val == $ticket->$key));
+            next if ($val eq $current) or ($current =~ /^\d+$/ && $val =~ /^\d+$/ && $val == $current);
             ($n, $s) = $ticket->$set("$val");
         }
         elsif (exists $dates{$key}) {

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


More information about the Rt-commit mailing list