phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: projects/inc class.boprojects.inc.php, 1.42.2.5.


From: Bettina Gille <address@hidden>
Subject: [Phpgroupware-cvs] CVS: projects/inc class.boprojects.inc.php, 1.42.2.5.2.19, 1.42.2.5.2.20 class.soprojects.inc.php, 1.34.2.6.2.19, 1.34.2.6.2.20 class.uiprojects.inc.php, 1.47.2.7.2.21, 1.47.2.7.2.22
Date: Thu, 24 Jul 2003 21:09:43 -0400

Update of /cvsroot/phpgroupware/projects/inc
In directory subversions:/tmp/cvs-serv688/inc

Modified Files:
      Tag: Version-0_9_16-branch
        class.boprojects.inc.php class.soprojects.inc.php 
        class.uiprojects.inc.php 
Log Message:
update projects tree

Index: class.boprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.boprojects.inc.php,v
retrieving revision 1.42.2.5.2.19
retrieving revision 1.42.2.5.2.20
diff -C2 -r1.42.2.5.2.19 -r1.42.2.5.2.20
*** class.boprojects.inc.php    20 Jun 2003 22:04:32 -0000      1.42.2.5.2.19
--- class.boprojects.inc.php    25 Jul 2003 01:09:38 -0000      1.42.2.5.2.20
***************
*** 75,78 ****
--- 75,79 ----
                        $this->sohours  = 
CreateObject('projects.soprojecthours');
                        $this->contacts = CreateObject('phpgwapi.contacts');
+                       $this->cats             = 
CreateObject('phpgwapi.categories');
  
                        if ($session)
***************
*** 392,398 ****
                }
  
!               function list_projects($start, $limit, $query, $filter, $sort, 
$order, $status, $cat_id, $type, $pro_parent)
                {
!                       $pro_list = $this->so->read_projects($start, $limit, 
$query, $filter, $sort, $order, $status, $cat_id, $type, $pro_parent);
  
                        while (is_array($pro_list) && 
list(,$pro)=each($pro_list))
--- 393,411 ----
                }
  
!               function list_projects($type, $parent)
                {
!                       $pro_list = $this->so->read_projects(array
!                                                                       (
!                                                                               
'start'         => $this->start,
!                                                                               
'limit'         => True,
!                                                                               
'query'         => $this->query,
!                                                                               
'filter'        => $this->filter,
!                                                                               
'sort'          => $this->sort,
!                                                                               
'order'         => $this->order,
!                                                                               
'status'        => $this->status,
!                                                                               
'cat_id'        => $this->cat_id,
!                                                                               
'type'          => $type,
!                                                                               
'parent'        => $parent
!                                                                       ));
  
                        while (is_array($pro_list) && 
list(,$pro)=each($pro_list))
***************
*** 806,813 ****
                }
  
!               function select_project_list($type, $status, $project_id)
                {
!                       $list = $this->so->select_project_list($type, $status, 
$project_id);
!                       return $list;
                }
  
--- 819,825 ----
                }
  
!               function select_project_list($values)
                {
!                       return $this->so->select_project_list($values);
                }
  

Index: class.soprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.soprojects.inc.php,v
retrieving revision 1.34.2.6.2.19
retrieving revision 1.34.2.6.2.20
diff -C2 -r1.34.2.6.2.19 -r1.34.2.6.2.20
*** class.soprojects.inc.php    20 Jun 2003 22:04:32 -0000      1.34.2.6.2.19
--- class.soprojects.inc.php    25 Jul 2003 01:09:39 -0000      1.34.2.6.2.20
***************
*** 89,93 ****
                                        'udate'                 => 
$this->db->f('entry_date'),
                                        'investment_nr' => 
$this->db->f('investment_nr'),
!                                       'pcosts'                => 
$this->db->f('pcosts')
                                );
                        }
--- 89,95 ----
                                        'udate'                 => 
$this->db->f('entry_date'),
                                        'investment_nr' => 
$this->db->f('investment_nr'),
!                                       'pcosts'                => 
$this->db->f('pcosts'),
!                                       'main'                  => 
$this->db->f('main'),
!                                       'level'                 => 
$this->db->f('level')
                                );
                        }
***************
*** 96,105 ****
  
  
!               function read_projects($start = '', $limit = True, $query = '', 
$filter = '', $sort = '', $order = '', $status = '', $cat_id = '', $type = 
'mains', $pro_parent = '')
                {
!                       $start          = intval($start);
!                       $cat_id         = intval($cat_id);
!                       $pro_parent = intval($pro_parent);
!                       $query          = $this->db->db_addslashes($query);
  
                        if ($status)
--- 98,115 ----
  
  
!               function read_projects($values)
                {
!                       $start  = intval($values['start']);
!                       $limit  = 
(isset($values['limit'])?$values['limit']:True);
!                       $filter = 
(isset($values['filter'])?$values['filter']:'none');
!                       $sort   = 
(isset($values['sort'])?$values['sort']:'ASC');
!                       $order  = $values['order'];
!                       $type   = 
(isset($values['type'])?$values['type']:'mains');
! 
!                       $cat_id = intval($values['cat_id']);
!                       $main   = intval($values['main']);
!                       $parent = intval($values['parent']);
! 
!                       $query  = $this->db->db_addslashes($values['query']);
  
                        if ($status)
***************
*** 112,132 ****
                        }
  
-                       if (!$sort)
-                       {
-                               $sort = 'ASC';
-                       }
- 
                        if ($order)
                        {
!                               $ordermethod = "order by $order $sort";
                        }
                        else
                        {
!                               $ordermethod = 'order by start_date asc';
!                       }
! 
!                       if (! $filter)
!                       {
!                               $filter = 'none';
                        }
  
--- 122,132 ----
                        }
  
                        if ($order)
                        {
!                               $ordermethod = " order by $order $sort";
                        }
                        else
                        {
!                               $ordermethod = ' order by start_date asc';
                        }
  
