mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-01-30 19:52:17 +01:00
Database backend: Lookup parent in updateContact() if not known.
This commit is contained in:
parent
6d4c0fb964
commit
9b6a2fde01
@ -452,7 +452,7 @@ class Database extends AbstractBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$query = 'SELECT `id`, `uri`, `carddata`, `lastmodified`, `fullname` AS `displayname` FROM `'
|
$query = 'SELECT `id`, `uri`, `carddata`, `lastmodified`, `addressbookid` AS `parent`, `fullname` AS `displayname` FROM `'
|
||||||
. $this->cardsTableName . '` WHERE ' . $where_query;
|
. $this->cardsTableName . '` WHERE ' . $where_query;
|
||||||
$stmt = \OCP\DB::prepare($query);
|
$stmt = \OCP\DB::prepare($query);
|
||||||
$result = $stmt->execute($ids);
|
$result = $stmt->execute($ids);
|
||||||
@ -598,10 +598,15 @@ class Database extends AbstractBackend {
|
|||||||
$data = $contact->serialize();
|
$data = $contact->serialize();
|
||||||
|
|
||||||
$updates = array($contact->FN, $data, time(), $id);
|
$updates = array($contact->FN, $data, time(), $id);
|
||||||
if(!$noCollection) {
|
|
||||||
|
if($noCollection) {
|
||||||
|
$me = $this->getContact(null, $id, true);
|
||||||
|
$addressbookid = $me['parent'];
|
||||||
|
}
|
||||||
|
//if(!$noCollection) {
|
||||||
$where_query .= ' AND `addressbookid` = ?';
|
$where_query .= ' AND `addressbookid` = ?';
|
||||||
$updates[] = $addressbookid;
|
$updates[] = $addressbookid;
|
||||||
}
|
//}
|
||||||
|
|
||||||
$query = 'UPDATE `' . $this->cardsTableName
|
$query = 'UPDATE `' . $this->cardsTableName
|
||||||
. '` SET `fullname` = ?,`carddata` = ?, `lastmodified` = ? WHERE ' . $where_query;
|
. '` SET `fullname` = ?,`carddata` = ?, `lastmodified` = ? WHERE ' . $where_query;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user