phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] projects/inc class.uiprojects.inc.php, 1.83 class.uis


From: uid65887
Subject: [Phpgroupware-cvs] projects/inc class.uiprojects.inc.php, 1.83 class.uistatistics.inc.php, 1.26 class.uiprojecthours.inc.php, 1.36 class.soprojects.inc.php, 1.55 class.boprojecthours.inc.php, 1.12 class.boprojects.inc.php, 1.67 hook_admin.inc.php, 1.17
Date: Wed, 27 Apr 2005 09:35:31 -0000

Update of projects/inc

Modified Files:
     Branch: MAIN
            class.uiprojects.inc.php lines: +19 -22
            class.uistatistics.inc.php lines: +2 -2
            class.uiprojecthours.inc.php lines: +2 -2
            class.soprojects.inc.php lines: +69 -40
            class.boprojecthours.inc.php lines: +9 -9
            class.boprojects.inc.php lines: +20 -21
            hook_admin.inc.php lines: +1 -1

Log Message:
update

====================================================
Index: projects/inc/class.uiprojects.inc.php
diff -u projects/inc/class.uiprojects.inc.php:1.82 
projects/inc/class.uiprojects.inc.php:1.83
--- projects/inc/class.uiprojects.inc.php:1.82  Wed Dec  3 15:03:21 2003
+++ projects/inc/class.uiprojects.inc.php       Tue Dec 23 16:34:00 2003
@@ -222,6 +222,11 @@
                                $this->cat_id = $_GET['cat_id'];
                        }

+                       if (!$action)
+                       {
+                               $action = 'mains';
+                       }
+
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('projects') . ': ' . ($pro_main?lang('list jobs'):lang('list projects'))
                                                                                
                                        . 
($this->boprojects->isprojectadmin()?' - ' . lang('administrator'):'');

@@ -230,11 +235,6 @@
                        
$GLOBALS['phpgw']->template->set_file(array('projects_list_t' => 'list.tpl'));
                        
$GLOBALS['phpgw']->template->set_block('projects_list_t','projects_list','list');

-                       if (!$action)
-                       {
-                               $action = 'mains';
-                       }
-
                        $link_data = array
                        (
                                'menuaction'    => 
'projects.uiprojects.list_projects',
@@ -242,11 +242,6 @@
                                'action'                => $action
                        );

-                       if (! $this->status)
-                       {
-                               $this->status = 'active';
-                       }
-
                        $pro = $this->boprojects->list_projects(array('type' => 
$action,'parent' => $pro_main));

 // --------------------- nextmatch variable template-declarations 
------------------------
@@ -271,7 +266,7 @@
                        {
                                $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->boprojects->select_project_list(array('status' => $status, 'selected' => 
$pro_main)) . '</select>';
+                                                       . 
$this->boprojects->select_project_list(array('status' => $this->status, 
'selected' => $pro_main)) . '</select>';
                                
$GLOBALS['phpgw']->template->set_var('lang_action',lang('Work hours'));
                        }

@@ -884,7 +879,7 @@
                                
