phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] hrm/inc class.uijob.inc.php, 1.11 class.bojob.inc.php


From: sigurdne
Subject: [Phpgroupware-cvs] hrm/inc class.uijob.inc.php, 1.11 class.bojob.inc.php, 1.11 class.souser.inc.php, 1.8 class.sojob.inc.php, 1.12 class.bocommon.inc.php, 1.7
Date: Fri, 2 Dec 2005 18:10:00 +0100

Update of hrm/inc

Modified Files:
     Branch: MAIN
            class.uijob.inc.php lines: +60 -86
            class.bojob.inc.php lines: +11 -1
            class.souser.inc.php lines: +3 -2
            class.sojob.inc.php lines: +163 -17
            class.bocommon.inc.php lines: +21 -1

Log Message:
no message

====================================================
Index: hrm/inc/class.uijob.inc.php
diff -u hrm/inc/class.uijob.inc.php:1.10 hrm/inc/class.uijob.inc.php:1.11
--- hrm/inc/class.uijob.inc.php:1.10    Thu Dec  1 14:37:55 2005
+++ hrm/inc/class.uijob.inc.php Fri Dec  2 17:10:28 2005
@@ -38,7 +38,6 @@
                        'delete_job'                    => True,
                        'reset_job_type_hierarchy'      => True,
                        'lookup_task'                   => True,
-                       'no_access'                     => True
                );

                function uijob()
@@ -73,35 +72,13 @@
                        $this->bo->save_sessiondata($data);
                }

-
-
-               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);
+                               $this->bocommon->no_access($links);
                                return;
                        }

@@ -239,7 +216,7 @@
                {
                        if(!$this->acl->check('job', PHPGW_ACL_READ))
                        {
-                               $this->no_access($links);
+                               $this->bocommon->no_access($links);
                                return;
                        }

@@ -369,41 +346,27 @@
                        $GLOBALS['phpgw_info']['flags']['noframework'] = True;
                        $GLOBALS['phpgw_info']['flags']['headonly']=true;

-                       $job_id = get_var('job_id',array('POST','GET'));

                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','hrm_task_receipt');
                        
$GLOBALS['phpgw']->session->appsession('session_data','hrm_task_receipt','');

-                       $GLOBALS['phpgw']->xslttpl->add_file(array('job'));
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('job','nextmatchs','search_field'));

-                       if ($job_id)
-                       {
-                               $job_info = $this->bo->read_single_job($job_id);
-                               $task = $this->bo->read_task($job_id);
-                       }
+                       $task = $this->bo->read_task_type();

                        $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];

                        while (is_array($task) && list(,$entry) = each($task))
                        {

-                               if($entry['start_date'])
-                               {
-                                       $entry['start_date']    = 
$GLOBALS['phpgw']->common->show_date($entry['start_date'],$dateformat);
-                               }
-                               if($entry['end_date'])
-                               {
-                                       $entry['end_date']      = 
$GLOBALS['phpgw']->common->show_date($entry['end_date'],$dateformat);
-                               }
-
                                $content[] = array
                                (
-                                       'id'                    => 
$entry['task_id'],
+                                       'id'                    => $entry['id'],
                                        'name'                  => 
$entry['name'],
                                        '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']),
+//                                     'link_edit'             => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.".uijob.edit_task_type&id="
 . $entry['id']),
+//                                     'link_view'             => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.".uijob.edit_task_type&id="
 . $entry['id']),
+//                                     'link_delete'           => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.".uijob.edit_task_type&id="
 . $entry['id']),
                                        'lang_select'           => 
lang('select'),
                                        'text_delete'           => 
lang('delete')
                                );
@@ -412,26 +375,12 @@

                        $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,
-                                                                               
        'var'   =>      'hrm_task.name',
+                                                                               
        'var'   =>      'name',
                                                                                
        'order' =>      $this->order,
-                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uijob.task',
-                                                                               
                                'job_id'        =>$job_id,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uijob.lookup_task',
                                                                                
                                'query'         =>$this->query,
                                                                                
                                'cat_id'        =>$this->cat_id,
                                                                                
                                'allrows' => $this->allrows)
@@ -449,45 +398,69 @@
                        $function_msg = lang('list task');


