From 4560c2324d978970871bfbe6a9480b17a915342f Mon Sep 17 00:00:00 2001 From: "cyeh%bluemartini.com" <> Date: Fri, 23 Feb 2001 02:11:22 +0000 Subject: fix for 66876: Using userids (mediumint) for initialowner and initialqacontact based on patch submitted by baulig@suse.de (Martin Baulig). --- editcomponents.cgi | 87 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 22 deletions(-) (limited to 'editcomponents.cgi') diff --git a/editcomponents.cgi b/editcomponents.cgi index 4714a4d8a..dcca05bba 100755 --- a/editcomponents.cgi +++ b/editcomponents.cgi @@ -116,7 +116,10 @@ sub CheckComponent ($$) sub EmitFormElements ($$$$$) { - my ($product, $component, $initialowner, $initialqacontact, $description) = @_; + my ($product, $component, $initialownerid, $initialqacontactid, $description) = @_; + + my ($initialowner, $initialqacontact) = ($initialownerid ? DBID_to_name ($initialownerid) : '', + $initialqacontactid ? DBID_to_name ($initialqacontactid) : ''); print " Component:\n"; print " Delete\n"; print ""; - while ( MoreSQLData() ) { - my ($component,$desc,$initialowner,$initialqacontact, $bugs) = FetchSQLData(); + my @data; + while (MoreSQLData()) { + push @data, [FetchSQLData()]; + } + foreach (@data) { + my ($component,$desc,$initialownerid,$initialqacontactid, $bugs) = @$_; + $desc ||= "missing"; - $initialowner ||= "missing"; - $initialqacontact ||= "none"; + my $initialowner = $initialownerid ? DBID_to_name ($initialownerid) : "missing"; + my $initialqacontact = $initialqacontactid ? DBID_to_name ($initialqacontactid) : "missing"; print "\n"; print " $component\n"; print " $desc\n"; @@ -338,7 +346,7 @@ if ($action eq 'add') { print "
\n"; print "\n"; - EmitFormElements($product, '', '', '', ''); + EmitFormElements($product, '', 0, 0, ''); print "
\n
\n"; print "\n"; @@ -398,7 +406,17 @@ if ($action eq 'new') { exit; } + my $initialownerid = DBname_to_id ($initialowner); + if (!$initialownerid) { + print "You must use an existing Bugzilla account as initial owner for the component +'$component'. Please press\n"; + print "Back and try again.\n"; + PutTrailer($localtrailer); + exit; + } + my $initialqacontact = trim($::FORM{initialqacontact} || ''); + my $initialqacontactid = DBname_to_id ($initialqacontact); if (Param('useqacontact')) { if ($initialqacontact eq '') { print "You must enter an initial QA contact for the component '$component'. Please press\n"; @@ -406,6 +424,13 @@ if ($action eq 'new') { PutTrailer($localtrailer); exit; } + + if (!$initialqacontactid) { + print "You must use an existing Bugzilla account as initial QA contact for the component '$component'. Please press\n"; + print "Back and try again.\n"; + PutTrailer($localtrailer); + exit; + } # # Now validating to make sure it's too an existing account # @@ -419,8 +444,8 @@ if ($action eq 'new') { SqlQuote($product) . "," . SqlQuote($component) . "," . SqlQuote($description) . "," . - SqlQuote($initialowner) . "," . - SqlQuote($initialqacontact) . ")"); + SqlQuote($initialownerid) . "," . + SqlQuote($initialqacontactid) . ")"); # Make versioncache flush unlink "data/versioncache"; @@ -458,13 +483,14 @@ if ($action eq 'del') { my ($product,$pdesc,$milestoneurl,$disallownew, - $dummy,$component,$initialowner,$initialqacontact,$cdesc) = FetchSQLData(); + $dummy,$component,$initialownerid,$initialqacontactid,$cdesc) = FetchSQLData(); + + my $initialowner = $initialownerid ? DBID_to_name ($initialownerid) : "missing"; + my $initialqacontact = $initialqacontactid ? DBID_to_name ($initialqacontactid) : "missing"; $pdesc ||= "missing"; $milestoneurl ||= "missing"; $disallownew = $disallownew ? 'closed' : 'open'; - $initialowner ||= "missing"; - $initialqacontact ||= "missing"; $cdesc ||= "missing"; print "\n"; @@ -637,14 +663,17 @@ if ($action eq 'edit') { AND value=" . SqlQuote($component) ); my ($product,$pdesc,$milestoneurl,$disallownew, - $dummy,$component,$initialowner,$initialqacontact,$cdesc) = FetchSQLData(); + $dummy,$component,$initialownerid,$initialqacontactid,$cdesc) = FetchSQLData(); + + my $initialowner = $initialownerid ? DBID_to_name ($initialownerid) : ''; + my $initialqacontact = $initialqacontactid ? DBID_to_name ($initialqacontactid) : ''; print "\n"; print "
\n"; #+++ display product/product description - EmitFormElements($product, $component, $initialowner, $initialqacontact, $cdesc); + EmitFormElements($product, $component, $initialownerid, $initialqacontactid, $cdesc); print "\n"; print " \n"; @@ -701,7 +730,7 @@ if ($action eq 'update') { # them, be sure to test for WHERE='$component' or WHERE='$componentold' SendSQL("LOCK TABLES bugs WRITE, - components WRITE"); + components WRITE, profiles READ"); if ($description ne $descriptionold) { unless ($description) { @@ -721,14 +750,21 @@ if ($action eq 'update') { if ($initialowner ne $initialownerold) { unless ($initialowner) { print "Sorry, I can't delete the initial owner."; - PutTrailer($localtrailer); SendSQL("UNLOCK TABLES"); + PutTrailer($localtrailer); exit; } - #+++ - #DBNameToIdAndCheck($initialowner, 0); + + my $initialownerid = DBname_to_id($initialowner); + unless ($initialownerid) { + print "Sorry, you must use an existing Bugzilla account as initial owner."; + SendSQL("UNLOCK TABLES"); + PutTrailer($localtrailer); + exit; + } + SendSQL("UPDATE components - SET initialowner=" . SqlQuote($initialowner) . " + SET initialowner=" . SqlQuote($initialownerid) . " WHERE program=" . SqlQuote($product) . " AND value=" . SqlQuote($componentold)); print "Updated initial owner.
\n"; @@ -737,14 +773,21 @@ if ($action eq 'update') { if (Param('useqacontact') && $initialqacontact ne $initialqacontactold) { unless ($initialqacontact) { print "Sorry, I can't delete the initial QA contact."; - PutTrailer($localtrailer); SendSQL("UNLOCK TABLES"); + PutTrailer($localtrailer); exit; } - #+++ - #DBNameToIdAndCheck($initialqacontact, 0); + + my $initialqacontactid = DBname_to_id($initialqacontact); + unless ($initialqacontactid) { + print "Sorry, you must use an existing Bugzilla account as initial QA contact."; + SendSQL("UNLOCK TABLES"); + PutTrailer($localtrailer); + exit; + } + SendSQL("UPDATE components - SET initialqacontact=" . SqlQuote($initialqacontact) . " + SET initialqacontact=" . SqlQuote($initialqacontactid) . " WHERE program=" . SqlQuote($product) . " AND value=" . SqlQuote($componentold)); print "Updated initial QA contact.
\n"; -- cgit v1.2.3-24-g4f1b
Bugs: