mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
small fix for the etag & uid handling of new entries
This commit is contained in:
parent
163b795d45
commit
69d7ee916d
@ -529,6 +529,7 @@ class bocontacts extends socontacts
|
||||
if(!($this->error = parent::save($to_write)) && is_object($GLOBALS['egw']->contenthistory))
|
||||
{
|
||||
$contact['id'] = $to_write['id'];
|
||||
$contact['uid'] = $to_write['uid'];
|
||||
$contact['etag'] = $to_write['etag'];
|
||||
$GLOBALS['egw']->contenthistory->updateTimeStamp('contacts', $contact['id'],$isUpdate ? 'modify' : 'add', time());
|
||||
|
||||
|
@ -464,6 +464,7 @@ class socontacts
|
||||
if (!($error_nr = $this->somain->save()))
|
||||
{
|
||||
$contact['id'] = $this->somain->data['id'];
|
||||
$contact['uid'] = $this->somain->data['uid'];
|
||||
$contact['etag'] = $this->somain->data['etag'];
|
||||
|
||||
if ($this->contact_repository == 'sql-ldap')
|
||||
|
@ -610,7 +610,7 @@ class socontacts_sql extends so_sql
|
||||
{
|
||||
if (is_array($keys) && count($keys)) $this->data_merge($keys);
|
||||
|
||||
if (isset($this->data['etag']))
|
||||
if (isset($this->data['etag'])) // do we have an etag in the data to write
|
||||
{
|
||||
$etag = $this->data['etag'];
|
||||
unset($this->data['etag']);
|
||||
@ -625,11 +625,17 @@ class socontacts_sql extends so_sql
|
||||
}
|
||||
else
|
||||
{
|
||||
$err = parent::save();
|
||||
$new_entry = !$this->data['id'];
|
||||
if (!($err = parent::save(array('contact_etag=contact_etag+1'))) && $new_entry)
|
||||
{
|
||||
$this->data['etag'] = 0;
|
||||
}
|
||||
}
|
||||
if (!$err && !$this->data['uid'])
|
||||
{
|
||||
$this->update(array('uid' => common::generate_uid('addressbook',$this->data['id'])));
|
||||
parent::update(array('uid' => common::generate_uid('addressbook',$this->data['id'])));
|
||||
$this->data['etag']++;
|
||||
//echo "<p>set uid={$this->data['uid']}, etag={$this->data['etag']}</p>";
|
||||
}
|
||||
return $err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user