]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 86051: Enable changing product name case.
authorjouni%heikniemi.net <>
Tue, 20 Jul 2004 12:06:18 +0000 (12:06 +0000)
committerjouni%heikniemi.net <>
Tue, 20 Jul 2004 12:06:18 +0000 (12:06 +0000)
Patch by GavinS <bugzilla@chimpychompy.org>
r=jouni, a=justdave

editproducts.cgi

index c539465af0480c8b0edce33a626be539249b0b02..17bcfd703874d19dc4d66fad63d28f9923f90a97 100755 (executable)
@@ -306,13 +306,27 @@ if ($action eq 'new') {
         PutTrailer($localtrailer);
         exit;
     }
-    if (TestProduct($product)) {
+
+    my $existing_product = TestProduct($product);
+
+    # Check for exact case sensitive match:
+    if ($existing_product eq $product) {
         print "The product '$product' already exists. Please press\n";
         print "<b>Back</b> and try again.\n";
         PutTrailer($localtrailer);
         exit;
     }
 
+    # Next check for a case-insensitive match:
+    if (lc($existing_product) eq lc($product)) {
+        print "The new product '$product' differs from existing product ";
+        print "'$existing_product' only in case. Please press\n";
+        print "<b>Back</b> and try again.\n";
+        PutTrailer($localtrailer);
+        exit;
+    }
+
+
     my $version = trim($::FORM{version} || '');
 
     if ($version eq '') {
@@ -1190,7 +1204,9 @@ if ($action eq 'update') {
             PutTrailer($localtrailer);
             exit;
         }
-        if (TestProduct($product)) {
+
+        if (lc($product) ne lc($productold) &&
+            TestProduct($product)) {
             print "Sorry, product name '$product' is already in use.";
             SendSQL("UNLOCK TABLES");
             PutTrailer($localtrailer);