]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 287483: Sanitycheck screams about "Bad value 0 found in components.initialqacontact"
authormkanat%kerio.com <>
Tue, 5 Apr 2005 04:40:58 +0000 (04:40 +0000)
committermkanat%kerio.com <>
Tue, 5 Apr 2005 04:40:58 +0000 (04:40 +0000)
Patch By Teemu Mannermaa <wicked@etlicon.fi> r=mkanat, a=myk

checksetup.pl
editcomponents.cgi

index a0a7835bad3579bb894d4b28d9267cd716ee0c4d..b4f9fb9304298112cfd2c1f846e0601340e001ab 100755 (executable)
@@ -3838,8 +3838,14 @@ add_setting ("display_quips", {"on" => 1, "off" => 2 }, "on" );
 if (!$dbh->bz_get_field_def('bugs', 'qa_contact')->[2]) { # if it's NOT NULL
     $dbh->bz_change_field_type('bugs', 'qa_contact', 'mediumint');
     $dbh->do("UPDATE bugs SET qa_contact = NULL WHERE qa_contact = 0");
-    $dbh->do("UPDATE components SET initialqacontact = NULL
-               WHERE initialqacontact = 0");
+}
+
+# 2005-03-27 initialqacontact should be NULL instead of 0, bug 287483
+if (!$dbh->bz_get_field_def('components',
+                            'initialqacontact')->[2]) { # if it's NOT NULL
+    $dbh->bz_change_field_type('components', 'initialqacontact', 'mediumint');
+    $dbh->do("UPDATE components SET initialqacontact = NULL " .
+             "WHERE initialqacontact = 0");
 }
 
 # 2005-03-29 - gerv@gerv.net - bug 73665.
index 9a1e7934ee2278e7eab2e1bc5db510f17110bfd5..a86329d9d07ec17c6f745f77e8811492370944c3 100755 (executable)
@@ -305,6 +305,8 @@ if ($action eq 'new') {
                            {'name' => $component});
         }
     }
+    my $initialqacontactsql =
+              $initialqacontact ne '' ? SqlQuote($initialqacontactid) : 'NULL';
 
     # Add the new component
     SendSQL("INSERT INTO components ( " .
@@ -314,7 +316,7 @@ if ($action eq 'new') {
           SqlQuote($component) . "," .
           SqlQuote($description) . "," .
           SqlQuote($initialownerid) . "," .
-          SqlQuote($initialqacontactid) . ")");
+          $initialqacontactsql . ")");
 
     # Insert default charting queries for this product.
     # If they aren't using charting, this won't do any harm.
@@ -611,9 +613,11 @@ if ($action eq 'update') {
             ThrowUserError('component_need_valid_initialqacontact',
                            {'name' => $componentold});
         }
+        my $initialqacontactsql =
+              $initialqacontact ne '' ? SqlQuote($initialqacontactid) : 'NULL';
 
         SendSQL("UPDATE components
-                 SET initialqacontact=" . SqlQuote($initialqacontactid) . "
+                 SET initialqacontact = $initialqacontactsql
                  WHERE id = $component_id");
 
         $vars->{'updated_initialqacontact'} = 1;