mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
* ProjectManager: allow datasources (eg. InfoLog) to set element category, update existing categories in elements to overwritten categories
This commit is contained in:
parent
aa58708ffd
commit
3aac26d1ab
@ -24,7 +24,7 @@ class calendar_datasource extends datasource
|
||||
{
|
||||
$this->datasource('calendar');
|
||||
|
||||
$this->valid = PM_PLANNED_START|PM_PLANNED_END|PM_PLANNED_TIME|PM_RESOURCES;
|
||||
$this->valid = PM_PLANNED_START|PM_PLANNED_END|PM_PLANNED_TIME|PM_RESOURCES|PM_CAT_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,6 +60,15 @@ class calendar_datasource extends datasource
|
||||
'pe_resources' => array(),
|
||||
'pe_details' => $data['description'] ? nl2br($data['description']) : '',
|
||||
);
|
||||
// return first global category, as PM only supports one
|
||||
foreach($data['category'] ? explode(',', $data['category']) : array() as $cat_id)
|
||||
{
|
||||
if (categories::is_global($cat_id))
|
||||
{
|
||||
$ds['cat_id'] = $cat_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// calculation of the time
|
||||
$ds['pe_planned_time'] = (int) (($ds['pe_planned_end'] - $ds['pe_planned_start'])/60); // time is in minutes
|
||||
|
||||
|
@ -39,7 +39,7 @@ class infolog_datasource extends datasource
|
||||
{
|
||||
parent::__construct('infolog');
|
||||
|
||||
$this->valid = PM_COMPLETION|PM_PLANNED_START|PM_PLANNED_END|PM_REAL_END|PM_PLANNED_TIME|PM_REPLANNED_TIME|PM_USED_TIME|PM_RESOURCES;
|
||||
$this->valid = PM_COMPLETION|PM_PLANNED_START|PM_PLANNED_END|PM_REAL_END|PM_PLANNED_TIME|PM_REPLANNED_TIME|PM_USED_TIME|PM_RESOURCES|PM_CAT_ID;
|
||||
|
||||
// we use $GLOBALS['infolog_bo'] as an already running instance might be availible there
|
||||
if (!is_object($GLOBALS['infolog_bo']))
|
||||
@ -84,6 +84,7 @@ class infolog_datasource extends datasource
|
||||
'pe_planned_budget' => $data['info_planned_time'] / 60 * $data['info_price'],
|
||||
'pe_used_quantity' => $data['info_used_time'] / 60,
|
||||
'pe_used_budget' => $data['info_used_time'] / 60 * $data['info_price'],
|
||||
'cat_id' => $data['info_cat'],
|
||||
);
|
||||
}
|
||||
|
||||
@ -146,7 +147,7 @@ class infolog_datasource extends datasource
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Callback called after copying of all datasource, used to:
|
||||
* - fix parent id's
|
||||
|
@ -25,7 +25,7 @@ class timesheet_datasource extends datasource
|
||||
parent::__construct(TIMESHEET_APP);
|
||||
|
||||
$this->valid = PM_REAL_START|PM_REAL_END|PM_USED_TIME|PM_USED_BUDGET|PM_USED_QUANTITY|
|
||||
PM_PRICELIST_ID|PM_UNITPRICE|PM_RESOURCES|PM_DETAILS|PM_COMPLETION;
|
||||
PM_PRICELIST_ID|PM_UNITPRICE|PM_RESOURCES|PM_DETAILS|PM_COMPLETION|PM_CAT_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,6 +62,7 @@ class timesheet_datasource extends datasource
|
||||
'pe_used_quantity' => $data['ts_quantity'],
|
||||
'pe_used_budget' => $data['ts_quantity'] * $data['ts_unitprice'],
|
||||
'pe_completion' => 100,
|
||||
'cat_id' => $data['cat_id'],
|
||||
);
|
||||
if ($data['ts_duration'])
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user