mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-18 20:51:23 +01:00
* LDAP/AD: fix local uploaded pictures are lost when automatic import is used
This commit is contained in:
parent
b5eaf08d65
commit
71ca036f67
@ -430,6 +430,8 @@ class Import
|
|||||||
$to_update = array_merge($sql_contact, array_filter($contact, static function ($attr) {
|
$to_update = array_merge($sql_contact, array_filter($contact, static function ($attr) {
|
||||||
return $attr !== null && $attr !== '';
|
return $attr !== null && $attr !== '';
|
||||||
}));
|
}));
|
||||||
|
// files need to be or'ed with the sql value, as otherwise e.g. picture would disappear
|
||||||
|
$to_update['files'] |= $sql_contact['files'];
|
||||||
unset($to_update['account_id']); // no need to update, specially as account_id might be different!
|
unset($to_update['account_id']); // no need to update, specially as account_id might be different!
|
||||||
$to_update['id'] = $sql_contact['id'];
|
$to_update['id'] = $sql_contact['id'];
|
||||||
if (($diff = array_diff_assoc($to_update, $sql_contact)))
|
if (($diff = array_diff_assoc($to_update, $sql_contact)))
|
||||||
@ -457,6 +459,9 @@ class Import
|
|||||||
}
|
}
|
||||||
Api\Vfs::$is_root = false;
|
Api\Vfs::$is_root = false;
|
||||||
*/
|
*/
|
||||||
|
// photo_unchanged=true must be set, to no delete the photo, if it's not in LDAP
|
||||||
|
$this->contacts_sql->data['photo_unchanged'] = !isset($diff['files']) ||
|
||||||
|
($to_update['files']&Api\Contacts::FILES_BIT_PHOTO) === ($sql_contact['files']&Api\Contacts::FILES_BIT_PHOTO);
|
||||||
if ($need_update && $this->contacts_sql->save($to_update))
|
if ($need_update && $this->contacts_sql->save($to_update))
|
||||||
{
|
{
|
||||||
$this->logger("Error updating contact data of '$account[account_lid]' (#$account_id)", 'error');
|
$this->logger("Error updating contact data of '$account[account_lid]' (#$account_id)", 'error');
|
||||||
|
Loading…
Reference in New Issue
Block a user