***************
*** 172,179 ****
                        switch($type)
                        {
!                               case 'mains':
!                               case 'amains':  $filtermethod .= ' AND parent = 
0 '; break;
!                               case 'subs' :
!                               case 'asubs':   $filtermethod .= ' AND parent 
=' . $pro_parent . ' AND parent != 0 '; break;
                        }
  
--- 172,180 ----
                        switch($type)
                        {
!                               case 'amains':
!                               case 'mains':           $parent_select = ' AND 
parent=0'; break;
!                               case 'asubs':
!                               case 'subs':            $parent_select = ' AND 
(parent=' . $parent . ' AND parent != 0)'; break;
!                               case 'mainandsubs':     $parent_select = ' AND 
main=' . $main; break;
                        }
  
***************
*** 185,201 ****
                        $sql = "SELECT * from phpgw_p_projects WHERE 
$filtermethod $statussort $querymethod";
  
!                       $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
  
                        if ($limit)
                        {
!                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
                        }
                        else
                        {
!                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
  
!                       return $this->db2projects();
                }
  
--- 186,236 ----
                        $sql = "SELECT * from phpgw_p_projects WHERE 
$filtermethod $statussort $querymethod";
  
!                       $this->db2->query($sql . 
$parent_select,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
  
                        if ($limit)
                        {
!                               $this->db->limit_query($sql . $parent_select . 
$ordermethod,$start,__LINE__,__FILE__);
                        }
                        else
                        {
!                               $this->db->query($sql . $parent_select . 
$ordermethod,__LINE__,__FILE__);
                        }
  
!                       $pro = $this->db2projects();
! 
!                       if ($main == 0 && $type != 'mains' && $type != 'amains')
!                       {
!                               $num_pro = count($pro);
!                               for ($i=0;$i < $num_pro;$i++)
!                               {
!                                       $sub_select = ' AND parent=' . 
$pro[$i]['project_id'] . ' AND level=' . ($pro[$i]['level']+1);
! 
!                                       $this->db->query($sql . $sub_select . 
$ordermethod,__LINE__,__FILE__);
! 
!                                       $subpro = $this->db2projects();
! 
!                                       $num_subpro = count($subpro);
!                                       if ($num_subpro != 0)
!                                       {
!                                               $newpro = array();
!                                               for ($k = 0; $k <= $i; $k++)
!                                               {
!                                                       $newpro[$k] = $pro[$k];
!                                               }
!                                               for ($k = 0; $k < $num_subpro; 
$k++)
!                                               {
!                                                       $newpro[$k+$i+1] = 
$subpro[$k];
!                                               }
!                                               for ($k = $i+1; $k < $num_pro; 
$k++)
!                                               {
!                                                       $newpro[$k+$num_subpro] 
= $pro[$k];
!                                               }
!                                               $pro = $newpro;
!                                               $num_pro = count($pro);
!                                       }
!                               }
!                       }
!                       return $pro;
                }
  
***************
*** 204,261 ****
                        $this->db->query('SELECT * from phpgw_p_projects WHERE 
id=' . $project_id,__LINE__,__FILE__);
        
!                       $project = $this->db2projects();
! 
!                       if (is_array($project) && list(,$pro) = each($project))
!                       {
!                               $p = array
!                               (
!                                       'project_id'    => $pro['project_id'],
!                                       'owner'                 => 
$pro['owner'],
!                                       'parent'                => 
$pro['parent'],
!                                       'number'                => 
$pro['number'],
!                                       'access'                => 
$pro['access'],
!                                       'cat'                   => $pro['cat'],
!                                       'sdate'                 => 
$pro['sdate'],
!                                       'edate'                 => 
$pro['edate'],
!                                       'coordinator'   => $pro['coordinator'],
!                                       'customer'              => 
$pro['customer'],
!                                       'status'                => 
$pro['status'],
!                                       'descr'                 => 
$pro['descr'],
!                                       'title'                 => 
$pro['title'],
!                                       'budget'                => 
$pro['budget'],
!                                       'ptime'                 => 
$pro['ptime'],
!                                       'udate'                 => 
$pro['udate'],
!                                       'cdate'                 => 
$pro['cdate'],
!                                       'processor'             => 
$pro['processor'],
!                                       'investment_nr' => 
$pro['investment_nr'],
!                                       'pcosts'                => 
$pro['pcosts']
!                               );
!                               return $p;
!                       }
                }
  
!               function select_project_list($type, $status, $selected = '')
                {
!                       $projects = $this->read_projects($start, False, $query, 
$filter, $sort, $order, $status, $cat_id, $type);
  
!                       for ($i=0;$i<count($projects);$i++)
                        {
!                               $pro_select .= '<option value="' . 
$projects[$i]['project_id'] . '"';
!                               if ($projects[$i]['project_id'] == $selected)
                                {
!                                       $pro_select .= ' selected';
                                }
!                               if ($projects[$i]['title'])
                                {
!                                       $pro_select .= '>' . 
$GLOBALS['phpgw']->strip_html($projects[$i]['title']) . ' [ '
!                                                               . 
$GLOBALS['phpgw']->strip_html($projects[$i]['number']) . ' ]';
                                }
                                else
                                {
!                                       $pro_select .= '>' . 
$GLOBALS['phpgw']->strip_html($projects[$i]['number']);
                                }
!                               $pro_select .= '</option>';
                        }
!                       return $pro_select;
                }
  
