phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] hrm/inc class.uiuser.inc.php, 1.9 class.uijob.inc.php


From: sigurdne
Subject: [Phpgroupware-cvs] hrm/inc class.uiuser.inc.php, 1.9 class.uijob.inc.php, 1.10 class.boadmin.inc.php, 1.6 class.bojob.inc.php, 1.10 class.sojob.inc.php, 1.11 class.souser.inc.php, 1.7 class.acl2.inc.php, 1.5
Date: Thu, 1 Dec 2005 15:37:00 +0100

Update of hrm/inc

Modified Files:
     Branch: MAIN
            class.uiuser.inc.php lines: +14 -7
            class.uijob.inc.php lines: +118 -26
            class.boadmin.inc.php lines: +6 -6
            class.bojob.inc.php lines: +18 -7
            class.sojob.inc.php lines: +121 -15
            class.souser.inc.php lines: +14 -7
            class.acl2.inc.php lines: +18 -19

Log Message:
*** empty log message ***

====================================================
Index: hrm/inc/class.uiuser.inc.php
diff -u hrm/inc/class.uiuser.inc.php:1.8 hrm/inc/class.uiuser.inc.php:1.9
--- hrm/inc/class.uiuser.inc.php:1.8    Wed Nov 30 17:07:22 2005
+++ hrm/inc/class.uiuser.inc.php        Thu Dec  1 14:37:55 2005
@@ -437,15 +437,21 @@
                        $user_id        = 
get_var('user_id',array('POST','GET'));
                        $values         = get_var('values',array('POST'));

-                       if(!$training_id)                       {
+                       if(!$training_id)
+                       {
                                
if(!$this->bcommon->check_perms($this->grants[$user_id], PHPGW_ACL_ADD))
-                               {                                       return;
-                               }                       }
-                       else                    {
+                               {
+                                       return;
+                               }
+                       }
+                       else
+                       {
                                
if(!$this->bcommon->check_perms($this->grants[$user_id], PHPGW_ACL_EDIT))
-                               {                                       return;
+                               {
+                                       return;
                                }
                        }
+
                        $GLOBALS['phpgw']->xlttpl->add_file(array('user'));

                        if (is_array($values))
@@ -631,7 +637,8 @@
                        $user_id        = 
get_var('user_id',array('POST','GET'));

                        
if(!$this->bocommon->check_perms($this->grants[$user_id], PHPGW_ACL_READ))
-                       {                               unset($training_id);
+                       {
+                               unset($training_id);
                        }
                        $GLOBALS['phpgw']->xslttpl->add_file(array('user'));


====================================================
Index: hrm/inc/class.uijob.inc.php
diff -u hrm/inc/class.uijob.inc.php:1.9 hrm/inc/class.uijob.inc.php:1.10
--- hrm/inc/class.uijob.inc.php:1.9     Wed Nov 30 19:19:03 2005
+++ hrm/inc/class.uijob.inc.php Thu Dec  1 14:37:55 2005
@@ -37,7 +37,8 @@
                        'task'                          => True,
                        'delete_job'                    => True,
                        'reset_job_type_hierarchy'      => True,
-                       'lookup_task'                   => True
+                       'lookup_task'                   => True,
+                       'no_access'                     => True
                );

                function uijob()
@@ -49,6 +50,7 @@
                        $this->bo                               = 
CreateObject($this->currentapp.'.bojob',true);
                        $this->bocommon                         = 
CreateObject($this->currentapp.'.bocommon');
                        $this->bocategory                       = 
CreateObject($this->currentapp.'.bocategory');
+                       $this->acl                              = 
CreateObject($this->currentapp.'.acl2');
                        $this->menu                             = 
CreateObject($this->currentapp.'.menu');
                        $this->menu->sub                        ='job';

@@ -71,12 +73,41 @@
                        $this->bo->save_sessiondata($data);
                }

-               function index()
+
+
+               function no_access($links = '')
                {
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('no_access','menu'));
+
+                       $receipt['error'][]=array('msg'=>lang('NO ACCESS'));
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'links'         => $links,
+                       );
+
+                       $appname        = lang('No access');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('no_access' => $data));
+               }
+
+               function index()
+               {
+                       $links = $this->menu->links('job_type');
+
+                       if(!$this->acl->check('job', PHPGW_ACL_READ))
+                       {
+                               $this->no_access($links);
+                               return;
+                       }
+
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('job','nextmatchs','menu',
                                                                                
'search_field'));

