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.1.2.6,1.1.2.7


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: todo/inc class.so.inc.php,1.1.2.6,1.1.2.7
Date: Thu, 19 Sep 2002 20:24:45 -0400

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

Modified Files:
      Tag: Version-0_9_14-branch
        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.1.2.6
retrieving revision 1.1.2.7
diff -C2 -r1.1.2.6 -r1.1.2.7
*** class.so.inc.php    25 Apr 2002 01:51:25 -0000      1.1.2.6
--- class.so.inc.php    20 Sep 2002 00:24:40 -0000      1.1.2.7
***************
*** 120,141 ****
                        while ($this->db->next_record())
                        {
!                               $todos[] = array(
!                                       'id'       => 
(int)$this->db->f('todo_id'),
!                                       'main'     => 
(int)$this->db->f('todo_id_main'),
!                                       'parent'   => 
(int)$this->db->f('todo_id_parent'),
!                                       'level'    => 
(int)$this->db->f('todo_level'),
!                                       'owner'    => 
$this->db->f('todo_owner'),
!                                       'owner_id' => 
$this->db->f('todo_owner'),
!                                       'access'   => 
$this->db->f('todo_access'),
!                                       'cat'      => 
(int)$this->db->f('todo_cat'),
!                                       'title'    => 
$this->db->f('todo_title'),
!                                       'descr'    => $this->db->f('todo_des'),
!                                       'pri'      => 
(int)$this->db->f('todo_pri'),
!                                       'status'   => 
(int)$this->db->f('todo_status'),
!                                       'sdate'    => 
$this->db->f('todo_startdate'),
!                                       'edate'    => 
$this->db->f('todo_enddate'),
!                                       'grants'   => 
(int)$this->grants[$this->db->f('todo_owner')],
!                                       'sdate_epoch' => 
(int)$this->db->f('todo_startdate'),
!                                       'edate_epoch' => 
(int)$this->db->f('todo_enddate')
                                );
                        }
--- 120,142 ----
                        while ($this->db->next_record())
                        {
!                               $todos[] = array
!                               (
!                                       'id'                    => 
(int)$this->db->f('todo_id'),
!                                       'main'                  => 
(int)$this->db->f('todo_id_main'),
!                                       'parent'                => 
(int)$this->db->f('todo_id_parent'),
!                                       'level'                 => 
(int)$this->db->f('todo_level'),
!                                       'owner'                 => 
$this->db->f('todo_owner'),
!                                       'owner_id'              => 
$this->db->f('todo_owner'),
!                                       'access'                => 
$this->db->f('todo_access'),
!                                       'cat'                   => 
(int)$this->db->f('todo_cat'),
!                                       'title'                 => 
$this->db->f('todo_title'),
!                                       'descr'                 => 
$this->db->f('todo_des'),
!                                       'pri'                   => 
(int)$this->db->f('todo_pri'),
!                                       'status'                => 
(int)$this->db->f('todo_status'),
!                                       'sdate'                 => 
$this->db->f('todo_startdate'),
!                                       'edate'                 => 
$this->db->f('todo_enddate'),
!                                       'grants'                => 
(int)$this->grants[$this->db->f('todo_owner')],
!                                       'sdate_epoch'   => 
(int)$this->db->f('todo_startdate'),
!                                       'edate_epoch'   => 
(int)$this->db->f('todo_enddate')
                                );
                        }
***************
*** 242,255 ****
                }
  
                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->owner . "') or 
(todo_owner='" . $this->owner . "'))",__LINE__,__FILE__);
                        $this->historylog->delete($todo_id);
                        $this->db->transaction_commit();
--- 243,299 ----
                }
  
+               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='$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();
***************
*** 313,316 ****
--- 357,376 ----
                                . "', todo_cat='" . $values['cat'] . "' where 
todo_id='" . $values['id']
                                . "'",__LINE__,__FILE__);
+                       if (($old_values['level'] != $values['level']) || 
($old_values['main'] != $values['main']))
+                       {
+                               $sub_todos = $this->find_subs("'$values[id]'");
+                               if ($sub_todos)
+                               {
+                                       if ($old_values['main'] != 
$values['main'])
+                                       {
+                                               $this->db->query("update 
phpgw_todo set todo_id_main='" . $values['main'] . "' where todo_id in 
($sub_todos)",__LINE__,__FILE__);
+                                       }
+                                       if ($old_values['level'] != 
$values['level'])
+                                       {
+                                               $this->db->query("update 
phpgw_todo set todo_level=todo_level+" . ($values['level'] - 
$old_values['level'])
+                                                       ." where todo_id in 
($sub_todos)",__LINE__,__FILE__);
+                                       }
+                               }
+                       }
                        $this->db->transaction_commit();
                }
***************
*** 322,325 ****
--- 382,386 ----
                                case 'main':    $item = 'todo_id_main'; break;
                                case 'level':   $item = 'todo_level'; break;
+                               case 'parent':  $item = 'todo_id_parent'; break;
                        }
  





reply via email to

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