[whups] SQL Fix

Jon Parise jon@horde.org
Sat, 6 Oct 2001 23:01:19 -0400


On Sat, Oct 06, 2001 at 07:10:19PM -0500, Alex L wrote:

> Problem in SQL backend driver for updating ticket state and priority state.
 
Should be fixed in cvs now.

-- 
Jon Parise (jon@csh.rit.edu)  .  Information Technology (2001)
http://www.csh.rit.edu/~jon/  :  Computer Science House Member


>From admin@networkessence.net Date: Sun,  7 Oct 2001 22:11:44 -0500
Return-Path: <admin@networkessence.net>
Mailing-List: contact whups-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list whups@lists.horde.org
Received: (qmail 10636 invoked from network); 8 Oct 2001 03:16:21 -0000
Received: from www.networkessence.net (HELO ns.networkessence.net) (root@216.40.211.25)
  by clark.horde.org with SMTP; 8 Oct 2001 03:16:21 -0000
Received: (from root@localhost)
	by ns.networkessence.net (8.10.2/8.10.2) id f983BjQ14738
	for whups@lists.horde.org; Sun, 7 Oct 2001 22:11:45 -0500
Received: from 65.112.179.66 ( [65.112.179.66])
	as user admin@127.0.0.1 by www.networkessence.net with HTTP;
	Sun,  7 Oct 2001 22:11:44 -0500
Message-ID: <1002510704.3bc11970bf598@www.networkessence.net>
Date: Sun,  7 Oct 2001 22:11:44 -0500
From: Alex L <admin@networkessence.net>
To: whups@lists.horde.org
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 2.3.7-cvs
X-Originating-IP: 65.112.179.66
Subject: Patch for Assignation CVS diff


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/


>From jan@horde.org Date: Mon,  8 Oct 2001 17:35:07 +0200
Return-Path: <jan@horde.org>
Mailing-List: contact whups-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list whups@lists.horde.org
Received: (qmail 55214 invoked from network); 8 Oct 2001 15:44:25 -0000
Received: from mailout01.sul.t-online.com (HELO mailout01.sul.t-online.de) (194.25.134.80)
  by clark.horde.org with SMTP; 8 Oct 2001 15:44:25 -0000
Received: from fwd04.sul.t-online.de 
	by mailout01.sul.t-online.de with smtp 
	id 15qcZs-0001tV-08; Mon, 08 Oct 2001 17:44:24 +0200
Received: from linux.wg.de (320034214675-0001@[217.0.157.79]) by fmrl04.sul.t-online.com
	with esmtp id 15qcZq-0yz0TZC; Mon, 8 Oct 2001 17:44:22 +0200
Received: from localhost (localhost [127.0.0.1])
	by linux.wg.de (8.11.0/8.11.0/SuSE Linux 8.11.0-0.4) with ESMTP id f98FZ8c19176
	for <whups@lists.horde.org>; Mon, 8 Oct 2001 17:35:08 +0200
Received: from 62.225.101.66 ( [62.225.101.66])
	as user jan@mail.wg.de by jan.dip.ammma.net with HTTP;
	Mon,  8 Oct 2001 17:35:07 +0200
Message-ID: <1002555307.3bc1c7ab674c5@jan.dip.ammma.net>
Date: Mon,  8 Oct 2001 17:35:07 +0200
From: Jan Schneider <jan@horde.org>
To: whups@lists.horde.org
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 2.3.7-cvs
X-Sender: 320034214675-0001@t-dialin.net
Subject: drop some tables

Hi, 

I think some of whups' tables should be dropped and their content hardcoded 
into the application. 
That is at least priorities, types and states. There's no horde app that keeps 
such entries in their backend storage and it makes it difficult to translate 
whups because we can't use gettext on the descriptions here. 

Jan.

:::::::::::::::::::::::::::::::::::::::: 
AMMMa AG - discover your knowledge
:::::::::::::::::::::::::::
Detmolder Str. 25-33 :: D-33604 Bielefeld
fon +49.521.96878-0 :: fax  +49.521.96878-20
http://www.ammma.de
::::::::::::::::::::::::::::::::::::::::::::::


