fix for bug reported by Patrick Fraley: status changes of responsible user do not get save, if that user has no write grant

This commit is contained in:
Ralf Becker 2004-07-08 13:26:06 +00:00
parent b24f796eb2
commit 517865a274

View File

@ -281,7 +281,18 @@
function write($values,$check_defaults=True,$touch_modified=True) function write($values,$check_defaults=True,$touch_modified=True)
{ {
if ($values['info_id'] && !$this->check_access($values['info_id'],PHPGW_ACL_EDIT) || foreach($values as $key => $val)
{
if ($key[0] != '#' && substr($key,0,5) != 'info_')
{
$values['info_'.$key] = $val;
unset($values[$key]);
}
}
$status_only = $values['info_id'] && $values['info_responsible'] == $this->user &&
!$this->check_access($values['info_id'],PHPGW_ACL_EDIT); // responsible has implicit right to change status
if ($values['info_id'] && !$this->check_access($values['info_id'],PHPGW_ACL_EDIT) && !$status_only ||
!$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],PHPGW_ACL_ADD)) !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],PHPGW_ACL_ADD))
{ {
if ($this->xmlrpc) if ($this->xmlrpc)
@ -294,13 +305,20 @@
{ {
$values = $this->xmlrpc2data($values); $values = $this->xmlrpc2data($values);
} }
foreach($values as $key => $val) if ($status_only) // make sure only status gets writen
{ {
if ($key[0] != '#' && substr($key,0,5) != 'info_') $set_enddate = !$values['info_enddate'] && // set enddate of finished job, only if its not already set
($values['info_status'] == 'done' || $values['info_status'] == 'billed');
$values = array(
'info_id' => $values['info_id'],
'info_status' => $values['info_status'],
);
if ($set_enddate)
{ {
$values['info_'.$key] = $val; $values['info_enddate'] = time();
unset($values[$key]);
} }
$check_defaults = False;
} }
if ($check_defaults) if ($check_defaults)
{ {