$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 ?')));
+                               
$GLOBALS['phpgw']->template->set_var('lang_choose',($project_id?'':lang('generate
 project id')));

                                
$GLOBALS['phpgw']->template->set_var('investment_nr','<input type="text" 
name="values[investment_nr]" value="' . $values['investment_nr']
                                                                                
                         . '" size="50" maxlength="45">');
@@ -903,7 +898,7 @@
                        {
                                if ($pro_main && ($action == 'subs' || $action 
== 'asubs'))
                                {
-                                       
$GLOBALS['phpgw']->template->set_var('lang_choose',($project_id?'':lang('generate
 job id ?')));
+                                       
$GLOBALS['phpgw']->template->set_var('lang_choose',($project_id?'':lang('generate
 job id')));

                                        $main = 
$this->boprojects->read_single_project($pro_main);
                                
$GLOBALS['phpgw']->template->set_var('parent_select','<select 
name="values[parent]">' . $this->boprojects->select_project_list(array('type' 
=> 'mainandsubs',
@@ -1162,10 +1157,10 @@
                function delete_pa()
                {
                        $action         = get_var('action',array('POST','GET'));
-                       $pro_parent = get_var('pro_parent',array('POST','GET'));
+                       $pro_main       = 
intval(get_var('pro_main',array('POST','GET')));

                        $subs           = get_var('subs',array('POST'));
-                       $pa_id          = get_var('pa_id',array('POST','GET'));
+                       $pa_id          = 
intval(get_var('pa_id',array('POST','GET')));

                        switch($action)
                        {
@@ -1174,8 +1169,8 @@
                                                                        $header 
= lang('delete project');
                                                                        break;
                                case 'subs'             :       $menu = 
'projects.uiprojects.list_projects';
-                                                                       
$deleteheader = lang('are you sure you want to delete this task');
-                                                                       $header 
= lang('delete task');
+                                                                       
$deleteheader = lang('are you sure you want to delete this job');
+                                                                       $header 
= lang('delete job');
                                                                        break;
                                case 'act'              :       $menu = 
'projects.uiprojects.list_activities';
                                                                        
$deleteheader = lang('are you sure you want to delete this activity');
@@ -1186,7 +1181,7 @@
                        $link_data = array
                        (
                                'menuaction'    => $menu,
-                               'pro_parent'    => $pro_parent,
+                               'pro_main'              => $pro_main,
                                'pa_id'                 => $pa_id,
                                'action'                => $action
                        );
@@ -1474,7 +1469,8 @@
                {
                        $link_data = array
                        (
-                               'menuaction' => 
'projects.uiprojects.edit_admins'
+                               'menuaction'    => 
'projects.uiprojects.edit_admins',
+                               'action'                => 'pad'
                        );

                        if ($_POST['add'])
@@ -1562,7 +1558,8 @@

                        $link_data = array
                        (
-                               'menuaction'    => 
'projects.uiprojects.list_admins'
+                               'menuaction'    => 
'projects.uiprojects.list_admins',
+                               'action'                => 'pad'
                        );

                        if ($_POST['save'])

====================================================

====================================================

====================================================
Index: projects/inc/class.soprojects.inc.php
diff -u projects/inc/class.soprojects.inc.php:1.54 
projects/inc/class.soprojects.inc.php:1.55
--- projects/inc/class.soprojects.inc.php:1.54  Wed Dec  3 15:03:21 2003
+++ projects/inc/class.soprojects.inc.php       Tue Dec 23 16:34:00 2003
@@ -77,41 +77,49 @@
                        return $l;
                }

-               function db2projects()
+               function db2projects($column = False)
                {
+                       $i = 0;
                        while ($this->db->next_record())
                        {
-                               $projects[] = array
-                               (
-                                       'project_id'    => $this->db->f('id'),
-                                       'parent'                => 
$this->db->f('parent'),
-                                       'number'                => 
$this->db->f('p_number'),
-                                       'access'                => 
$this->db->f('access'),
-                                       'cat'                   => 
$this->db->f('category'),
-                                       'sdate'                 => 
$this->db->f('start_date'),
-                                       'edate'                 => 
$this->db->f('end_date'),
-                                       'coordinator'   => 
$this->db->f('coordinator'),
-                                       'customer'              => 
$this->db->f('customer'),
-                                       'status'                => 
$this->db->f('status'),
-                                       'descr'                 => 
$this->db->f('descr'),
-                                       'title'                 => 
$this->db->f('title'),
-                                       'budget'                => 
$this->db->f('budget'),
-                                       'ptime'                 => 
$this->db->f('time_planned'),
-                                       'owner'                 => 
$this->db->f('owner'),
-                                       'cdate'                 => 
$this->db->f('date_created'),
-                                       'processor'             => 
$this->db->f('processor'),
-                                       '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'),
-                                       'previous'              => 
$this->db->f('previous')
-                               );
+                               if($column)
+                               {
+                                       $projects[$i] = $this->db->f(0);
+                                       $i++;
+                               }
+                               else
+                               {
+                                       $projects[] = array
+                                       (
+                                               'project_id'    => 
$this->db->f('id'),
+                                               'parent'                => 
$this->db->f('parent'),
+                                               'number'                => 
$this->db->f('p_number'),
+                                               'access'                => 
$this->db->f('access'),
+                                               'cat'                   => 
$this->db->f('category'),
+                                               'sdate'                 => 
$this->db->f('start_date'),
+                                               'edate'                 => 
$this->db->f('end_date'),
+                                               'coordinator'   => 
$this->db->f('coordinator'),
+                                               'customer'              => 
$this->db->f('customer'),
+                                               'status'                => 
$this->db->f('status'),
+                                               'descr'                 => 
$this->db->f('descr'),
+                                               'title'                 => 
$this->db->f('title'),
+                                               'budget'                => 
$this->db->f('budget'),
+                                               'ptime'                 => 
$this->db->f('time_planned'),
+                                               'owner'                 => 
$this->db->f('owner'),
+                                               'cdate'                 => 
$this->db->f('date_created'),
+                                               'processor'             => 
$this->db->f('processor'),
+                                               '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'),
+                                               'previous'              => 
$this->db->f('previous')
+                                       );
+                               }
                        }
                        return $projects;
                }

-
                function read_projects($values)
                {
                        $start  = intval($values['start']);
@@ -119,12 +127,13 @@
                        $filter = 
(isset($values['filter'])?$values['filter']:'none');
                        $sort   = 
(isset($values['sort'])?$values['sort']:'ASC');
                        $order  = $values['order'];
-                       $status = $values['status'];
+                       $status = 
isset($values['status'])?$values['status']:'active';
                        $type   = 
(isset($values['type'])?$values['type']:'mains');

                        $cat_id = intval($values['cat_id']);
                        $main   = intval($values['main']);
                        $parent = intval($values['parent']);
+                       $column = 
(isset($values['column'])?$values['column']:False);

                        $query  = $this->db->db_addslashes($values['query']);

@@ -148,7 +157,7 @@

                        if ($filter == 'none')
                        {
-                               if ($this->isprojectadmin('pad') || 
$this->isbookkeeper('pbo'))
+                               if ($this->isprojectadmin())
                                {
                                        $filtermethod = " ( access != 'private' 
OR coordinator = " . $this->account . ' )';
                                }
@@ -206,9 +215,14 @@
                                $querymethod = " AND (title like '%$query%' OR 
p_number like '%$query%' OR descr like '%$query%') ";
                        }

-                       $sql = "SELECT * from phpgw_p_projects WHERE 
$filtermethod $statussort $querymethod";
+                       $column_select = ((is_string($column) && $column != 
'')?$column:'*');
+
+                       $sql = "SELECT $column_select from phpgw_p_projects 
WHERE $filtermethod $statussort $querymethod";

                        $this->db2->query($sql . 
$parent_select,__LINE__,__FILE__);
+
+                       //echo $sql . $parent_select;
+
                        $total = $this->db2->num_rows();

                        if ($limit)
@@ -220,7 +234,7 @@
                                $this->db->query($sql . $parent_select . 
$ordermethod,__LINE__,__FILE__);
                        }

-                       $pro = $this->db2projects();
+                       $pro = $this->db2projects($column);

                        if ($main == 0 && $type != 'mains' && $type != 'amains')
                        {
@@ -326,7 +340,9 @@
                        $values['budget']                       = 
$values['budget'] + 0.0;
                        $values['pcosts']                       = 
$values['pcosts'] + 0.0;

-                       if ($values['parent'] && $values['parent'] != 0)
+                       $values['parent']                       = 
intval($values['parent']);
+
+                       if ($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);
@@ -340,7 +356,7 @@
                                                        . ",'" . 
(isset($values['access'])?$values['access']:'public') . "'," . 
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['parent'] . 
',' . intval($values['ptime']) . ',' . time() . ',' . $this->account . ",'" . 
$values['investment_nr']
                                                        . "'," . 
$values['pcosts'] . ',' . intval($values['main']) . ',' . 
intval($values['level']) . ',' . intval($values['previous']) . 
')',__LINE__,__FILE__);

                        $p_id = $this->db->get_last_insert_id($table,'id');
@@ -348,7 +364,7 @@

                        if ($p_id && ($p_id != 0))
                        {
-                               if (!$values['parent'] || $values['parent'] == 
0)
+                               if ($values['parent'] == 0)
                                {
                                        $this->db->query('UPDATE 
phpgw_p_projects SET main=' . $p_id . ' WHERE id=' . $p_id,__LINE__,__FILE__);
                                }
@@ -447,6 +463,8 @@

                function edit_project($values, $book_activities = 0, 
$bill_activities = 0)
                {
+                       $values['project_id'] = intval($values['project_id']);
+
                        if (is_array($book_activities))
                        {
                                $this->db2->query('delete from 
phpgw_p_projectactivities where project_id=' . $values['project_id']
@@ -475,7 +493,7 @@
                        $values['title']                        = 
$this->db->db_addslashes($values['title']);
                        $values['number']                       = 
$this->db->db_addslashes($values['number']);
                        $values['investment_nr']        = 
$this->db->db_addslashes($values['investment_nr']);
-                       $values['project_id']           = 
intval($values['project_id']);
+
                        $values['parent']                       = 
intval($values['parent']);

                        $values['budget']                       = 
$values['budget'] + 0.0;
@@ -492,6 +510,10 @@
                                        $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);
                                }
+                               else
+                               {
+                                       $values['main'] = $values['project_id'];
+                               }
                        }

                        $this->db->query("UPDATE phpgw_p_projects set access='" 
. (isset($values['access'])?$values['access']:'public') . "', category=" . 
intval($values['cat']) . ", entry_date="
@@ -499,7 +521,7 @@
                                                        . 
intval($values['coordinator']) . ", customer=" . intval($values['customer']) . 
", status='" . $values['status'] . "', descr='"
                                                        . $values['descr'] . 
"', title='" . $values['title'] . "', budget=" . $values['budget'] . ", 
p_number='"
                                                        . $values['number'] . 
"', time_planned=" . intval($values['ptime']) . ', processor=' . $this->account 
. ", investment_nr='"
-                                                       . 
$values['investment_nr'] . "', pcosts=" . $values['pcosts'] . ', parent=' . 
$values['parent']
+                                                       . 
$values['investment_nr'] . "', pcosts=" . $values['pcosts'] . ', parent=' . 
$values['parent'] . ', main=' . intval($values['main'])
                                                        . ', level=' . 
intval($values['level']) . ', previous=' . intval($values['previous']) . ' 
where id=' . $values['project_id'],__LINE__,__FILE__);

                        $this->db->query('SELECT max(month) FROM phpgw_p_pcosts 
where project_id=' . $values['project_id'],__LINE__,__FILE__);
@@ -943,9 +965,16 @@

                function create_jobid($pro_parent)
                {
+                       /*$parent_level = $this->id2item(array('project_id' => 
$pro_parent, 'item' => 'level'));
+                       switch($parent_level)
+                       {
+                               case 0:         $add = ' / '; break;
+                               default:        $add = ''; break;
+                       }*/
+
                        $this->db->query('select p_number from phpgw_p_projects 
where id=' . $pro_parent);
                        $this->db->next_record();
-                       $prefix = $this->db->f('num') . '/';
+                       $prefix = $this->db->f('p_number') . '/';

                        $this->db->query("select max(p_number) from 
phpgw_p_projects where p_number like ('$prefix%')");
                        $this->db->next_record();

====================================================
Index: projects/inc/class.boprojecthours.inc.php
diff -u projects/inc/class.boprojecthours.inc.php:1.11 
projects/inc/class.boprojecthours.inc.php:1.12
--- projects/inc/class.boprojecthours.inc.php:1.11      Wed Sep 10 00:28:57 2003
+++ projects/inc/class.boprojecthours.inc.php   Tue Dec 23 16:34:00 2003
@@ -114,12 +114,12 @@

                function check_values($values)
                {
-                       if (strlen($values['hours_descr']) >= 255)
+                       if (strlen($values['hours_descr']) > 250)
                        {
-                               $error[] = lang('Description can not exceed 255 
characters in length !');
+                               $error[] = lang('Description can not exceed 250 
characters in length');
                        }

-                       if (strlen($values['remark']) >= 8000)
+                       if (strlen($values['remark']) > 8000)
                        {
                                $error[] = lang('Remark can not exceed 8000 
characters in length !');
                        }
@@ -158,25 +158,25 @@

                        if (! 
checkdate($values['smonth'],$values['sday'],$values['syear']))
                        {
-                               $error[] = lang('You have entered an invalid 
start date !');
+                               $error[] = lang('You have entered an invalid 
start date');
                        }

                        if (! 
checkdate($values['emonth'],$values['eday'],$values['eyear']))
                        {
-                               $error[] = lang('You have entered an invalid 
end date !');
+                               $error[] = lang('You have entered an invalid 
end date');
                        }

                        $activity = 
$this->boprojects->read_single_activity($values['activity_id']);

                        if (! is_array($activity))
                        {
-                               $error[] = lang('You have selected an invalid 
activity !');
+                               $error[] = lang('You have selected an invalid 
activity');
                        }
                        else
                        {
                                if ($activity['remarkreq']=='Y' && 
(!$values['remark']))
                                {
-                                       $error[] = lang('Please enter a remark 
!');
+                                       $error[] = lang('Please enter a 
remark');
                                }
                        }


====================================================
Index: projects/inc/class.boprojects.inc.php
diff -u projects/inc/class.boprojects.inc.php:1.66 
projects/inc/class.boprojects.inc.php:1.67
--- projects/inc/class.boprojects.inc.php:1.66  Wed Dec  3 15:03:20 2003
+++ projects/inc/class.boprojects.inc.php       Tue Dec 23 16:34:00 2003
@@ -39,6 +39,7 @@

                var $public_functions = array
                (
+                       'save_sessiondata'                      => True,
                        'cached_accounts'                       => True,
                        'list_projects'                         => True,
                        'check_perms'                           => True,
@@ -61,6 +62,7 @@
                        'read_single_contact'           => True,
                        'read_prefs'                            => True,
                        'save_prefs'                            => True,
+                       'get_site_config'                       => True,
                        'return_value'                          => True,
                        'select_activities_list'        => True,
                        'select_pro_activities'         => True,
@@ -146,13 +148,10 @@
                                case 'subs'             : $column = 
'projects_subs'; break;
                                case 'act'              : $column = 
'projects_act'; break;
                                case 'pad'              : $column = 
'projects_pad'; break;
-                               case 'pbo'              : $column = 
'projects_pbo'; break;
                                case 'amains'   : $column = 'projects_amains'; 
break;
                                case 'asubs'    : $column = 'projects_asubs'; 
break;
                                case 'ustat'    : $column = 'projects_ustat'; 
break;
                                case 'pstat'    : $column = 'projects_pstat'; 
break;
-                               case 'bill'             : $column = 
'projects_bill'; break;
-                               case 'del'              : $column = 
'projects_del'; break;
                        }
                        return $column;
                }
@@ -623,9 +622,9 @@

                function check_values($action, $values, $book_activities, 
$bill_activities)
                {
-                       if (strlen($values['descr']) >= 8000)
+                       if (strlen($values['descr']) > 8000)
                        {
-                               $error[] = lang('Description can not exceed 
8000 characters in length !');
+                               $error[] = lang('Description can not exceed 
8000 characters in length');
                        }

                        if (!$values['coordinator'])
@@ -633,16 +632,16 @@
                                $error[] = lang('please choose a project 
coordinator');
                        }

-                       if (strlen($values['title']) >= 255)
+                       if (strlen($values['title']) > 250)
                        {
-                               $error[] = lang('title can not exceed 255 
characters in length');
+                               $error[] = lang('title can not exceed 250 
characters in length');
                        }

                        if (!$values['choose'])
                        {
                                if (! $values['number'])
                                {
-                                       $error[] = lang('Please enter an ID !');
+                                       $error[] = lang('Please enter an ID');
                                }
                                else
                                {
@@ -650,12 +649,12 @@

                                        if ($exists)
                                        {
-                                               $error[] = lang('That ID has 
been used already !');
+                                               $error[] = lang('That ID has 
been used already');
                                        }

-                                       if (strlen($values['number']) > 25)
+                                       if (strlen($values['number']) > 250)
                                        {
-                                               $error[] = lang('id can not 
exceed 25 characters in length');
+                                               $error[] = lang('id can not 
exceed 250 characters in length');
                                        }
                                }
                        }
@@ -669,7 +668,7 @@
                        {
                                if (! 
checkdate($values['smonth'],$values['sday'],$values['syear']))
                                {
-                                       $error[] = lang('You have entered an 
invalid start date !');
+                                       $error[] = lang('You have entered an 
invalid start date');
                                }
                        }

@@ -677,7 +676,7 @@
                        {
                                if (! 
checkdate($values['emonth'],$values['eday'],$values['eyear']))
                                {
-                                       $error[] = lang('You have entered an 
invalid end date !');
+                                       $error[] = lang('You have entered an 
invalid end date');
                                }
                        }

@@ -761,16 +760,16 @@

                function check_pa_values($values)
                {
-                       if (strlen($values['descr']) >= 255)
+                       if (strlen($values['descr']) > 250)
                        {
-                               $error[] = lang('Description can not exceed 255 
characters in length !');
+                               $error[] = lang('Description can not exceed 250 
characters in length');
                        }

                        if (! $values['choose'])
                        {
                                if (! $values['number'])
                                {
-                                       $error[] = lang('Please enter an ID !');
+                                       $error[] = lang('Please enter an ID');
                                }
                                else
                                {
@@ -778,12 +777,12 @@

                                        if ($exists)
                                        {
-                                               $error[] = lang('That ID has 
been used already !');
+                                               $error[] = lang('That ID has 
been used already');
                                        }

-                                       if (strlen($values['number']) >= 20)
+                                       if (strlen($values['number']) > 20)
                                        {
-                                               $error[] = lang('id can not 
exceed 19 characters in length');
+                                               $error[] = lang('id can not 
exceed 20 characters in length');
                                        }
                                }
                        }

====================================================






reply via email to

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