>From chuck@horde.org Date: Mon,  8 Oct 2001 11:46:50 -0400
Return-Path: <chuck@horde.org>
Mailing-List: contact whups-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list whups@lists.horde.org
Received: (qmail 56413 invoked from network); 8 Oct 2001 15:47:24 -0000
Received: from h00104bc60b3c.ne.mediaone.net (HELO marina.horde.org) (24.91.198.7)
  by clark.horde.org with SMTP; 8 Oct 2001 15:47:24 -0000
Received: by marina.horde.org (Postfix, from userid 33)
	id 4E0EA39AD; Mon,  8 Oct 2001 11:46:50 -0400 (EDT)
Received: from 192.168.0.159 ( [192.168.0.159])
	as user chuck@localhost by marina.your.mom with HTTP;
	Mon,  8 Oct 2001 11:46:50 -0400
Message-ID: <1002556010.3bc1ca6a18985@marina.your.mom>
Date: Mon,  8 Oct 2001 11:46:50 -0400
From: Chuck Hagenbuch <chuck@horde.org>
To: whups@lists.horde.org
References: <1002555307.3bc1c7ab674c5@jan.dip.ammma.net>
In-Reply-To: <1002555307.3bc1c7ab674c5@jan.dip.ammma.net>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 2.3.7-cvs
Subject: Re: [whups] drop some tables

Quoting Jan Schneider <jan@horde.org>:

> I think some of whups' tables should be dropped and their content
> hardcoded into the application. 

Hmm. Not often you hear that. :)

> That is at least priorities, types and states. There's no horde app that keeps
> such entries in their backend storage and it makes it difficult to translate 
> whups because we can't use gettext on the descriptions here. 

Hmm. I can see that translation is an issue, but the point of Whups is to be 
flexible; if you hardcode these, you severely limit the customizability of the 
application. We do need a management system for them, of course, but that won't 
be hard to do.

-chuck

--
Charles Hagenbuch, <chuck@horde.org>
"What was and what may be lie, like children whose faces we cannot see, in the 
arms of silence. All we ever have is here, now." - Ursula K. Le Guin


>From admin@networkessence.net Date: Mon,  8 Oct 2001 10:49:45 -0500
Return-Path: <admin@networkessence.net>
Mailing-List: contact whups-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list whups@lists.horde.org
Received: (qmail 56642 invoked from network); 8 Oct 2001 15:54:25 -0000
Received: from www.networkessence.net (HELO ns.networkessence.net) (root@216.40.211.25)
  by clark.horde.org with SMTP; 8 Oct 2001 15:54:25 -0000
Received: (from root@localhost)
	by ns.networkessence.net (8.10.2/8.10.2) id f98Fnjq14085
	for whups@lists.horde.org; Mon, 8 Oct 2001 10:49:45 -0500
Received: from 65.112.179.11 ( [65.112.179.11])
	as user admin@127.0.0.1 by www.networkessence.net with HTTP;
	Mon,  8 Oct 2001 10:49:45 -0500
Message-ID: <1002556185.3bc1cb1956147@www.networkessence.net>
Date: Mon,  8 Oct 2001 10:49:45 -0500
From: Alex L <admin@networkessence.net>
To: whups@lists.horde.org
References: <1002555307.3bc1c7ab674c5@jan.dip.ammma.net>
In-Reply-To: <1002555307.3bc1c7ab674c5@jan.dip.ammma.net>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 2.3.7-cvs
X-Originating-IP: 65.112.179.11
Subject: Re: [whups] drop some tables

Quoting Jan Schneider <jan@horde.org>:

> Hi, 
> 
> I think some of whups' tables should be dropped and their content hardcoded
> 
> into the application. 
> That is at least priorities, types and states. There's no horde app that
> keeps 
> such entries in their backend storage and it makes it difficult to translate
> 
> whups because we can't use gettext on the descriptions here. 
> 