-                       $links = $this->menu->links('job_type');

                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','hrm_job_receipt');
                        
$GLOBALS['phpgw']->session->appsession('session_data','hrm_job_receipt','');
@@ -196,7 +227,6 @@
                        );

                        $appname                                        = 
lang('job');
-;
                        $function_msg                                   = 
lang('list job');

                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
@@ -207,6 +237,12 @@

                function task()
                {
+                       if(!$this->acl->check('job', PHPGW_ACL_READ))
+                       {
+                               $this->no_access($links);
+                               return;
+                       }
+
                        $job_id = get_var('job_id',array('POST','GET'));

                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','hrm_task_receipt');
@@ -236,10 +272,9 @@

                                $content[] = array
                                (
+                                       'id'                    => 
$entry['task_id'],
                                        'name'                  => 
$entry['name'],
-                                       'place'                 => 
$entry['place'],
-                                       'start_date'            => 
$entry['start_date'],
-                                       'end_date'              => 
$entry['end_date'],
+                                       'descr'                 => 
$entry['descr'],
                                        'link_edit'             => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.".uijob.edit_task&job_id=$job_id&task_id="
 . $entry['task_id']),
                                        'link_view'             => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.".uijob.view_task&job_id=$job_id&task_id="
 . $entry['task_id']),
                                        'link_delete'           => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.".uijob.delete_task&job_id=$job_id&task_id="
 . $entry['task_id']),
@@ -256,18 +291,6 @@
                        $table_header[] = array
                        (

-                               'sort_place'    => 
$this->nextmatchs->show_sort_order(array
-                                                                               
(
-                                                                               
        'sort'  => $this->sort,
-                                                                               
        'var'   =>      'hrm_task_place.name',
-                                                                               
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uijob.task',
-                                                                               
                                'job_id'        =>$job_id,
-                                                                               
                                'query'         =>$this->query,
-                                                                               
                                'cat_id'        =>$this->cat_id,
-                                                                               
                                'allrows'       => $this->allrows)
-                                                                               
)),
-                               'lang_place'    => lang('place'),
                                'sort_name'     => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
@@ -280,8 +303,7 @@
                                                                                
                                'allrows' => $this->allrows)
                                                                                
)),
                                'lang_name'     => lang('name'),
-                               'lang_start_date'=> lang('start date'),
-                               'lang_end_date' => lang('end date'),
+                               'lang_descr'=> lang('descr'),
                                'lang_view'     => lang('view'),
                                'lang_edit'     => lang('edit'),
                                'lang_delete'   => lang('delete'),
@@ -498,6 +520,24 @@
                        $parent_id      = 
get_var('parent_id',array('POST','GET'));
                        $values         = get_var('values',array('POST'));

+                       if(!$id)
+                       {
+                               if(!$this->acl->check('job', PHPGW_ACL_ADD))
+                               {
+                                       $this->no_access($links);
+                                       return;
+                               }
+                       }
+                       else
+                       {
+                               if(!$this->acl->check('job', PHPGW_ACL_EDIT))
+                               {
+                                       $this->no_access($links);
+                                       return;
+                               }
+                       }
+
+
                        $GLOBALS['phpgw']->xslttpl->add_file(array('job'));

                        if (is_array($values))