+                       if(!$this->allrows)
+                       {
+                               $record_limit   = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       }
+                       else
+                       {
+                               $record_limit   = $this->bo->total_records;
+                       }
+
                        $link_data = array
                        (
-                               'menuaction'    => 
$this->currentapp.'.uijob.edit_task',
-                               'job_id'        => $job_id
+                               'menuaction'    => 
$this->currentapp.'.uijob.lookup_task',
+                                               'sort'                  
=>$this->sort,
+                                               'order'                 
=>$this->order,
+                                               'cat_id'                
=>$this->cat_id,
+                                               'filter'                
=>$this->filter,
+                                               'query'                 
=>$this->query
                        );

                        $table_add[] = array
                        (
                                'lang_add'                      => lang('add'),
                                'lang_add_task_text'    => lang('add a task 
item'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.edit_task&job_id='.$job_id),
+                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.edit_task_type&job_id='.$job_id),
                                'lang_done'                     => lang('done'),
                                'lang_done_task_text'   => lang('back to user 
list'),
-                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.index')
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uijob.lookup_task')
                        );


-
                        $GLOBALS['phpgw_info']['flags']['java_script'] .= "\n"
                                . '<script language="JavaScript">' ."\n"
-                               . 'var userSelectBox = 
opener.document.forms["app_form"].elements[' . "'alternative_task[]'];" ."\n"
-                               . "\n"
-                               . 'function ExchangeTaskSelect(thisform)' ."\n"
+                               . 'function ExchangeTask(thisform)' ."\n"
                                . '{' ."\n"
-                                       . 'NewEntry = new 
Option(thisform.elements[1].value,thisform.elements[0].value,false,true);' ."\n"
-                                       . 
'userSelectBox.options[userSelectBox.length] = NewEntry;' ."\n"
+                               . 'opener.document.task_form.elements[' . 
"'values[task_type_id]']" . '.value = thisform.elements[0].value;' ."\n"
+                               . 'opener.document.task_form.elements[' . 
"'values[name]']" . '.value = thisform.elements[1].value;' ."\n"
+                               . 'opener.document.task_form.elements[' . 
"'values[descr]']" . '.value = thisform.elements[2].value;' ."\n"
+                               . 'window.close()' ."\n"
                                . '}' ."\n"
                                . "</script>\n";


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

                        $data = array
                        (
-                               'lang_job_name'                         => 
lang('Job name'),
-                               'value_job_name'                        => 
$job_info['name'],
-                               'table_header_lookup_task'                      
=> $table_header,
-                               'values_lookup_task'                            
=> $content,
+                               'allow_allrows'                                 
=> True,
+                               'allrows'                                       
=> $this->allrows,
+                               'start_record'                                  
=> $this->start,
+                               'record_limit'                                  
=> $record_limit,
+                               'num_records'                                   
=> count($task),
+                               'all_records'                                   
=> $this->bo->total_records,
+                               'link_url'                                      
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'img_path'                                      
=> $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'),
+                               'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
+                               'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
+                               'query'                                         
=> $this->query,
+                               'lang_search'                                   
=> lang('search'),
+
+                               'lang_name_status_text'                 => 
lang('Enter the name of the task-type'),
+
+                               'table_header_lookup_task'              => 
$table_header,
+                               'values_lookup_task'                    => 
$content,
                                'table_add'                             => 
$table_add,
                                'user_values'                           => 
$user_values,
                                'msgbox_data'                           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
@@ -524,7 +497,7 @@
                        {
                                if(!$this->acl->check('job', PHPGW_ACL_ADD))
                                {
-                                       $this->no_access($links);
+                                       $this->bocommon->no_access($links);
                                        return;
                                }
                        }
@@ -532,7 +505,7 @@
                        {
                                if(!$this->acl->check('job', PHPGW_ACL_EDIT))
                                {
-                                       $this->no_access($links);
+                                       $this->bocommon->no_access($links);
                                        return;
                                }
                        }
@@ -645,7 +618,7 @@

                        if(!$this->acl->check('job', PHPGW_ACL_READ))
                        {
-                               $this->no_access($links);
+                               $this->bocommon->no_access($links);
                                return;
                        }

@@ -717,7 +690,7 @@
                        {
                                if(!$this->acl->check('job', PHPGW_ACL_ADD))
                                {
-                                       $this->no_access($links);
+                                       $this->bocommon->no_access($links);
                                        return;
                                }
                        }
@@ -725,7 +698,7 @@
                        {
                                if(!$this->acl->check('job', PHPGW_ACL_EDIT))
                                {
-                                       $this->no_access($links);
+                                       $this->bocommon->no_access($links);
                                        return;
                                }
                        }
@@ -822,6 +795,7 @@

                        $data = array
                        (
+                               'value_task_type_id'                    => 
$values['task_type_id'],
                                'value_descr'                           => 
$values['descr'],
                                'value_name'                            => 
$values['name'],
                                'value_entry_date'                      => 
$values['entry_date'],
@@ -875,7 +849,7 @@

                        if(!$this->acl->check('job', PHPGW_ACL_READ))
                        {
-                               $this->no_access($links);
+                               $this->bocommon->no_access($links);
                                return;
                        }

@@ -942,7 +916,7 @@
                {
                        if(!$this->acl->check('job', PHPGW_ACL_DELETE))
                        {
-                               $this->no_access($links);
+                               $this->bocommon->no_access($links);
                                return;
                        }

@@ -983,7 +957,7 @@
                {
                        if(!$this->acl->check('job', PHPGW_ACL_DELETE))
                        {
-                               $this->no_access($links);
+                               $this->bocommon->no_access($links);
                                return;
                        }

@@ -1027,7 +1001,7 @@
                {
                        if(!$this->acl->check('job', PHPGW_ACL_DELETE))
                        {
-                               $this->no_access($links);
+                               $this->bocommon->no_access($links);
                                return;
                        }


====================================================
Index: hrm/inc/class.bojob.inc.php
diff -u hrm/inc/class.bojob.inc.php:1.10 hrm/inc/class.bojob.inc.php:1.11
--- hrm/inc/class.bojob.inc.php:1.10    Thu Dec  1 14:37:55 2005
+++ hrm/inc/class.bojob.inc.php Fri Dec  2 17:10:28 2005
@@ -148,6 +148,8 @@
                        $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));

+                       $this->total_records = $this->so->total_records;
+
                        for ($i=0;$i<count($task_list);$i++)
                        {
                                if ($task_list[$i]['level'] > 0)
@@ -158,6 +160,14 @@
                                }
                        }

+                       return $task_list;
+               }
+
+               function read_task_type()
+               {
+                       $task_list = $this->so->read_task_type(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                                                                               
        'allrows'=>$this->allrows));
+                       $this->total_records = $this->so->total_records;
                        return $task_list;
                }


====================================================
Index: hrm/inc/class.souser.inc.php
diff -u hrm/inc/class.souser.inc.php:1.7 hrm/inc/class.souser.inc.php:1.8
--- hrm/inc/class.souser.inc.php:1.7    Thu Dec  1 14:37:55 2005
+++ hrm/inc/class.souser.inc.php        Fri Dec  2 17:10:28 2005
@@ -107,7 +107,8 @@

                        while ($this->db->next_record())
                        {
-                               $ngrants = 
$this->grants[$this->db->f('account_id')];                           
$account_info[] = array
+                               $ngrants = 
$this->grants[$this->db->f('account_id')];
+                               $account_info[] = array
                                (
                                        'account_id'            => 
$this->db->f('account_id'),
                                        'account_firstname'     => 
stripslashes($this->db->f('account_firstname')),

====================================================
Index: hrm/inc/class.sojob.inc.php
diff -u hrm/inc/class.sojob.inc.php:1.11 hrm/inc/class.sojob.inc.php:1.12
--- hrm/inc/class.sojob.inc.php:1.11    Thu Dec  1 14:37:55 2005
+++ hrm/inc/class.sojob.inc.php Fri Dec  2 17:10:28 2005
@@ -221,7 +221,7 @@
                        }


-                       $sql = "SELECT * from hrm_task WHERE job_id=" . 
intval($job_id);
+                       $sql = "SELECT * , hrm_task.id as task_id from hrm_task 
$this->join hrm_task_type ON hrm_task.task_type_id = hrm_task_type.id WHERE 
job_id=" . intval($job_id);

                        $parent_select = ' AND (is_parent =1 OR (is_parent != 1 
AND task_parent IS NULL))';

@@ -241,7 +241,7 @@
                        {
                                $tasks[] = array
                                (
-                                       'task_id'       => $this->db->f('id'),
+                                       'task_id'       => 
$this->db->f('task_id'),
                                        'level' => 0,
                                        'name'  => 
stripslashes($this->db->f('name')),
                                        'descr' => 
stripslashes($this->db->f('descr')),
@@ -262,7 +262,7 @@
                                $j = 0;
                                while ($this->db->next_record())
                                {
-                                       $subtasks[$j]['task_id']          = 
(int)$this->db->f('id');
+                                       $subtasks[$j]['task_id']          = 
(int)$this->db->f('task_id');
                                        $subtasks[$j]['level']       = 1;
                                        $subtasks[$j]['parent']      = 
(int)$this->db->f('task_parent');
                                        $subtasks[$j]['name']        = 
$this->db->f('name');
@@ -300,13 +300,14 @@
                function read_single_task($id)
                {

-                       $sql = 'SELECT * FROM hrm_task where id=' . intval($id);
+                       $sql = "SELECT * , hrm_task_type.id as task_type_id 
FROM hrm_task $this->join hrm_task_type ON hrm_task.task_type_id = 
hrm_task_type.id WHERE hrm_task.id=" . intval($id);

                        $this->db->query($sql,__LINE__,__FILE__);

                        if ($this->db->next_record())
                        {
                                $values['id']           = $id;
+                               $values['task_type_id'] = 
$this->db->f('task_type_id');
                                $values['name']         = 
stripslashes($this->db->f('name'));
                                $values['descr']        = 
stripslashes($this->db->f('descr'));
                                $values['job_id']       = 
$this->db->f('job_id');
@@ -319,6 +320,73 @@
                        return $values;
                }

+               function read_task_type($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']:'');
+                       }
+
+                       if ($order)
+                       {
+                               $ordermethod = " order by $order $sort";
+
+                       }
+                       else
+                       {
+                               $ordermethod = ' order by name asc';
+                       }
+
+                       $table = 'hrm_task_type';
+
+                       if($query)
+                       {
+                               $query = ereg_replace("'",'',$query);
+                               $query = ereg_replace('"','',$query);
+
+                               $querymethod = " WHERE name $this->like 
'%$query%'";
+                       }
+
+                       $sql = "SELECT * FROM $table $filtermethod 
$querymethod";
+
+                       $this->db2->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db2->num_rows();
+
+                       if(!$allrows)
+                       {
+                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
+
+                       while ($this->db->next_record())
+                       {
+                               $task_type[] = array
+                               (
+                                       'id'    => $this->db->f('id'),
+                                       'name'  => 
stripslashes($this->db->f('name')),
+                                       'descr' => 
stripslashes($this->db->f('descr')),
+                               );
+                       }
+
+                       return $task_type;
+               }
+
+
+
                function add_job($values)
                {
                        $table = 'hrm_job';
@@ -537,6 +605,44 @@
                        $this->db->query($sql,__LINE__,__FILE__);
                }

+
+
+               function add_task_type($values)
+               {
+                       $values['id'] = 
$this->bocommon->next_id('hrm_task_type');
+
+                       $insert_values=array(
+                               $values['id'],
+                               $values['name'],
+                               $values['descr'],
+                               time(),
+                               $this->account
+                               );
+
+                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                       $this->db->query("INSERT INTO hrm_task_type 
(id,name,descr,entry_date,type_owner) "
+                               . "VALUES ($insert_values)",__LINE__,__FILE__);
+
+                       return $values['id'];
+               }
+
+
+               function check_task_type($values)
+               {
+                       $sql = "SELECT * FROM  hrm_task_type WHERE id=" . 
intval($values['task_type_id']);
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                        if($this->db->next_record())
+                        {
+                               if ($values['name'] == 
stripslashes($this->db->f('name')) && $values['descr'] == 
stripslashes($this->db->f('descr')))
+                               {
+                                       return True;
+                               }
+                        }
+
+                        return False;
+               }
+
                function add_task($values)
                {
                        $values['descr'] = 
$this->db->db_addslashes($values['descr']);
@@ -544,21 +650,36 @@

                        $this->db->transaction_begin();

+
+                       if($values['task_type_id'])
+                       {
+                               if(!$this->check_task_type($values))
+                               {
+                                       unset($values['task_type_id']);
+                               }
+                       }
+                       if($values['name'] && !$values['task_type_id'])
+                       {
+                               $values['task_type_id'] = 
$this->add_task_type($values);
+                               $receipt['message'][]=array('msg'=>lang('task 
type item has been saved'));
+                       }
+
                        $task_id = $this->bocommon->next_id('hrm_task');

                        $insert_values=array(
                                $task_id,
                                $values['job_id'],
-                               $values['name'],
-                               $values['descr'],
-                               $values['cat_id'],                              
$values['skill_id'],
-                               $values['experience_id'],                       
        time(),
+                               $values['task_type_id'],
+                               $values['cat_id'],
+                               $values['skill_id'],
+                               $values['experience_id'],
+                               time(),
                                $this->account
                                );

                        $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);

-                       $this->db->query("INSERT INTO hrm_task 
(id,job_id,name,descr,category,skill_id,experience_id,entry_date,task_owner) "
+                       $this->db->query("INSERT INTO hrm_task 
(id,job_id,task_type_id,category,skill_id,experience_id,entry_date,task_owner) "
                                . "VALUES ($insert_values)",__LINE__,__FILE__);

                        if(is_array($values['alternative_task']))
@@ -572,7 +693,7 @@
                        }
                        else
                        {
-                               $this->db->query("UPDATE hrm_task set is_parent 
= 0 WHERE id= " . $values['task_id'],__LINE__,__FILE__);
+                               $this->db->query("UPDATE hrm_task set is_parent 
= 0 WHERE id=" . (int)$task_id,__LINE__,__FILE__);
                        }

                        $receipt['message'][]=array('msg'=>lang('task item has 
been saved'));
@@ -585,12 +706,30 @@

                function edit_task($values)
                {
+                       $values['descr'] = 
$this->db->db_addslashes($values['descr']);
+                       $values['name'] = 
$this->db->db_addslashes($values['name']);
+
                        $this->db->transaction_begin();

-                       $value_set['descr']                     = 
$this->db->db_addslashes($values['descr']);
-                       $value_set['name']                      = 
$this->db->db_addslashes($values['name']);
+                       if($values['task_type_id'])
+                       {
+                               if(!$this->check_task_type($values))
+                               {
+                                       unset($values['task_type_id']);
+                               }
+                       }
+
+                       if($values['name'] && !$values['task_type_id'])
+                       {
+                               $values['task_type_id'] = 
$this->add_task_type($values);
+                               $receipt['message'][]=array('msg'=>lang('task 
type item has been saved'));
+                       }
+
+                       $value_set['task_type_id']              = 
$values['task_type_id'];
                        $value_set['category']                  = 
$values['cat_id'];
-                       $value_set['skill_id']                  = 
$values['skill_id'];                  $value_set['experience_id']             = 
$values['experience_id'];
+                       $value_set['skill_id']                  = 
$values['skill_id'];
+                       $value_set['experience_id']             = 
$values['experience_id'];
+
                        $value_set      = 
$this->bocommon->validate_db_update($value_set);

                        $table='hrm_task';
@@ -623,11 +762,15 @@

                function select_task_list($job_id,$task_id='')
                {
-                       $sql = "SELECT * from hrm_task WHERE job_id=" . 
intval($job_id);
+                       $sql = "SELECT * ,hrm_task.id as task_id from hrm_task 
$this->join hrm_task_type ON hrm_task.task_type_id = hrm_task_type.id 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 ))";
+                               $sql .= " AND hrm_task.id != $task_id AND 
(is_parent !=1 AND (task_parent is null or task_parent = $task_id ))";
+                       }
+                       else
+                       {
+                               $sql .= " AND (is_parent !=1 AND (task_parent 
is null))";
                        }

                        $this->db->query($sql,__LINE__,__FILE__);
@@ -635,7 +778,7 @@
                        $i=0;
                        while ($this->db->next_record())
                        {
-                               $task_list[$i]['id']    = $this->db->f('id');
+                               $task_list[$i]['id']    = 
$this->db->f('task_id');
                                $task_list[$i]['name']  = 
stripslashes($this->db->f('name'));
                                if($this->db->f('task_parent'))
                                {
@@ -649,6 +792,9 @@

                function delete_task($job_id,$id)
                {
+                       $this->db->transaction_begin();
+                       $this->db->query('UPDATE hrm_task set task_parent = 
NULL WHERE task_parent = '  . intval($id) . ' AND job_id='  . 
intval($job_id),__LINE__,__FILE__);
                        $this->db->query('DELETE FROM hrm_task WHERE id='  . 
intval($id) . ' AND job_id='  . intval($job_id),__LINE__,__FILE__);
+                       $this->db->transaction_commit();
                }
        }

====================================================
Index: hrm/inc/class.bocommon.inc.php
diff -u hrm/inc/class.bocommon.inc.php:1.6 hrm/inc/class.bocommon.inc.php:1.7
--- hrm/inc/class.bocommon.inc.php:1.6  Wed Nov 30 17:07:22 2005
+++ hrm/inc/class.bocommon.inc.php      Fri Dec  2 17:10:28 2005
@@ -654,4 +654,24 @@
                        }
                        $workbook->close();
                }
+
+               function no_access($links = '')
+               {
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('no_access','menu'));
+
+                       $receipt['error'][]=array('msg'=>lang('NO ACCESS'));
+
+                       $msgbox_data = $this->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));
+               }
        }






reply via email to

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