From 0ce44681395c0a6ef5d8a54caa8aca73728b3b25 Mon Sep 17 00:00:00 2001 From: "mkanat%kerio.com" <> Date: Tue, 15 Mar 2005 13:20:47 +0000 Subject: Bug 285534: bugs.qa_contact should allow NULL Patch By Max Kanat-Alexander r=joel, a=justdave --- process_bug.cgi | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'process_bug.cgi') diff --git a/process_bug.cgi b/process_bug.cgi index 0b9354171..219e9226d 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -349,6 +349,9 @@ sub CheckCanChangeField { # START DO_NOT_CHANGE my ($field, $bugid, $oldvalue, $newvalue) = (@_); + $oldvalue = defined($oldvalue) ? $oldvalue : ''; + $newvalue = defined($newvalue) ? $newvalue : ''; + # Return true if they haven't changed this field at all. if ($oldvalue eq $newvalue) { return 1; @@ -436,7 +439,7 @@ sub CheckCanChangeField { } # Allow the QA contact to change anything else. - if (Param('useqacontact') && ($qacontactid == $whoid)) { + if (Param('useqacontact') && $qacontactid && ($qacontactid == $whoid)) { return 1; } @@ -877,13 +880,17 @@ my $qacontact; if (defined $::FORM{'qa_contact'} && $::FORM{'knob'} ne "reassignbycomponent") { - $qacontact = 0; my $name = trim($::FORM{'qa_contact'}); # The QA contact cannot be deleted from show_bug.cgi for a single bug! if ($name ne $::FORM{'dontchange'}) { $qacontact = DBNameToIdAndCheck($name) if ($name ne ""); DoComma(); - $::query .= "qa_contact = $qacontact"; + if($qacontact) { + $::query .= "qa_contact = $qacontact"; + } + else { + $::query .= "qa_contact = NULL"; + } } } @@ -967,9 +974,14 @@ SWITCH: for ($::FORM{'knob'}) { if (Param("useqacontact")) { SendSQL("SELECT initialqacontact FROM components " . "WHERE components.id = $comp_id"); - $qacontact = FetchOneColumn() || 0; + $qacontact = FetchOneColumn(); DoComma(); - $::query .= "qa_contact = $qacontact"; + if ($qacontact) { + $::query .= "qa_contact = $qacontact"; + } + else { + $::query .= "qa_contact = NULL"; + } } last SWITCH; }; -- cgit v1.2.3-24-g4f1b