From fc02e0f29912a1fff4be536bbfb0c6de6ba51736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20=27Morty=27=20Str=C3=BCbe?= Date: Thu, 14 Jul 2016 10:19:24 +0200 Subject: [PATCH] Also adjust links when migrating from Ldap to DB --- api/src/Contacts/Storage.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/api/src/Contacts/Storage.php b/api/src/Contacts/Storage.php index ea007a29e8..94b4bb877b 100755 --- a/api/src/Contacts/Storage.php +++ b/api/src/Contacts/Storage.php @@ -959,6 +959,7 @@ class Storage { $contact = $ldap_contacts->read($contact['id']); } + $old_contact_id = $contact['id']; unset($contact['id']); // ldap uid/account_lid if ($contact['account_id'] && ($old = $sql_contacts->read(array('account_id' => $contact['account_id'])))) { @@ -971,7 +972,25 @@ class Storage { echo '

'.$n.': '.$contact['n_fn']. ($contact['org_name'] ? ' ('.$contact['org_name'].')' : '')." --> SQL (". - ($contact['owner']?lang('User'):lang('Contact')).")

\n"; + ($contact['owner']?lang('User'):lang('Contact')).")
\n"; + + $new_contact_id = $sql_contacts->data['id']; + echo "    " . $old_contact_id . " --> " . $new_contact_id . " / "; + + $tq = $this->db->update('egw_links',array( + 'link_id1' => $new_contact_id, + ),array( + 'link_app1' => 'addressbook', + 'link_id1' => $old_contact_id + ),__LINE__,__FILE__); + + $tq = $this->db->update('egw_links',array( + 'link_id2' => $new_contact_id, + ),array( + 'link_app2' => 'addressbook', + 'link_id2' => $old_contact_id + ),__LINE__,__FILE__); + echo "

\n"; } else {