diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2012-08-16 00:24:38 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2012-08-16 00:25:32 +0200 |
commit | 4c638f101e09cbe43a2114c64ebb30774bafce4b (patch) | |
tree | 80a01ed4cce75428b66e9fc343d336bf59f357cf /apps/contacts/ajax | |
parent | dd3208fe6fadff3ad831df2fa5220e2184738b21 (diff) | |
download | nextcloud-server-4c638f101e09cbe43a2114c64ebb30774bafce4b.tar.gz nextcloud-server-4c638f101e09cbe43a2114c64ebb30774bafce4b.zip |
Merge addressbooks.
Diffstat (limited to 'apps/contacts/ajax')
-rw-r--r-- | apps/contacts/ajax/contact/move.php | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/apps/contacts/ajax/contact/move.php b/apps/contacts/ajax/contact/move.php index a3336c3cb6c..053343c47ed 100644 --- a/apps/contacts/ajax/contact/move.php +++ b/apps/contacts/ajax/contact/move.php @@ -7,35 +7,23 @@ * later. * See the COPYING-README file. */ - + OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('contacts'); OCP\JSON::callCheck(); -$ids = $_POST['ids']; +$id = intval($_POST['id']); $aid = intval($_POST['aid']); +$isaddressbook = isset($_POST['isaddressbook']) ? true: false; + +// Ownership checking OC_Contacts_App::getAddressbook($aid); - -if(!is_array($ids)) { - $ids = array($ids,); -} -$goodids = array(); -foreach ($ids as $id){ - try { - $card = OC_Contacts_App::getContactObject( intval($id) ); - if($card) { - $goodids[] = $id; - } - } catch (Exception $e) { - OCP\Util::writeLog('contacts', 'Error moving contact "'.$id.'" to addressbook "'.$aid.'"'.$e->getMessage(), OCP\Util::ERROR); - } -} try { - OC_Contacts_VCard::moveToAddressBook($aid, $ids); + OC_Contacts_VCard::moveToAddressBook($aid, $id, $isaddressbook); } catch (Exception $e) { $msg = $e->getMessage(); - OCP\Util::writeLog('contacts', 'Error moving contacts "'.implode(',', $ids).'" to addressbook "'.$aid.'"'.$msg, OCP\Util::ERROR); + OCP\Util::writeLog('contacts', 'Error moving contacts "'.implode(',', $id).'" to addressbook "'.$aid.'"'.$msg, OCP\Util::ERROR); OC_JSON::error(array('data' => array('message' => $msg,))); } - -OC_JSON::success(array('data' => array('ids' => $goodids,)));
\ No newline at end of file + +OC_JSON::success(array('data' => array('ids' => $id,)));
\ No newline at end of file |