[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] hrm/inc class.uijob.inc.php, 1.12 class.sojob.inc.php
From: |
sigurdne |
Subject: |
[Phpgroupware-cvs] hrm/inc class.uijob.inc.php, 1.12 class.sojob.inc.php, 1.13 class.bojob.inc.php, 1.12 |
Date: |
Fri, 2 Dec 2005 23:40:00 +0100 |
Update of hrm/inc
Modified Files:
Branch: MAIN
class.uijob.inc.php lines: +108 -5
class.sojob.inc.php lines: +36 -16
class.bojob.inc.php lines: +34 -1
Log Message:
no message
====================================================
Index: hrm/inc/class.uijob.inc.php
diff -u hrm/inc/class.uijob.inc.php:1.11 hrm/inc/class.uijob.inc.php:1.12
--- hrm/inc/class.uijob.inc.php:1.11 Fri Dec 2 17:10:28 2005
+++ hrm/inc/class.uijob.inc.php Fri Dec 2 22:40:13 2005
@@ -38,6 +38,7 @@
'delete_job' => True,
'reset_job_type_hierarchy' => True,
'lookup_task' => True,
+ 'edit_task_type' => True
);
function uijob()
@@ -73,7 +74,7 @@
}
function index()
- {
+ {
$links = $this->menu->links('job_type');
if(!$this->acl->check('job', PHPGW_ACL_READ))
@@ -346,7 +347,6 @@
$GLOBALS['phpgw_info']['flags']['noframework'] = True;
$GLOBALS['phpgw_info']['flags']['headonly']=true;
-
$receipt =
$GLOBALS['phpgw']->session->appsession('session_data','hrm_task_receipt');
$GLOBALS['phpgw']->session->appsession('session_data','hrm_task_receipt','');
@@ -439,7 +439,6 @@
. '}' ."\n"
. "</script>\n";
-
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
@@ -461,7 +460,12 @@
'table_header_lookup_task' =>
$table_header,
'values_lookup_task' =>
$content,
- 'table_add' =>
$table_add,
+// 'table_add' =>
$table_add,
+
+ '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_type'),
+
'user_values' =>
$user_values,
'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
@@ -485,6 +489,105 @@
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('lookup_task' => $data));
+ }
+
+
+ function edit_task_type()
+ {
+ $GLOBALS['phpgw_info']['flags']['noframework'] = True;
+ $GLOBALS['phpgw_info']['flags']['headonly']=true;
+
+ $task_type_id =
get_var('task_type_id',array('POST','GET'));
+ $values = get_var('values',array('POST'));
+
+ $GLOBALS['phpgw']->xslttpl->add_file(array('job'));
+
+ if (is_array($values))
+ {
+ if ($values['save'] || $values['apply'])
+ {
+
+ if(!$values['name'])
+ {
+
$receipt['error'][]=array('msg'=>lang('Please enter a name !'));
+ }
+
+ if($task_type_id)
+ {
+
$values['task_type_id']=$task_type_id;
+ $action='edit';
+ }
+
+ if(!$receipt['error'])
+ {
+ $receipt =
$this->bo->save_task_type($values,$action);
+ $task_type_id =
$receipt['task_type_id'];
+
+ if ($values['save'])
+ {
+
$GLOBALS['phpgw']->session->appsession('session_data','hrm_task_type_receipt',$receipt);
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uijob.lookup_task');
+ }
+ }
+ }
+ else
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php','menuaction='.$this->currentapp.'.uijob.lookup_task');
+ }
+ }
+
+
+ if ($task_type_id)
+ {
+ if(!$receipt['error'])
+ {
+ $values =
$this->bo->read_single_task_type($task_type_id);
+ }
+ $function_msg = lang('edit task type');
+ $action='edit';
+ }
+ else
+ {
+ $function_msg = lang('add task type');
+ $action='add';
+ }
+
+ $link_data = array
+ (
+ 'menuaction' =>
$this->currentapp.'.uijob.edit_task_type',
+ 'task_type_id' => $task_type_id
+ );
+
+ $msgbox_data = $this->bocommon->msgbox_data($receipt);
+
+
+ $data = array
+ (
+ 'value_title' =>
$values['title'],
+ 'value_entry_date' =>
$values['entry_date'],
+ 'value_name' =>
$values['name'],
+ 'value_descr' =>
$values['descr'],
+ 'lang_entry_date' =>
lang('Entry date'),
+ 'lang_name'
=> lang('name'),
+ 'lang_descr' =>
lang('descr'),
+ 'lang_descr_status_text' => lang('Enter
a description'),
+
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php',$link_data),
+ 'lang_id'
=> lang('task type ID'),
+ 'lang_save'
=> lang('save'),
+ 'lang_cancel' =>
lang('cancel'),
+ 'value_id'
=> $task_type_id,
+ 'lang_done_status_text' => lang('Back
to the list'),
+ 'lang_save_status_text' => lang('Save
the training'),
+ 'lang_apply' =>
lang('apply'),
+ 'lang_apply_status_text' => lang('Apply
the values'),
+ );
+
+ $appname =
lang('Place');
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang($this->currentapp) . ' - ' . $appname . ': ' . $function_msg;
+
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_task_type' => $data));
}
function edit_job()
====================================================
Index: hrm/inc/class.sojob.inc.php
diff -u hrm/inc/class.sojob.inc.php:1.12 hrm/inc/class.sojob.inc.php:1.13
--- hrm/inc/class.sojob.inc.php:1.12 Fri Dec 2 17:10:28 2005
+++ hrm/inc/class.sojob.inc.php Fri Dec 2 22:40:13 2005
@@ -222,7 +222,7 @@
$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))';
if($query)
@@ -320,6 +320,23 @@
return $values;
}
+ function read_single_task_type($id)
+ {
+ $sql = "SELECT * FROM hrm_task_type WHERE id=" .
intval($id);
+
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ if ($this->db->next_record())
+ {
+ $values['task_type_id'] = $id;
+ $values['name'] =
stripslashes($this->db->f('name'));
+ $values['descr'] =
stripslashes($this->db->f('descr'));
+ $values['entry_date'] =
$this->db->f('entry_date');
+ $values['owner'] =
$this->db->f('type_owner');
+ }
+ return $values;
+ }
+
function read_task_type($data)
{
if(is_array($data))
@@ -605,14 +622,15 @@
$this->db->query($sql,__LINE__,__FILE__);
}
-
-
function add_task_type($values)
{
- $values['id'] =
$this->bocommon->next_id('hrm_task_type');
+ $values['descr'] =
$this->db->db_addslashes($values['descr']);
+ $values['name'] =
$this->db->db_addslashes($values['name']);
+
+ $values['task_type_id'] =
$this->bocommon->next_id('hrm_task_type');
$insert_values=array(
- $values['id'],
+ $values['task_type_id'],
$values['name'],
$values['descr'],
time(),
@@ -623,7 +641,10 @@
$this->db->query("INSERT INTO hrm_task_type
(id,name,descr,entry_date,type_owner) "
. "VALUES ($insert_values)",__LINE__,__FILE__);
- return $values['id'];
+ $receipt['message'][]=array('msg'=>lang('task type item
has been saved'));
+
+ $receipt['task_type_id']= $values['task_type_id'];
+ return $receipt;
}
@@ -639,18 +660,15 @@
return True;
}
}
-
+
return False;
}
function add_task($values)
{
- $values['descr'] =
$this->db->db_addslashes($values['descr']);
- $values['name'] =
$this->db->db_addslashes($values['name']);
-
$this->db->transaction_begin();
-
+/*
if($values['task_type_id'])
{
if(!$this->check_task_type($values))
@@ -664,6 +682,7 @@
$receipt['message'][]=array('msg'=>lang('task
type item has been saved'));
}
+*/
$task_id = $this->bocommon->next_id('hrm_task');
$insert_values=array(
@@ -711,6 +730,7 @@
$this->db->transaction_begin();
+/*
if($values['task_type_id'])
{
if(!$this->check_task_type($values))
@@ -724,12 +744,12 @@
$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 =
$this->bocommon->validate_db_update($value_set);
$table='hrm_task';
@@ -770,9 +790,9 @@
}
else
{
- $sql .= " AND (is_parent !=1 AND (task_parent
is null))";
+ $sql .= " AND (is_parent !=1 AND (task_parent
is null))";
}
-
+
$this->db->query($sql,__LINE__,__FILE__);
$i=0;
====================================================
Index: hrm/inc/class.bojob.inc.php
diff -u hrm/inc/class.bojob.inc.php:1.11 hrm/inc/class.bojob.inc.php:1.12
--- hrm/inc/class.bojob.inc.php:1.11 Fri Dec 2 17:10:28 2005
+++ hrm/inc/class.bojob.inc.php Fri Dec 2 22:40:13 2005
@@ -183,6 +183,18 @@
return $values;
}
+ function read_single_task_type($id)
+ {
+ $values =$this->so->read_single_task_type($id);
+ $dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+ if($values['entry_date'])
+ {
+ $values['entry_date'] =
$GLOBALS['phpgw']->common->show_date($values['entry_date'],$dateformat);
+ }
+ return $values;
+ }
+
function save_job($values,$action='')
{
if ($action=='edit')
@@ -219,6 +231,27 @@
else
{
$receipt = $this->so->add_task($values);
+ }
+
+ return $receipt;
+ }
+
+ function save_task_type($values,$action='')
+ {
+ if ($action=='edit')
+ {
+ if ($values['task_type_id'] != '')
+ {
+ $receipt =
$this->so->edit_task_type($values);
+ }
+ else
+ {
+
$receipt['error'][]=array('msg'=>lang('Error'));
+ }
+ }
+ else
+ {
+ $receipt = $this->so->add_task_type($values);
}
return $receipt;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] hrm/inc class.uijob.inc.php, 1.12 class.sojob.inc.php, 1.13 class.bojob.inc.php, 1.12,
sigurdne <=