@@ -602,7 +642,13 @@
                {
                        $id             = get_var('id',array('POST','GET'));
                        $parent_id      = 
get_var('parent_id',array('POST','GET'));
-                       $values         = get_var('values',array('POST'));
+
+                       if(!$this->acl->check('job', PHPGW_ACL_READ))
+                       {
+                               $this->no_access($links);
+                               return;
+                       }
+

                        $GLOBALS['phpgw']->xslttpl->add_file(array('job'));

@@ -666,6 +712,24 @@
                {
                        $task_id        = 
get_var('task_id',array('POST','GET'));
                        $job_id = get_var('job_id',array('POST','GET'));
+
+                       if(!$task_id)
+                       {
+                               if(!$this->acl->check('job', PHPGW_ACL_ADD))
+                               {
+                                       $this->no_access($links);
+                                       return;
+                               }
+                       }
+                       else
+                       {
+                               if(!$this->acl->check('job', PHPGW_ACL_EDIT))
+                               {
+                                       $this->no_access($links);
+                                       return;
+                               }
+                       }
+
                        $values         = get_var('values',array('POST'));

                        $GLOBALS['phpgw']->xslttpl->add_file(array('job'));
@@ -754,7 +818,7 @@

                        $msgbox_data = $this->bocommon->msgbox_data($receipt);

-                       $task_list                      = 
$this->bo->select_task_list($job_id);
+                       $task_list                      = 
$this->bo->select_task_list($job_id,$task_id);

                        $data = array
                        (
@@ -791,7 +855,7 @@
                                'lang_alternative'                      => 
lang('alternative'),
                                'lang_open_popup'                       => 
lang('open popup window'),
                                'lang_no_alternative'                   => 
lang('select alternative'),
-                               'task_list'                                     
=> $task_list,
+                               'task_list'                             => 
$task_list,
                                'task_list_size'                        => 
count($task_list)

                        );
@@ -808,7 +872,12 @@
                {
                        $task_id        = 
get_var('task_id',array('POST','GET'));
                        $job_id = get_var('job_id',array('POST','GET'));
-                       $values         = get_var('values',array('POST'));
+
+                       if(!$this->acl->check('job', PHPGW_ACL_READ))
+                       {
+                               $this->no_access($links);
+                               return;
+                       }

                        $GLOBALS['phpgw']->xslttpl->add_file(array('job'));

@@ -821,6 +890,7 @@
                                'job_id' => $job_id
                        );

+                       $task_list                      = 
$this->bo->select_task_list($job_id,$task_id);
                        $data = array
                        (
                                'value_descr'                           => 
$values['descr'],
@@ -856,6 +926,10 @@
                                'cat_list'                              => 
$this->bocategory->select_category_list('task',$values['cat_id']),
                                'lang_no_cat'                           => 
lang('no category'),
                                'lang_cat_status_text'                  => 
lang('Select the category the task belongs to. To do not use a category select 
NO CATEGORY'),
+
+                               'lang_alternative'                      => 
lang('alternative'),
+                               'task_list'                             => 
$task_list,
+                               'task_list_size'                        => 
count($task_list)
                        );

                        $job_info = $this->bo->read_single_job($job_id);
@@ -866,6 +940,12 @@

                function delete_job()
                {
+                       if(!$this->acl->check('job', PHPGW_ACL_DELETE))
+                       {
+                               $this->no_access($links);
+                               return;
+                       }
+
                        $job_id = get_var('job_id',array('POST','GET'));
                        $confirm                = 
get_var('confirm',array('POST'));
                        $link_data = array
@@ -901,6 +981,12 @@

                function delete_task()
                {
+                       if(!$this->acl->check('job', PHPGW_ACL_DELETE))
+                       {
+                               $this->no_access($links);
+                               return;
+                       }
+
                        $task_id                = 
get_var('task_id',array('POST','GET'));
                        $job_id = get_var('job_id',array('POST','GET'));
                        $confirm                = 
get_var('confirm',array('POST'));
@@ -939,6 +1025,12 @@

                function reset_job_type_hierarchy()
                {
+                       if(!$this->acl->check('job', PHPGW_ACL_DELETE))
+                       {
+                               $this->no_access($links);
+                               return;
+                       }
+
                        $confirm                = 
get_var('confirm',array('POST'));
                        $link_data = array
                        (

====================================================
Index: hrm/inc/class.boadmin.inc.php
diff -u hrm/inc/class.boadmin.inc.php:1.5 hrm/inc/class.boadmin.inc.php:1.6
--- hrm/inc/class.boadmin.inc.php:1.5   Wed Nov 30 17:07:22 2005
+++ hrm/inc/class.boadmin.inc.php       Thu Dec  1 14:37:55 2005
@@ -143,16 +143,16 @@

 //                     $locations= $this->so->select_location($grant);
                        $i=0;
-                       $locations[$i]['id']                    = 'run';
-                       $locations[$i]['descr']         = 'Hrm-main';
+                       $locations[$i]['id']            = 'job';
+                       $locations[$i]['descr']         = 'Job';
                        $i++;
-                       $locations[$i]['id']                    = 'user';
+                       $locations[$i]['id']            = 'user';
                        $locations[$i]['descr']         = 'Hrm-user';
                        $i++;
-                       $locations[$i]['id']                    = 'C-1';
+                       $locations[$i]['id']            = 'C-1';
                        $locations[$i]['descr']         = 
lang('contact_information');
                        $i++;
-                       $locations[$i]['id']                    = 'C-2';
+                       $locations[$i]['id']            = 'C-2';
                        $locations[$i]['descr']         = lang('photo');
                        $i++;


====================================================
Index: hrm/inc/class.bojob.inc.php
diff -u hrm/inc/class.bojob.inc.php:1.9 hrm/inc/class.bojob.inc.php:1.10
--- hrm/inc/class.bojob.inc.php:1.9     Wed Nov 30 19:19:15 2005
+++ hrm/inc/class.bojob.inc.php Thu Dec  1 14:37:55 2005
@@ -145,8 +145,20 @@

                function read_task($job_id)
                {
-                       $values = $this->so->read_task($job_id);
-                       return $values;
+                       $task_list = 
$this->so->read_task(array('job_id'=>$job_id,'start' => $this->start,'query' => 
$this->query,'sort' => $this->sort,'order' => $this->order,
+                                                                               
        'allrows'=>$this->allrows));
+
+                       for ($i=0;$i<count($task_list);$i++)
+                       {
+                               if ($task_list[$i]['level'] > 0)
+                               {
+                                       $space = '--> ';
+                                       $spaceset = 
str_repeat($space,$task_list[$i]['level']);
+                                       $task_list[$i]['name'] = $spaceset . 
$task_list[$i]['name'];
+                               }
+                       }
+
+                       return $task_list;
                }

                function read_single_task($id)
@@ -255,10 +267,9 @@
                        return $job_list;
                }

-               function select_task_list($job_id)
+               function select_task_list($job_id,$task_id='')
                {
-                       return $this->so->select_task_list($job_id);
+                       $task_list = 
$this->so->select_task_list($job_id,$task_id);
+                       return $task_list;
                }
-
-
        }

====================================================
Index: hrm/inc/class.sojob.inc.php
diff -u hrm/inc/class.sojob.inc.php:1.10 hrm/inc/class.sojob.inc.php:1.11
--- hrm/inc/class.sojob.inc.php:1.10    Wed Nov 30 19:19:25 2005
+++ hrm/inc/class.sojob.inc.php Thu Dec  1 14:37:55 2005
@@ -190,23 +190,110 @@
                }


-               function read_task($job_id)
+               function read_task($data)
                {
+                       if(is_array($data))
+                       {
+                               if ($data['start'])
+                               {
+                                       $start=$data['start'];
+                               }
+                               else
+                               {
+                                       $start=0;
+                               }
+                               $query          = 
(isset($data['query'])?$data['query']:'');
+                               $sort           = 
(isset($data['sort'])?$data['sort']:'DESC');
+                               $order          = 
(isset($data['order'])?$data['order']:'');
+                               $allrows        = 
(isset($data['allrows'])?$data['allrows']:'');
+                       }
+
+                       $job_id = $data['job_id'];
+
+                       if ($order)
+                       {
+                               $ordermethod = " order by $order $sort";
+
+                       }
+                       else
+                       {
+                               $ordermethod = ' order by name asc';
+                       }
+
+
                        $sql = "SELECT * from hrm_task WHERE job_id=" . 
intval($job_id);
+
+                       $parent_select = ' AND (is_parent =1 OR (is_parent != 1 
AND task_parent IS NULL))';
+
+                       if($query)
+                       {
+                               $query = ereg_replace("'",'',$query);
+                               $query = ereg_replace('"','',$query);
+
+                               $querymethod = " AND name $this->like 
'%$query%'";
+                       }

-                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $this->db->query($sql . $parent_select . $querymethod . 
$ordermethod,__LINE__,__FILE__);
+                       $this->total_records = $this->db->num_rows();

                        while ($this->db->next_record())
                        {
-                               $training[] = array
+                               $tasks[] = array
                                (
                                        'task_id'       => $this->db->f('id'),
+                                       'level' => 0,
                                        'name'  => 
stripslashes($this->db->f('name')),
-                                       'descr' => 
stripslashes($this->db->f('descr'))
+                                       'descr' => 
stripslashes($this->db->f('descr')),
+                                       'parent'=> 0
                                );
+                       }
+
+                       $num_tasks = count($tasks);
+                       for ($i=0;$i < $num_tasks;$i++)
+                       {
+                               $sub_select = ' AND task_parent=' . 
$tasks[$i]['task_id'] . " AND is_parent != 1";
+
+                               $this->db->query($sql . $querymethod . 
$sub_select . $ordermethod,__LINE__,__FILE__);
+
+                               $this->total_records += $this->db->num_rows();
+
+                               $subtasks = array();
+                               $j = 0;
+                               while ($this->db->next_record())
+                               {
+                                       $subtasks[$j]['task_id']          = 
(int)$this->db->f('id');
+                                       $subtasks[$j]['level']       = 1;
+                                       $subtasks[$j]['parent']      = 
(int)$this->db->f('task_parent');
+                                       $subtasks[$j]['name']        = 
$this->db->f('name');
+                                       $subtasks[$j]['descr'] = 
$this->db->f('descr');
+                                       $j++;
+                               }
+
+                               $num_subtasks = count($subtasks);
+                               if ($num_subtasks != 0)
+                               {
+                                       $newtasks = array();
+                                       for ($k = 0; $k <= $i; $k++)
+                                       {
+                                               $newtasks[$k] = $tasks[$k];
+                                       }
+                                       for ($k = 0; $k < $num_subtasks; $k++)
+                                       {
+                                               $newtasks[$k+$i+1] = 
$subtasks[$k];
+                                       }
+                                       for ($k = $i+1; $k < $num_tasks; $k++)
+                                       {
+                                               $newtasks[$k+$num_subtasks] = 
$tasks[$k];
+                                       }
+                                       $tasks = $newtasks;
+                                       $num_tasks = count($tasks);
+                               }

                        }
-                       return $training;
+//_debug_array($tasks);
+
+                       return $tasks;
                }


@@ -476,11 +563,17 @@

                        if(is_array($values['alternative_task']))
                        {
+                               $this->db->query("UPDATE hrm_task set is_parent 
= 1 WHERE id= $task_id",__LINE__,__FILE__);
+
                                foreach($values['alternative_task'] as 
$alternative_task)
                                {
-                                       $this->db->query("UPDATE hrm_task set 
parent_task = $task_id WHERE id= $alternative_task",__LINE__,__FILE__);
+                                       $this->db->query("UPDATE hrm_task set 
task_parent = $task_id WHERE id= $alternative_task",__LINE__,__FILE__);
                                }
                        }
+                       else
+                       {
+                               $this->db->query("UPDATE hrm_task set is_parent 
= 0 WHERE id= " . $values['task_id'],__LINE__,__FILE__);
+                       }

                        $receipt['message'][]=array('msg'=>lang('task item has 
been saved'));

@@ -503,16 +596,21 @@
                        $table='hrm_task';

                        $this->db->query("UPDATE $table set $value_set WHERE 
id=" . $values['task_id'],__LINE__,__FILE__);
-                       $this->db->query("UPDATE hrm_task set parent_task = 
NULL WHERE parent_task = " . $values['task_id'] ,__LINE__,__FILE__);
+                       $this->db->query("UPDATE hrm_task set task_parent = 
NULL WHERE task_parent = " . $values['task_id'] ,__LINE__,__FILE__);

                        if(is_array($values['alternative_task']))
                        {
+                               $this->db->query("UPDATE hrm_task set is_parent 
= 1 WHERE id= " . $values['task_id'],__LINE__,__FILE__);

                                foreach($values['alternative_task'] as 
$alternative_task)
                                {
-                                       $this->db->query("UPDATE hrm_task set 
parent_task = " . $values['task_id'] . " WHERE id= 
$alternative_task",__LINE__,__FILE__);
+                                       $this->db->query("UPDATE hrm_task set 
task_parent = " . $values['task_id'] . " WHERE id= 
$alternative_task",__LINE__,__FILE__);
                                }
                        }
+                       else
+                       {
+                               $this->db->query("UPDATE hrm_task set is_parent 
= 0 WHERE id= " . $values['task_id'],__LINE__,__FILE__);
+                       }

                        $this->db->transaction_commit();

@@ -523,19 +621,27 @@
                }


-               function select_task_list($job_id)
+               function select_task_list($job_id,$task_id='')
                {
                        $sql = "SELECT * from hrm_task WHERE job_id=" . 
intval($job_id);

+                       if($task_id)
+                       {
+                               $sql .= " AND id != $task_id AND (is_parent !=1 
AND (task_parent is null or task_parent = $task_id ))";
+                       }
+
                        $this->db->query($sql,__LINE__,__FILE__);

+                       $i=0;
                        while ($this->db->next_record())
                        {
-                               $task_list[] = array
-                               (
-                                       'id'    => $this->db->f('id'),
-                                       'name'  => 
stripslashes($this->db->f('name')),
-                               );
+                               $task_list[$i]['id']    = $this->db->f('id');
+                               $task_list[$i]['name']  = 
stripslashes($this->db->f('name'));
+                               if($this->db->f('task_parent'))
+                               {
+                                       $task_list[$i]['selected'] = 'selected';
+                               }
+                               $i++;
                        }
                        return $task_list;
                }

====================================================
Index: hrm/inc/class.souser.inc.php
diff -u hrm/inc/class.souser.inc.php:1.6 hrm/inc/class.souser.inc.php:1.7
--- hrm/inc/class.souser.inc.php:1.6    Wed Nov 30 17:07:22 2005
+++ hrm/inc/class.souser.inc.php        Thu Dec  1 14:37:55 2005
@@ -56,15 +56,22 @@
                                $allrows        = 
(isset($data['allrows'])?$data['allrows']:'');
                        }

-/*                     $filtermethod = ' AND ( account_id=' . $this->account;  
                if (is_array($this->grants))
-                       {                               $grants = $this->grants;
+/*                     $filtermethod = ' AND ( account_id=' . $this->account;
+                       if (is_array($this->grants))
+                       {
+                               $grants = $this->grants;
                                while (list($user) = each($grants))             
                {
                                        $public_user_list[] = $user;            
                }
-                               reset($public_user_list);                       
        $filtermethod .= " OR ( account_id IN(" . 
implode(',',$public_user_list) . ")))";
-                       }                       else
-                       {                               $filtermethod .= ' )';
+                               reset($public_user_list);
+                               $filtermethod .= " OR ( account_id IN(" . 
implode(',',$public_user_list) . ")))";
                        }
-*/                     if ($order)
+                       else
+                       {
+                               $filtermethod .= ' )';
+                       }
+
+*/
+                       if ($order)
                        {
                                $ordermethod = " order by $order $sort";


====================================================
Index: hrm/inc/class.acl2.inc.php
diff -u hrm/inc/class.acl2.inc.php:1.4 hrm/inc/class.acl2.inc.php:1.5
--- hrm/inc/class.acl2.inc.php:1.4      Wed Nov 30 17:07:22 2005
+++ hrm/inc/class.acl2.inc.php  Thu Dec  1 14:37:55 2005
@@ -128,22 +128,24 @@

                        $sql = 'select * from hrm_acl join phpgw_accounts on 
hrm_acl.acl_account = phpgw_accounts.account_id where (acl_account in (';

-                       if(!$account_type || $account_type == 'accounts')
+                       if(!$account_type || $account_type == 'accounts' || 
$account_type == 'both')
                        {
-                               $sql .= $this->account_id.', 0';
+                               $account_list[] = $this->account_id;
+                               $account_list[] = 0;
                        }

-                       if($account_type == 'groups')
+                       if($account_type == 'groups' || $account_type == 'both')
                        {
                                $groups = 
$this->get_location_list_for_id('phpgw_group', 1, $this->account_id);
                                while($groups && (list($key,$value) = 
each($groups)))
                                {
-                                       $group_list[] = $value;
+                                       $account_list[] = $value;
                                }
-                               $group_list = implode(",",$group_list);
                        }

-                       $sql .= $group_list . '))';
+                       $account_list = implode(",",$account_list);
+
+                       $sql .= $account_list . '))';
                        $this->db->query($sql ,__LINE__,__FILE__);
                        $count = $this->db->num_rows();
                        $this->data = Array();
@@ -349,19 +351,15 @@
                */
                function check($location, $required, $appname = False)
                {
-                       $rights_right = 
$this->check_brutto($location,$required,$appname,$grantor=False,$type=0);
-                       $rights_mask = 
$this->check_brutto($location,$required,$appname,$grantor=False,$type=1);
-
-                       if(($rights_mask > $rights_right) && $rights_right > 0)
+                       $rights = 
$this->check_brutto($location,$required,$appname,$grantor=False,$type=0,$account_type);
+                       $mask = 
$this->check_brutto($location,$required,$appname,$grantor=False,$type=1,$account_type);
+
+                       if($mask > 0 && $rights > 0)
                        {
-                               $rights = $rights_mask - $rights_right;
+                               unset($rights);
                        }
-                       else
-                       {
-                               $rights = $rights_right;

-                       }
-                       return !!($rights & $required);
+                       return $rights;
                }

                /**
@@ -392,7 +390,7 @@
                        }
                        else
                        {
-                               $rights = 
$this->get_rights($location,$appname,$grantor,$type);
+                               $rights = 
$this->get_rights($location,$appname,$grantor,$type,'both');
                        }
                        return !!($rights & $required);
                }
@@ -835,7 +833,8 @@
                                reset($accounts[$grantor]);
                        }
                        if($type==0)
-                       {                               
$grants[$GLOBALS['phpgw_info']['user']['account_id']] = 31;
+                       {
+                               
$grants[$GLOBALS['phpgw_info']['user']['account_id']] = 31;
                        }
                        else
                        {






reply via email to

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