From 88d26275229b5f52f435130496169766313c87b7 Mon Sep 17 00:00:00 2001 From: "bugreport%peshkin.net" <> Date: Sat, 21 Aug 2004 04:49:17 +0000 Subject: Bug 224208 Add a higher level of categorization (.ie departments, locations, etc.) patch by Albert Ting r=joel, glob a=myk --- editproducts.cgi | 225 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 193 insertions(+), 32 deletions(-) (limited to 'editproducts.cgi') diff --git a/editproducts.cgi b/editproducts.cgi index bd71bdd6d..74a62166e 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -86,20 +86,80 @@ sub CheckProduct ($) } } +# TestClassification: just returns if the specified classification does exists +# CheckClassification: same check, optionally emit an error text + +sub TestClassification ($) +{ + my $cl = shift; + + # does the classification exist? + SendSQL("SELECT name + FROM classifications + WHERE name=" . SqlQuote($cl)); + return FetchOneColumn(); +} + +sub CheckClassification ($) +{ + my $cl = shift; + + # do we have a classification? + unless ($cl) { + print "Sorry, you haven't specified a classification."; + PutTrailer(); + exit; + } + + unless (TestClassification $cl) { + print "Sorry, classification '$cl' does not exist."; + PutTrailer(); + exit; + } +} + +sub CheckClassificationProduct ($$) +{ + my $cl = shift; + my $prod = shift; + + CheckClassification($cl); + CheckProduct($prod); + + # does the classification exist? + SendSQL("SELECT products.name + FROM products,classifications + WHERE products.name=" . SqlQuote($prod) . + " AND classifications.name=" . SqlQuote($cl)); + my $res = FetchOneColumn(); + + unless ($res) { + print "Sorry, classification->product '$cl'->'$prod' does not exist."; + PutTrailer(); + exit; + } +} + # # Displays the form to edit a products parameters # -sub EmitFormElements ($$$$$$$$) +sub EmitFormElements ($$$$$$$$$) { - my ($product, $description, $milestoneurl, $disallownew, + my ($classification, $product, $description, $milestoneurl, $disallownew, $votesperuser, $maxvotesperbug, $votestoconfirm, $defaultmilestone) = @_; $product = value_quote($product); $description = value_quote($description); + if (Param('useclassification')) { + print "
Edit products of ... | \n"; + print "Description | \n"; + print "Total | \n"; + print "
---|---|---|
$classification | \n"; + print "$description | \n"; + $count ||= "none"; + print "$count | \n"; + } + print "
Edit product ... | \n"; print "Description | \n"; @@ -231,19 +351,19 @@ unless ($action) { $disallownew = $disallownew ? 'closed' : 'open'; $bugs ||= 'none'; print "||||||||
---|---|---|---|---|---|---|---|---|---|
$product | \n"; + print "$product | \n"; print "$description | \n"; print "$disallownew | \n"; print "$votesperuser | \n"; print "$maxvotesperbug | \n"; print "$votestoconfirm | \n"; print "$bugs | \n"; - print "Delete | \n"; + print "Delete | \n"; print "
Add a new product | \n"; - print "Add | \n"; + print "Add | \n"; print "