--- 239,293 ----
                        $this->db->query('SELECT * from phpgw_p_projects WHERE 
id=' . $project_id,__LINE__,__FILE__);
        
!                       list($project) = $this->db2projects();
!                       return $project;
                }
  
!               function select_project_list($values)
                {
!                       $pro = $this->read_projects(array
!                                               (
!                                                       'limit'         => 
False,
!                                                       'status'        => 
$values['status'],
!                                                       'type'          => 
(isset($values['type'])?$values['type']:'mains'),
!                                                       'main'          => 
$values['main'],
!                                               ));
  
!                       if($values['self'])
                        {
!                               for ($i=0;$i<count($pro);$i++)
                                {
!                                       if ($pro[$i]['project_id'] == 
$values['self'])
!                                       {
!                                               unset($pro[$i]);
!                                       }
                                }
!                       }
! 
!                       while (is_array($pro) && list(,$p) = each($pro))
!                       {
!                               $s .= '<option value="' . $p['project_id'] . 
'"';
!                               if ($p['project_id'] == $values['selected'])
!                               {
!                                       $s .= ' selected';
!                               }
!                               $s .= '>';
! 
!                               for ($j=0;$j<$p['level'];$j++)
!                               {
!                                       $s .= '&nbsp;.&nbsp;';
!                               }
! 
!                               if ($p['title'])
                                {
!                                       $s .= 
$GLOBALS['phpgw']->strip_html($p['title']) . ' [ '
!                                                               . 
$GLOBALS['phpgw']->strip_html($p['number']) . ' ]';
                                }
                                else
                                {
!                                       $s .= 
$GLOBALS['phpgw']->strip_html($p['number']);
                                }
!                               $s .= '</option>';
                        }
!                       return $s;
                }
  
***************
*** 270,283 ****
                        $values['pcosts']                       = 
