phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: todo/inc class.so.inc.php,1.9,1.10


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: todo/inc class.so.inc.php,1.9,1.10
Date: Thu, 19 Sep 2002 20:41:12 -0400

Update of /cvsroot/phpgroupware/todo/inc
In directory subversions:/tmp/cvs-serv25621

Modified Files:
        class.so.inc.php 
Log Message:
patch 235

Index: class.so.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/todo/inc/class.so.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** class.so.inc.php    7 May 2002 13:15:29 -0000       1.9
--- class.so.inc.php    20 Sep 2002 00:41:10 -0000      1.10
***************
*** 233,246 ****
                }
  
                function delete_todo($todo_id, $sub = False)
                {
                        $this->db->transaction_begin();
!                       if($sub)
                        {
!                               $subdelete = " or todo_id_parent='$todo_id' or 
todo_id_main='$todo_id' ";
                        }
  
!                       $this->db->query("delete from phpgw_todo where 
todo_id='$todo_id' $subdelete and ((todo_access='public' "
!                               . "and todo_owner != '" . $this->account . "') 
or (todo_owner='" . $this->account . "'))",__LINE__,__FILE__);
                        $this->historylog->delete($todo_id);
                        $this->db->transaction_commit();
--- 233,289 ----
                }
  
+               function find_subs($list_parents='', $list='')
+               {
+                       if ($list_parents == '')
+                       {
+                               return $list;
+                       }
+                       $query = "SELECT todo_id FROM phpgw_todo WHERE 
todo_id_parent IN ($list_parents)";
+                       if ($list <> '')
+                       {
+                               $query .= " AND todo_id NOT IN ($list)";
+                       }
+                       $this->db->query($query,__LINE__,__FILE__);
+                       $subs = array();
+                       while ($this->db->next_record())
+                       {
+                               $subs[] = $this->db->f('todo_id');
+                       }
+                       if (count($subs))
+                       {
+                               $list_subs = implode(',', $subs);
+                               if ($list <> '')
+                               {
+                                       $list .= ',';
+                               }
+                               $list = $this->find_subs($list_subs, $list . 
$list_subs);
+                       }
+                       return $list;
+               }
+ 
                function delete_todo($todo_id, $sub = False)
                {
                        $this->db->transaction_begin();
!                       $sub_todos = $this->find_subs($todo_id);
!                       if ($sub_todos)
                        {
!                               if($sub)
!                               {
!                                       $subdelete = " OR todo_id in 
($sub_todos)";
!                               }
!                               else
!                               {
!                                       $parent = 
$this->return_value($todo_id,'parent');
!                               }
                        }
  
!                       $this->db->query('DELETE from phpgw_todo where 
todo_id=' . intval($todo_id) . $subdelete . " AND ((todo_access='public' "
!                                                       . 'AND todo_owner != ' 
. $this->owner . ') OR (todo_owner=' . $this->owner . '))',__LINE__,__FILE__);
! 
!                       if (!$sub && $sub_todos)
!                       {
!                               $this->db->query('UPDATE phpgw_todo set 
todo_id_parent=' . $parent . ' where todo_id_parent=' . 
$todo_id,__LINE__,__FILE__);
!                               $this->db->query("UPDATE phpgw_todo set 
todo_level=todo_level-1 where todo_id in ($sub_todos)",__LINE__,__FILE__);
!                       }
                        $this->historylog->delete($todo_id);
                        $this->db->transaction_commit();





reply via email to

[Prev in Thread] Current Thread [Next in Thread]