I would agree, except for maybe the types. I think it might be good to have the 
types in a config or something (or maybe that's what you were thinking).

-Alex

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


>From admin@networkessence.net Date: Mon,  8 Oct 2001 11:17:14 -0500
Return-Path: <admin@networkessence.net>
Mailing-List: contact whups-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list whups@lists.horde.org
Received: (qmail 57270 invoked from network); 8 Oct 2001 16:21:54 -0000
Received: from www.networkessence.net (HELO ns.networkessence.net) (root@216.40.211.25)
  by clark.horde.org with SMTP; 8 Oct 2001 16:21:54 -0000
Received: (from root@localhost)
	by ns.networkessence.net (8.10.2/8.10.2) id f98GHE315238
	for whups@lists.horde.org; Mon, 8 Oct 2001 11:17:14 -0500
Received: from 65.112.179.11 ( [65.112.179.11])
	as user admin@127.0.0.1 by www.networkessence.net with HTTP;
	Mon,  8 Oct 2001 11:17:14 -0500
Message-ID: <1002557834.3bc1d18a9f4e6@www.networkessence.net>
Date: Mon,  8 Oct 2001 11:17:14 -0500
From: Alex L <admin@networkessence.net>
To: whups@lists.horde.org
References: <1002555307.3bc1c7ab674c5@jan.dip.ammma.net> <1002556010.3bc1ca6a18985@marina.your.mom>
In-Reply-To: <1002556010.3bc1ca6a18985@marina.your.mom>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 2.3.7-cvs
X-Originating-IP: 65.112.179.11
Subject: Re: [whups] drop some tables

Quoting Chuck Hagenbuch <chuck@horde.org>:

> Quoting Jan Schneider <jan@horde.org>:

[snip]

> > such entries in their backend storage and it makes it difficult to
> translate 
> > whups because we can't use gettext on the descriptions here. 
> 
> Hmm. I can see that translation is an issue, but the point of Whups is to be
> 
> flexible; if you hardcode these, you severely limit the customizability of
> the 
> application. We do need a management system for them, of course, but that
> won't 
> be hard to do.
> 

That's all true. I also think that translating the content might not be the 
best thing. That would almost be like translating subject lines and the body of 
emails in IMP. It would be reasonable to allow language preference of the 
system like 'Search Tickets', 'Create Ticket', etc; but translating the 
content  

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


>From admin@networkessence.net Date: Mon,  8 Oct 2001 11:22:22 -0500
Return-Path: <admin@networkessence.net>
Mailing-List: contact whups-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list whups@lists.horde.org
Received: (qmail 57466 invoked from network); 8 Oct 2001 16:27:02 -0000
Received: from www.networkessence.net (HELO ns.networkessence.net) (root@216.40.211.25)
  by clark.horde.org with SMTP; 8 Oct 2001 16:27:02 -0000
Received: (from root@localhost)
	by ns.networkessence.net (8.10.2/8.10.2) id f98GMM315468
	for whups@lists.horde.org; Mon, 8 Oct 2001 11:22:22 -0500
Received: from 65.112.179.11 ( [65.112.179.11])
	as user admin@127.0.0.1 by www.networkessence.net with HTTP;
	Mon,  8 Oct 2001 11:22:22 -0500
Message-ID: <1002558142.3bc1d2bebc9a8@www.networkessence.net>
Date: Mon,  8 Oct 2001 11:22:22 -0500
From: Alex L <admin@networkessence.net>
To: whups@lists.horde.org
References: <1002555307.3bc1c7ab674c5@jan.dip.ammma.net> <1002556010.3bc1ca6a18985@marina.your.mom>
In-Reply-To: <1002556010.3bc1ca6a18985@marina.your.mom>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 2.3.7-cvs
X-Originating-IP: 65.112.179.11
Subject: Re: [whups] drop some tables

Quoting Chuck Hagenbuch <chuck@horde.org>:

> Quoting Jan Schneider <jan@horde.org>:

[snip]

> > such entries in their backend storage and it makes it difficult to
> translate 
> > whups because we can't use gettext on the descriptions here. 
> 
> Hmm. I can see that translation is an issue, but the point of Whups is to be
> 
> flexible; if you hardcode these, you severely limit the customizability of
> the 
> application. We do need a management system for them, of course, but that
> won't 
> be hard to do.
> 

I agree. I think that translating the content might not be the best thing. That 
would almost be like translating subject lines and the body of emails in IMP. 
It would be reasonable to allow language preference of the system like 'Search 
Tickets', 'Create Ticket', etc. I believe the types and states of tickets are 
like a subject of an email and are a part of the content and should be native 
to how they were originally written and not translated.

-Alex

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