$values['pcosts'] + 0.0;
  
                        $table = 'phpgw_p_projects';
                        $this->db->lock($table);
  
                        $this->db->query('INSERT into phpgw_p_projects 
(owner,access,category,entry_date,start_date,end_date,coordinator,customer,status,'
!                                                       . 
'descr,title,budget,num,parent,time_planned,date_created,processor,investment_nr,pcosts)
 VALUES (' . $this->account
                                                        . ",'" . 
$values['access'] . "'," . intval($values['cat']) . ',' . time() . ',' . 
intval($values['sdate']) . ','
                                                        . 
intval($values['edate']) . ',' . intval($values['coordinator']) . ',' . 
intval($values['customer']) . ",'" . $values['status']
                                                        . "','" . 
$values['descr'] . "','" . $values['title'] . "'," . $values['budget'] . ",'" . 
$values['number'] . "',"
                                                        . 
intval($values['parent']) . ',' . intval($values['ptime']) . ',' . time() . ',' 
. $this->account . ",'" . $values['investment_nr']
!                                                       . "'," . 
$values['pcosts'] . ')',__LINE__,__FILE__);
  
                        /*$this->db->query("SELECT max(id) FROM 
phpgw_p_projects");
--- 302,321 ----
                        $values['pcosts']                       = 
$values['pcosts'] + 0.0;
  
+                       if ($values['parent'] && $values['parent'] != 0)
+                       {
+                               $values['main']         = 
intval($this->id2item(array('project_id' => $values['parent'],'item' => 
'main')));
+                               $values['level']        = 
intval($this->id2item(array('project_id' => $values['parent'],'item' => 
'level'))+1);
+                       }
+ 
                        $table = 'phpgw_p_projects';
                        $this->db->lock($table);
  
                        $this->db->query('INSERT into phpgw_p_projects 
(owner,access,category,entry_date,start_date,end_date,coordinator,customer,status,'
!                                                       . 
'descr,title,budget,num,parent,time_planned,date_created,processor,investment_nr,pcosts,main,level)
 VALUES (' . $this->account
                                                        . ",'" . 
$values['access'] . "'," . intval($values['cat']) . ',' . time() . ',' . 
intval($values['sdate']) . ','
                                                        . 
intval($values['edate']) . ',' . intval($values['coordinator']) . ',' . 
intval($values['customer']) . ",'" . $values['status']
                                                        . "','" . 
$values['descr'] . "','" . $values['title'] . "'," . $values['budget'] . ",'" . 
$values['number'] . "',"
                                                        . 
intval($values['parent']) . ',' . intval($values['ptime']) . ',' . time() . ',' 
. $this->account . ",'" . $values['investment_nr']
!                                                       . "'," . 
$values['pcosts'] . ',' . intval($values['main']) . ',' . 
intval($values['level']) . ')',__LINE__,__FILE__);
  
                        /*$this->db->query("SELECT max(id) FROM 
phpgw_p_projects");
***************
*** 292,295 ****
--- 330,338 ----
                        if ($p_id && ($p_id != 0))
                        {
+                               if (!$values['parent'] || $values['parent'] == 
0)
+                               {
+                                       $this->db->query('UPDATE 
phpgw_p_projects SET main=' . $p_id . ' WHERE id=' . $p_id,__LINE__,__FILE__);
+                               }
+ 
                                if (is_array($book_activities))
                                {
***************
*** 320,323 ****
--- 363,430 ----
                }
  
+               function subs($parent,&$subs,&$main)
+               {
+                       if (!is_array($main))
+                       {
+                               $this->db->query('SELECT * from 
phpgw_p_projects WHERE main=' . $main,__LINE__,__FILE__);
+                               $main = $this->db2projects();
+                               //echo "main: "; _debug_array($main);
+                       }
+                       reset($main);
+                       for ($n = 0; $n < count($main); $n++)
+                       {
+                               $pro = $main[$n];
+                               if ($pro['parent'] == $parent)
+                               {
+                                       //echo "Adding($pro[project_id])<br>";
+                                       $subs[$pro['project_id']] = $pro;
+                                       
$this->subs($pro['project_id'],$pro,$main);
+                               }
+                       }
+               }
+ 
+               function reparent($values)
+               {
+                       $id = $values['project_id'];
+                       $parent = $values['parent'];
+                       $old_parent = $values['old_parent'];
+                       $main = $old_parent ? 
intval($this->id2name($old_parent,'main')) : $id;
+                       //echo "<p>reparent: $id/$main: $old_parent --> 
$parent</p>\n";
+ 
+                       $subs = array();
+                       $this->subs($id,$subs,$main);
+          //echo "<p>subs($id) = "; _debug_array($subs);
+ 
+                       if (isset($subs[$parent]))
+                       {
+                               //echo "<p>new parent $parent is sub of 
$id</p>\n";
+                               $parent = $subs[$parent];
+                               $parent['old_parent'] = $parent['parent'];
+                               $parent['parent'] = 
intval($values['old_parent']);
+                               $this->reparent($parent);
+ 
+                               unset($parent['old_parent']);
+                               unset($parent['main']);
+ 
+                               $this->edit_project($parent);
+                               $this->reparent($values);
+                               return;
+                       }
+ 
+                       $new_main = $parent ? $this->id2name($parent,'main') : 
$id;
+                       $new_parent_level = $parent ? 
$this->id2name($parent,'level') : -1;
+                       $old_parent_level = $old_parent ? 
$this->id2name($old_parent,'level') : -1;
+                       $level_adj = $old_parent_level - $new_parent_level;
+                       reset($subs);
+          //echo "new_main=$new_main,level_adj = $level_adj<br>";
+                       while (list($n) = each($subs))
+                       {
+                               $subs[$n]['main'] = $new_main;
+                               $subs[$n]['level'] -= $level_adj;
+                               //echo "<p>$n: id=".$subs[$n]['project_id']." 
set main to $new_main, subs[$n] = \n"; _debug_array($subs[$n]);
+                               $this->edit_project($subs[$n]);
+                       }
+               }
+ 
                function edit_project($values, $book_activities, 
$bill_activities)
                {
***************
*** 331,334 ****
--- 438,454 ----
                        $values['pcosts']                       = 
$values['pcosts'] + 0.0;
  
+                       if (isset($values['old_parent']) && 
$values['old_parent'] != $values['parent'])
+                       {
+                               $this->reparent($values);
+                       }
+                       if (!isset($values['main']) || !isset($values['level']))
+                       {
+                               if ($values['parent'] && ($values['parent'] != 
0))
+                               {
+                                       $values['main']         = 
intval($this->id2item(array('project_id' => $values['parent'],'item' => 
'main')));
+                                       $values['level']        = 
intval($this->id2item(array('project_id' => $values['parent'],'item' => 
'level'))+1);
+                               }
+                       }
+ 
                        $this->db->query("UPDATE phpgw_p_projects set access='" 
. $values['access'] . "', category=" . intval($values['cat']) . ", entry_date="
                                                        . time() . ", 
start_date=" . intval($values['sdate']) . ", end_date=" . 
intval($values['edate']) . ", coordinator="
***************
*** 336,340 ****
                                                        . $values['descr'] . 
"', title='" . $values['title'] . "', budget=" . $values['budget'] . ", num='"
                                                        . $values['number'] . 
"', time_planned=" . intval($values['ptime']) . ', processor=' . $this->account 
. ", investment_nr='"
!                                                       . 
$values['investment_nr'] . "', pcosts=" . $values['pcosts'] . ' where id=' . 
$values['project_id'],__LINE__,__FILE__);
  
                        if (is_array($book_activities))
--- 456,461 ----
                                                        . $values['descr'] . 
"', title='" . $values['title'] . "', budget=" . $values['budget'] . ", num='"
                                                        . $values['number'] . 
"', time_planned=" . intval($values['ptime']) . ', processor=' . $this->account 
. ", investment_nr='"
!                                                       . 
$values['investment_nr'] . "', pcosts=" . $values['pcosts'] . ', parent=' . 
intval($values['parent'])
!                                                       . ', level=' . 
intval($values['level']) . ' where id=' . 
$values['project_id'],__LINE__,__FILE__);
  
                        if (is_array($book_activities))
***************
*** 1126,1129 ****
--- 1247,1267 ----
                        {
                                return $this->db->f('sumvalue');
+                       }
+               }
+ 
+               function id2item($data)
+               {
+                       if(is_array($data))
+                       {
+                               $project_id     = $data['project_id'];
+                               $item           = 
(isset($data['item'])?$data['item']:'main');
+                       }
+ 
+                       $this->db->query("SELECT $item FROM phpgw_p_projects 
WHERE id=" . $project_id,__LINE__,__FILE__);
+                       $this->db->next_record();
+ 
+                       if ($this->db->f($item))
+                       {
+                               return $this->db->f(0);
                        }
                }

Index: class.uiprojects.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/projects/inc/class.uiprojects.inc.php,v
retrieving revision 1.47.2.7.2.21
retrieving revision 1.47.2.7.2.22
diff -C2 -r1.47.2.7.2.21 -r1.47.2.7.2.22
*** class.uiprojects.inc.php    20 Jun 2003 22:04:33 -0000      1.47.2.7.2.21
--- class.uiprojects.inc.php    25 Jul 2003 01:09:39 -0000      1.47.2.7.2.22
***************
*** 63,67 ****
                        $this->nextmatchs                               = 
CreateObject('phpgwapi.nextmatchs');
                        $this->sbox                                             
= CreateObject('phpgwapi.sbox');
!                       $this->cats                                             
= CreateObject('phpgwapi.categories');
                        $this->account                                  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->grants                                   = 
$GLOBALS['phpgw']->acl->get_grants('projects');
--- 63,67 ----
                        $this->nextmatchs                               = 
CreateObject('phpgwapi.nextmatchs');
                        $this->sbox                                             
= CreateObject('phpgwapi.sbox');
! 
                        $this->account                                  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->grants                                   = 
$GLOBALS['phpgw']->acl->get_grants('projects');
***************
*** 219,223 ****
                {
                        $action         = get_var('action',array('POST','GET'));
!                       $pro_parent = get_var('pro_parent',array('POST','GET'));
  
                        if ($_GET['cat_id'])
--- 219,223 ----
                {
                        $action         = get_var('action',array('POST','GET'));
!                       $pro_main       = 
get_var('pro_main',array('POST','GET'));
  
                        if ($_GET['cat_id'])
***************
*** 226,230 ****
                        }
  
!                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . ($pro_parent?lang('list jobs'):lang('list projects'));
  
                        $this->display_app_header();
--- 226,230 ----
                        }
  
!                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . ($pro_main?lang('list jobs'):lang('list projects'));
  
                        $this->display_app_header();
***************
*** 241,245 ****
                        (
                                'menuaction'    => 
'projects.uiprojects.list_projects',
!                               'pro_parent'    => $pro_parent,
                                'action'                => $action
                        );
--- 241,245 ----
                        (
                                'menuaction'    => 
'projects.uiprojects.list_projects',
!                               'pro_main'              => $pro_main,
                                'action'                => $action
                        );
***************
*** 250,259 ****
                        }
  
!                       if (!$pro_parent)
!                       {
!                               $pro_parent = 0;
!                       }
! 
!                       $pro = 
$this->bo->list_projects($this->start,True,$this->query,$this->filter,$this->sort,$this->order,$this->status,$this->cat_id,$action,$pro_parent);
  
  // --------------------- nextmatch variable template-declarations 
------------------------
--- 250,254 ----
                        }
  
!                       $pro = $this->bo->list_projects($action,$pro_main);
  
  // --------------------- nextmatch variable template-declarations 
------------------------
***************
*** 272,276 ****
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . '" name="form">' . "\n"
                                                        . '<select 
name="cat_id" onChange="this.form.submit();"><option value="none">' . 
lang('Select category') . '</option>' . "\n"
!                                                       . 
$this->cats->formatted_list('select','all',$this->cat_id,True) . '</select>';
                                
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Jobs'));
                        }
--- 267,271 ----
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . '" name="form">' . "\n"
                                                        . '<select 
name="cat_id" onChange="this.form.submit();"><option value="none">' . 
lang('Select category') . '</option>' . "\n"
!                                                       . 
$this->bo->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
                                
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Jobs'));
                        }
***************
*** 278,283 ****
                        {
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) .'" name="form">' . "\n"
!                                                       . '<select 
name="pro_parent" onChange="this.form.submit();"><option value="">' . 
lang('Select main project') . '</option>' . "\n"
!                                                       . 
$this->bo->select_project_list('mains', $status, $pro_parent) . '</select>';
                                
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Work hours'));
                        }
--- 273,278 ----
                        {
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) .'" name="form">' . "\n"
!                                                       . '<select 
name="pro_main" onChange="this.form.submit();"><option value="">' . 
lang('Select main project') . '</option>' . "\n"
!                                                       . 
$this->bo->select_project_list(array('status' => $status, 'selected' => 
$pro_main)) . '</select>';
                                
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Work hours'));
                        }
***************
*** 342,345 ****
--- 337,346 ----
                                }
  
+                               if ($pro[$i]['level'] > 0)
+                               {
+                                       $space = '&nbsp;.&nbsp;';
+                                       $spaceset = str_repeat($space,$level);
+                               }
+ 
  // --------------- template declaration for list records 
-------------------------------------
  
***************
*** 348,352 ****
                                        'number'                => 
$pro[$i]['number'],
                                        'td_action'             => $td_action,
!                                       'title'                 => 
($pro[$i]['title']?$pro[$i]['title']:'&nbsp;'),
                                        'end_date'              => $edateout,
                                        'coordinator'   => 
$pro[$i]['coordinatorout']
--- 349,353 ----
                                        'number'                => 
$pro[$i]['number'],
                                        'td_action'             => $td_action,
!                                       'title'                 => $spaceset . 
($pro[$i]['title']?$pro[$i]['title']:'&nbsp;'),
                                        'end_date'              => $edateout,
                                        'coordinator'   => 
$pro[$i]['coordinatorout']
***************
*** 373,377 ****
                                if ($action == 'mains')
                                {
!                                       
$GLOBALS['phpgw']->template->set_var('action_entry',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.list_projects&pro_parent='
                                                                                
. $pro[$i]['project_id'] . '&action=subs'));
                                        
$GLOBALS['phpgw']->template->set_var('lang_action_entry',lang('Jobs'));
--- 374,378 ----
                                if ($action == 'mains')
                                {
!                                       
$GLOBALS['phpgw']->template->set_var('action_entry',$GLOBALS['phpgw']->link('/index.php','menuaction=projects.uiprojects.list_projects&pro_main='
                                                                                
. $pro[$i]['project_id'] . '&action=subs'));
                                        
$GLOBALS['phpgw']->template->set_var('lang_action_entry',lang('Jobs'));
***************
*** 398,402 ****
                                if ($this->cat_id && $this->cat_id != 0)
                                {
!                                       $cat = 
$this->cats->return_single($this->cat_id);
                                }
  
--- 399,403 ----
                                if ($this->cat_id && $this->cat_id != 0)
                                {
!                                       $cat = 
$this->bo->cats->return_single($this->cat_id);
                                }
  
***************
*** 412,418 ****
                        else
                        {
!                               if ($pro_parent && $pro_parent != 0)
                                {
!                                       $coordinator = 
$this->bo->return_value('co',$pro_parent);
  
                                        if 
($this->bo->check_perms($this->grants[$coordinator],PHPGW_ACL_ADD) || 
$coordinator == $this->account)
--- 413,419 ----
                        else
                        {
!                               if ($pro_main && $pro_main != 0)
                                {
!                                       $coordinator = 
$this->bo->return_value('co',$pro_main);
  
                                        if 
($this->bo->check_perms($this->grants[$coordinator],PHPGW_ACL_ADD) || 
$coordinator == $this->account)
***************
*** 462,472 ****
                function edit_project()
                {
!                       $action                         = 
get_var('action',array('POST','GET'));
!                       $pro_parent             = 
get_var('pro_parent',array('POST','GET'));
  
                        $book_activities        = 
get_var('book_activities',array('POST'));
                        $bill_activities        = 
get_var('bill_activities',array('POST'));
  
!                       $project_id                     = 
get_var('project_id',array('POST','GET'));
                        $name                           = 
get_var('name',array('POST'));
                        $values                         = 
get_var('values',array('POST'));
--- 463,473 ----
                function edit_project()
                {
!                       $action                         = 
get_var('action',array('GET','POST'));
!                       $pro_main                       = 
get_var('pro_main',array('GET','POST'));
  
                        $book_activities        = 
get_var('book_activities',array('POST'));
                        $bill_activities        = 
get_var('bill_activities',array('POST'));
  
!                       $project_id                     = 
get_var('project_id',array('GET','POST'));
                        $name                           = 
get_var('name',array('POST'));
                        $values                         = 
get_var('values',array('POST'));
***************
*** 475,479 ****
                        (
                                'menuaction'    => 
'projects.uiprojects.list_projects',
!                               'pro_parent'    => $pro_parent,
                                'action'                => $action,
                                'project_id'    => $project_id
--- 476,480 ----
                        (
                                'menuaction'    => 
'projects.uiprojects.list_projects',
!                               'pro_main'              => $pro_main,
                                'action'                => $action,
                                'project_id'    => $project_id
***************
*** 486,490 ****
                                $values['project_id']   = $project_id;
                                $values['customer']             = 
$_POST['abid'];
-                               $values['parent']               = $pro_parent;
  
                                $error = $this->bo->check_values($action, 
$values, $book_activities, $bill_activities);
--- 487,490 ----
***************
*** 554,558 ****
                        {
                                $values = 
$this->bo->read_single_project($project_id);
!                               
$GLOBALS['phpgw']->template->set_var('oldstatus',$values['status']);
                                
$GLOBALS['phpgw']->template->set_var('lang_choose','');
                                
$GLOBALS['phpgw']->template->set_var('choose','');
--- 554,559 ----
                        {
                                $values = 
$this->bo->read_single_project($project_id);
!                               
$GLOBALS['phpgw']->template->set_var('old_status',$values['status']);
!                               
$GLOBALS['phpgw']->template->set_var('old_parent',$values['parent']);
                                
$GLOBALS['phpgw']->template->set_var('lang_choose','');
                                
$GLOBALS['phpgw']->template->set_var('choose','');
***************
*** 574,577 ****
--- 575,584 ----
                        else
                        {
+                               $values = array
+                               (
+                                       'parent'        => $pro_main,
+                                       'status'        => 'active'
+                               );
+ 
                                
$GLOBALS['phpgw']->template->set_var('choose','<input type="checkbox" 
name="values[choose]" value="True">');
  
***************
*** 630,638 ****
                        {
                                $cat = '<select name="cat_id"><option 
value="">' . lang('None') . '</option>'
!                                               .       
$this->cats->formatted_list('select','all',$this->cat_id,True) . '</select>';
  
                                
$GLOBALS['phpgw']->template->set_var('cat',$cat);
                                
$GLOBALS['phpgw']->template->set_var('lang_parent','');
!                               
$GLOBALS['phpgw']->template->set_var('pro_parent','');
                                
$GLOBALS['phpgw']->template->set_var('lang_number',lang('Project ID'));
                                
$GLOBALS['phpgw']->template->set_var('lang_choose',($project_id?'':lang('generate
 project id ?')));
--- 637,647 ----
                        {
                                $cat = '<select name="cat_id"><option 
value="">' . lang('None') . '</option>'
!                                               .       
$this->bo->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
  
                                
$GLOBALS['phpgw']->template->set_var('cat',$cat);
+                               
$GLOBALS['phpgw']->template->set_var('lang_main','');
                                
$GLOBALS['phpgw']->template->set_var('lang_parent','');
!                               
$GLOBALS['phpgw']->template->set_var('pro_main','');
!                               
$GLOBALS['phpgw']->template->set_var('parent_select','');
                                
$GLOBALS['phpgw']->template->set_var('lang_number',lang('Project ID'));
                                
$GLOBALS['phpgw']->template->set_var('lang_choose',($project_id?'':lang('generate
 project id ?')));
***************
*** 653,689 ****
                        else
                        {
!                               if ($pro_parent && ($action == 'subs' || 
$action == 'asubs'))
                                {
                                        
$GLOBALS['phpgw']->template->set_var('lang_choose',($project_id?'':lang('generate
 job id ?')));
  
!                                       $parent = 
$this->bo->read_single_project($pro_parent);
  
!                                       
$GLOBALS['phpgw']->template->set_var('pro_parent',$GLOBALS['phpgw']->strip_html($parent['number'])
 . ' ' . $GLOBALS['phpgw']->strip_html($parent['title']));
!                                       
$GLOBALS['phpgw']->template->set_var('cat',$this->cats->id2name($parent['cat']));
                                        $this->cat_id = $parent['cat'];
!                                       
$GLOBALS['phpgw']->template->set_var('book_activities_list',$this->bo->select_pro_activities($project_id,
 $pro_parent, False));                         
!                               
$GLOBALS['phpgw']->template->set_var('bill_activities_list',$this->bo->select_pro_activities($project_id,
 $pro_parent, True));
                                }
  
!                               
$GLOBALS['phpgw']->template->set_var('lang_parent',lang('Main project:'));
                                
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Edit job'));
                                
$GLOBALS['phpgw']->template->set_var('lang_number',lang('Job ID'));
!                               
$GLOBALS['phpgw']->template->set_var('investment_nr',$parent['investment_nr']);
!                               
$GLOBALS['phpgw']->template->set_var('pcosts',$parent['pcosts']);
  
                                
$GLOBALS['phpgw']->template->set_var('lang_ptime_main',lang('time planned main 
project') . ':&nbsp;' . lang('work hours'));
!                               
$GLOBALS['phpgw']->template->set_var('ptime_main',$parent['phours']);
  
                                
$GLOBALS['phpgw']->template->set_var('lang_budget_main',lang('budget main 
project') . ':&nbsp;' . $prefs['currency']);
!                               
$GLOBALS['phpgw']->template->set_var('budget_main',$parent['budget']);
  
                                if(!$values['coordinator'])
                                {
!                                       $values['coordinator'] = 
$parent['coordinator'];
                                }
  
                                if(!$values['customer'])
                                {
!                                       $values['customer'] = 
$parent['customer'];
                                }
                        }
--- 662,701 ----
                        else
                        {
!                               if ($pro_main && ($action == 'subs' || $action 
== 'asubs'))
                                {
                                        
$GLOBALS['phpgw']->template->set_var('lang_choose',($project_id?'':lang('generate
 job id ?')));
  
!                                       $main = 
$this->bo->read_single_project($pro_main);
!                               
$GLOBALS['phpgw']->template->set_var('parent_select',$this->bo->select_project_list(array('type'
 => 'mainandsubs','status' => $values['status'],'self' => $project_id,
!                                                                               
                                                                                
                                                                'selected' => 
$values['parent'],'main' => $pro_main)));
  
!                                       
$GLOBALS['phpgw']->template->set_var('pro_main',$GLOBALS['phpgw']->strip_html($main['number'])
 . ' ' . $GLOBALS['phpgw']->strip_html($main['title']));
!                                       
$GLOBALS['phpgw']->template->set_var('cat',$this->bo->cats->id2name($main['cat']));
                                        $this->cat_id = $parent['cat'];
!                                       
$GLOBALS['phpgw']->template->set_var('book_activities_list',$this->bo->select_pro_activities($project_id,
 $pro_main, False));                           
!                               
$GLOBALS['phpgw']->template->set_var('bill_activities_list',$this->bo->select_pro_activities($project_id,
 $pro_main, True));
                                }
  
!                               
$GLOBALS['phpgw']->template->set_var('lang_main',lang('Main project:'));
!                               
$GLOBALS['phpgw']->template->set_var('lang_parent',lang('Parent project:'));
                                
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Edit job'));
                                
$GLOBALS['phpgw']->template->set_var('lang_number',lang('Job ID'));
!                               
$GLOBALS['phpgw']->template->set_var('investment_nr',$main['investment_nr']);
!                               
$GLOBALS['phpgw']->template->set_var('pcosts',$main['pcosts']);
  
                                
$GLOBALS['phpgw']->template->set_var('lang_ptime_main',lang('time planned main 
project') . ':&nbsp;' . lang('work hours'));
!                               
$GLOBALS['phpgw']->template->set_var('ptime_main',$main['phours']);
  
                                
$GLOBALS['phpgw']->template->set_var('lang_budget_main',lang('budget main 
project') . ':&nbsp;' . $prefs['currency']);
!                               
$GLOBALS['phpgw']->template->set_var('budget_main',$main['budget']);
  
                                if(!$values['coordinator'])
                                {
!                                       $values['coordinator'] = 
$main['coordinator'];
                                }
  
                                if(!$values['customer'])
                                {
!                                       $values['customer'] = $main['customer'];
                                }
                        }
***************
*** 731,737 ****
                function view_project()
                {
!                       $action                         = 
get_var('action',array('GET'));
!                       $pro_parent             = 
get_var('pro_parent',array('GET'));
!                       $project_id                     = 
get_var('project_id',array('GET'));
  
                        $link_data = array
--- 743,749 ----
                function view_project()
                {
!                       $action         = get_var('action',array('GET'));
!                       $pro_main       = get_var('pro_main',array('GET'));
!                       $project_id     = get_var('project_id',array('GET'));
  
                        $link_data = array
***************
*** 762,766 ****
                        $values = $this->bo->read_single_project($project_id);
  
!                       
$GLOBALS['phpgw']->template->set_var('cat',$this->cats->id2name($values['cat']));
  
  // ------------ activites bookable ----------------------
--- 774,778 ----
                        $values = $this->bo->read_single_project($project_id);
  
!                       
$GLOBALS['phpgw']->template->set_var('cat',$this->bo->cats->id2name($values['cat']));
  
  // ------------ activites bookable ----------------------
***************
*** 802,806 ****
  
                                        
$GLOBALS['phpgw']->template->set_var('pro_parent',$GLOBALS['phpgw']->strip_html($parent['number'])
 . ' ' . $GLOBALS['phpgw']->strip_html($parent['title']));
!                                       
$GLOBALS['phpgw']->template->set_var('cat',$this->cats->id2name($parent['cat']));
                                        
$GLOBALS['phpgw']->template->set_var('investment_nr',($parent['investment_nr']?$parent['investment_nr']:'&nbsp;'));
                                        
$GLOBALS['phpgw']->template->set_var('pcosts',$parent['pcosts']);
--- 814,818 ----
  
                                        
$GLOBALS['phpgw']->template->set_var('pro_parent',$GLOBALS['phpgw']->strip_html($parent['number'])
 . ' ' . $GLOBALS['phpgw']->strip_html($parent['title']));
!                                       
$GLOBALS['phpgw']->template->set_var('cat',$this->bo->cats->id2name($parent['cat']));
                                        
$GLOBALS['phpgw']->template->set_var('investment_nr',($parent['investment_nr']?$parent['investment_nr']:'&nbsp;'));
                                        
$GLOBALS['phpgw']->template->set_var('pcosts',$parent['pcosts']);
***************
*** 972,976 ****
  
              
$GLOBALS['phpgw']->template->set_var('cat_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
!                       
$GLOBALS['phpgw']->template->set_var('categories_list',$this->cats->formatted_list('select','all',$this->cat_id,'True'));
              
$GLOBALS['phpgw']->template->set_var('search_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
              
$GLOBALS['phpgw']->template->set_var('search_list',$this->nextmatchs->search(array('query'
 => $this->query)));
--- 984,988 ----
  
              
$GLOBALS['phpgw']->template->set_var('cat_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
!                       
$GLOBALS['phpgw']->template->set_var('categories_list',$this->bo->cats->formatted_list('select','all',$this->cat_id,'True'));
              
$GLOBALS['phpgw']->template->set_var('search_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
              
$GLOBALS['phpgw']->template->set_var('search_list',$this->nextmatchs->search(array('query'
 => $this->query)));
***************
*** 1115,1119 ****
                        }
  
!                       
$GLOBALS['phpgw']->template->set_var('cats_list',$this->cats->formatted_list('select','all',$this->cat_id,True));
                        
$GLOBALS['phpgw']->template->set_var('num',$GLOBALS['phpgw']->strip_html($values['number']));
                        $descr  = 
$GLOBALS['phpgw']->strip_html($values['descr']);
--- 1127,1131 ----
                        }
  
!                       
$GLOBALS['phpgw']->template->set_var('cats_list',$this->bo->cats->formatted_list('select','all',$this->cat_id,True));
                        
$GLOBALS['phpgw']->template->set_var('num',$GLOBALS['phpgw']->strip_html($values['number']));
                        $descr  = 
$GLOBALS['phpgw']->strip_html($values['descr']);
***************
*** 1296,1300 ****
                        
$GLOBALS['phpgw']->template->set_block('abook_list_t','abook_list','list');
  
!                       $this->cats->app_name = 'addressbook';
  
                        $this->set_app_langs();
--- 1308,1312 ----
                        
$GLOBALS['phpgw']->template->set_block('abook_list_t','abook_list','list');
  
!                       $this->bo->cats->app_name = 'addressbook';
  
                        $this->set_app_langs();
***************
*** 1348,1352 ****
  
                        
$GLOBALS['phpgw']->template->set_var('cats_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
!                       
$GLOBALS['phpgw']->template->set_var('cats_list',$this->cats->formatted_list('select','all',$cat_id,True));
                        
$GLOBALS['phpgw']->template->set_var('filter_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
                        
$GLOBALS['phpgw']->template->set_var('filter_list',$this->nextmatchs->new_filter($filter));
--- 1360,1364 ----
  
                        
$GLOBALS['phpgw']->template->set_var('cats_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
!                       
$GLOBALS['phpgw']->template->set_var('cats_list',$this->bo->cats->formatted_list('select','all',$cat_id,True));
                        
$GLOBALS['phpgw']->template->set_var('filter_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
                        
$GLOBALS['phpgw']->template->set_var('filter_list',$this->nextmatchs->new_filter($filter));
***************
*** 1596,1600 ****
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . '" name="form">' . "\n"
                                                        . '<select 
name="cat_id" onChange="this.form.submit();"><option value="">' . lang('Select 
category') . '</option>' . "\n"
!                                                       . 
$this->cats->formatted_list('select','all',$this->cat_id,True) . '</select>';
                                
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Jobs'));
                        }
--- 1608,1612 ----
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . '" name="form">' . "\n"
                                                        . '<select 
name="cat_id" onChange="this.form.submit();"><option value="">' . lang('Select 
category') . '</option>' . "\n"
!                                                       . 
$this->bo->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
                                
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Jobs'));
                        }
***************
*** 1788,1792 ****
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . '" name="form">' . "\n"
                                                        . '<select 
name="cat_id" onChange="this.form.submit();"><option value="none">' . 
lang('Select category') . '</option>' . "\n"
!                                                       . 
$this->cats->formatted_list('select','all',$this->cat_id,True) . '</select>';
                                
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Jobs'));
                        }
--- 1800,1804 ----
                                $action_list= '<form method="POST" action="' . 
$GLOBALS['phpgw']->link('/index.php',$link_data) . '" name="form">' . "\n"
                                                        . '<select 
name="cat_id" onChange="this.form.submit();"><option value="none">' . 
lang('Select category') . '</option>' . "\n"
!                                                       . 
$this->bo->cats->formatted_list('select','all',$this->cat_id,True) . 
'</select>';
                                
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Jobs'));
                        }





reply via email to

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