Patch for Assignation CVS diff

Alex L admin@networkessence.net
Sun, 7 Oct 2001 22:11:44 -0500


Here is a much more readable CVS diff report from the changes I made to my 
local whups to enable the assignation stuff to work:

[root horde]# cvs diff whups
cvs server: Diffing whups
cvs server: Diffing whups/config
cvs server: Diffing whups/docs
cvs server: Diffing whups/graphics
cvs server: Diffing whups/lib
Index: whups/lib/Backend.php
===================================================================
RCS file: /repository/whups/lib/Backend.php,v
retrieving revision 1.6
diff -u -r1.6 Backend.php
--- whups/lib/Backend.php       2001/09/05 21:07:48     1.6
+++ whups/lib/Backend.php       2001/10/08 03:14:03
@@ -65,10 +65,10 @@
     }
 
     function notifyAssignation(&$olddetails, &$comment, $ownername, 
$owneremail, $newstate) {
-        $mydetails = $this->getUserDetails(Auth::getAuth());
+        $mydetails = $this->getUserDetailsFromName(Auth::getAuth());
 
-        $myname = $mydetails['name'];
-        $myemail = $mydetails['email'];
+        $myname = $mydetails['whups_user_name'];
+        $myemail = $mydetails['whups_user_email'];
 
         $ticket_id = $olddetails['id'];
         $state_name = $this->getStateName($olddetails['type'], $newstate);
cvs server: Diffing whups/lib/Backend
Index: whups/lib/Backend/sql.php
===================================================================
RCS file: /repository/whups/lib/Backend/sql.php,v
retrieving revision 1.9
diff -u -r1.9 sql.php
--- whups/lib/Backend/sql.php   2001/10/06 18:59:26     1.9
+++ whups/lib/Backend/sql.php   2001/10/08 03:14:04
@@ -102,10 +102,9 @@
         $email = $info['assignee'];
         $state = $info['tostate'];
         $morecomment = $info['newcomment'];
-
         $details = $this->getUserDetailsFromEmail($email);
-        $assignee = $details['id'];
-        $name = $details['name'];
+        $assignee = $details['whups_user_id'];
+        $name = $details['whups_user_name'];
 
         $comment = "Assigned ticket to $name <$email>";
 
@@ -115,7 +114,7 @@
 
         $details = $this->getTicketDetails($ticket_id);
 
-        $this->_query("UPDATE ticket SET owner = $assignee, state = $state 
WHERE id = $ticket_id");
+        $this->_query("UPDATE whups_tickets SET user_id_owner = $assignee, 
state_id = $state WHERE ticket_id = $ticket_id");
         $new_comment_id = $this->_addComment($ticket_id, $comment, 
Auth::getAuth());
         $this->_updateStateLog($ticket_id, $details['state'], $state, 
Auth::getAuth(), $new_comment_id);
 
@@ -128,7 +127,7 @@
         $tostate = $info['state'];
         $type = $info['type'];
 
-        $this->_query("UPDATE ticket SET state = $tostate WHERE id = 
$ticket_id");
+        $this->_query("UPDATE whups_tickets SET state_id = $tostate WHERE 
ticket_id = $ticket_id");
         $new_comment_id = $this->_addComment($ticket_id, $newcomment, 
Auth::getAuth());
         $this->_updateStateLog($ticket_id, '', $tostate, Auth::getAuth(), 
$new_comment_id);
 
@@ -141,7 +140,7 @@
         $priority = $info['priority'];
         $type = $info['type'];
 
-        $this->_query("UPDATE ticket SET priority = $priority WHERE id = 
$ticket_id");
+        $this->_query("UPDATE whups_tickets SET priority_id = $priority WHERE 
ticket_id = $ticket_id");
         $new_comment_id = $this->_addComment($ticket_id, $newcomment, 
Auth::getAuth());
 
         $this->notifyPriorityChange($ticket_id, $type, $priority, $newcomment, 
Auth::getAuth());
@@ -234,8 +233,9 @@
         }
 
         if (!empty($result['user_id_owner'])) {
-            $result['_owner_name'] = $result['owner'];
-            $result['_owner'] = $result['owner'];
+            $user_id_owner = $this->getUserDetails($result['user_id_owner']);
+            $result['_owner_name'] = $user_id_owner['whups_user_name'];
+            $result['_owner'] = $user_id_owner['whups_user_name'];
         }
         
         return $result;
@@ -295,24 +295,31 @@
         return $this->_getOne("SELECT priority_name FROM whups_priorities 
WHERE type_id = $type AND priority_id = $priority");
     }
 
-    function getUserFromEmail($email)
+    function getUserFromEmail($email)    // Start User Backend
     {
         $email = $this->db->quote($email);
-        return $this->_getOne("SELECT id FROM user WHERE email = $email");
+        return $this->_getOne("SELECT whups_user_id FROM whups_users WHERE 
whups_user_email = $email");
     }
 
     function getUserDetails($id)
     {
-        $result = $this->_getAll("SELECT name, email FROM user WHERE id = 
$id");
+        $result = $this->_getAll("SELECT whups_user_name, whups_user_email 
FROM whups_users WHERE whups_user_id = $id");
         return $result[0];
     }
 
     function getUserDetailsFromEmail($email)
     {
-        $email = $this->db->quote($email);
-        $result = $this->_getAll("SELECT id, name FROM user WHERE email = 
$email");
+       $email = $this->db->quote($email);
+        $result = $this->_getAll("SELECT whups_user_id, whups_user_name FROM 
whups_users WHERE whups_user_email = $email");
         return $result[0];
     }
+
+    function getUserDetailsFromName($name)
+    {
+       $name = $this->db->quote($name);
+        $result = $this->_getAll("SELECT whups_user_name, whups_user_email 
FROM whups_users WHERE whups_user_name = $name");
+        return $result[0];
+    }    // End User Backend
 
     function getUserSearches($user)
     {
cvs server: Diffing whups/scripts
cvs server: Diffing whups/scripts/backend
cvs server: Diffing whups/templates
cvs server: Diffing whups/templates/index



-Alex


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/