[AppDB] fix backlinks when sending bug link email (resend)

Tony Lambregts tony.lambregts at gmail.com
Wed Jul 13 23:58:57 CDT 2005


Sent the wrong file last time (Doh!)

This is sort of a hack to fix what should work. I also fixed up some messages
when we OK or delete a bug link.

Change Log: Hack a fix for "$this->iLinkId = mysql_insert_id();" not working...
Files Changed: include/bugs.php





-------------- next part --------------
Index: include/bugs.php
===================================================================
RCS file: /home/wine/appdb/include/bugs.php,v
retrieving revision 1.1
diff -u -r1.1 bugs.php
--- include/bugs.php	13 Jul 2005 01:13:46 -0000	1.1
+++ include/bugs.php	14 Jul 2005 04:04:15 -0000
@@ -87,7 +87,7 @@
         $sQuery = "SELECT *
                    FROM bugs 
                    WHERE bug_id = ".$iBug_id;
-        if(!($hResult = query_bugzilladb($sQuery)))
+        if(mysql_num_rows(query_bugzilladb($sQuery, "checking bugzilla")) == 0)
         {
             addmsg("There is no bug in Bugzilla with that bug number.", "red");
             return false;
@@ -98,7 +98,7 @@
         $sQuery = "SELECT *
                    FROM buglinks 
                    WHERE versionId = ".$iVersionId;
-        if($hResult = query_appdb($sQuery))
+        if($hResult = query_appdb($sQuery,"looking for duplicates"))
         {
             while($oRow = mysql_fetch_object($hResult))
             {
@@ -108,7 +108,7 @@
                    return false;
                 }
             }
-        } 
+        }
 
         /* passed the checks so lets insert the puppy! */
 
@@ -120,8 +120,23 @@
         $sValues = "({$aInsert['VALUES']})";
         if(query_appdb("INSERT INTO buglinks $sFields VALUES $sValues", "Error while creating a new Bug link."))
         {
+            /* The following should work but it does not! */
             $this->iLinkId = mysql_insert_id();
             $this->bug($this->iLinkId);
+
+            /* Start of hack to get around the previous not working */
+            $sQuery = "SELECT buglinks.*, appVersion.appId AS appId
+                       FROM buglinks, appVersion 
+                       WHERE buglinks.versionId = appVersion.versionId 
+                       AND buglinks.versionId = ".$iVersionId."
+                       AND buglinks.bug_id = ".$iBug_id;
+            if($hResult = query_appdb($sQuery))
+            {
+                $oRow = mysql_fetch_object($hResult);
+                $this->bug($oRow->linkId);
+            }
+            /*End of Hack */
+
             $this->mailMaintainers();
             return true;
         }else
@@ -182,11 +197,11 @@
             if(!$bRejected)
             {
                 $sSubject =  "Submitted Bug Link accepted";
-                $sMsg  = "The Bug Link you submitted for ".lookup_app_name($this->appId)." ".lookup_version_name($this->versionId)." has been accepted.";
+                $sMsg  = "The Bug Link you submitted for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been accepted.";
             } else
             {
                  $sSubject =  "Submitted Bug Link rejected";
-                 $sMsg  = "The Bug Link you submitted for ".lookup_app_name($this->appId)." ".lookup_version_name($this->versionId)." has been rejected.";
+                 $sMsg  = "The Bug Link you submitted for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been rejected.";
             }
             $sMsg .= $_REQUEST['replyText']."\n";
             $sMsg .= "We appreciate your help in making the Application Database better for all users.";
@@ -217,7 +232,7 @@
                 $sMsg  = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
                 $sMsg .= "This Bug Link has been queued.";
                 $sMsg .= "\n";
-                addmsg("The Bug Link you submitted will be added to the database database after being reviewed.", "green");
+                addmsg("The Bug Link you submitted will be added to the database after being reviewed.", "green");
             }
         } else // Bug Link deleted.
         {


More information about the wine-patches mailing list