Contacts - Import: Change Google import to use class delete() method to remove duplicates.
This commit is contained in:
parent
afa3863c0c
commit
1bf11ef2d0
|
|
@ -17,25 +17,28 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Portions created by the Initial Developer are Copyright (C) 2008-2013
|
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
*/
|
*/
|
||||||
require_once "root.php";
|
|
||||||
require_once "resources/require.php";
|
|
||||||
require_once "resources/check_auth.php";
|
|
||||||
require_once "resources/functions/google_get_groups.php";
|
|
||||||
require_once "resources/functions/google_get_contacts.php";
|
|
||||||
|
|
||||||
if (permission_exists('contact_add')) {
|
//includes
|
||||||
//access granted
|
require_once "root.php";
|
||||||
}
|
require_once "resources/require.php";
|
||||||
else {
|
require_once "resources/check_auth.php";
|
||||||
echo "access denied";
|
require_once "resources/functions/google_get_groups.php";
|
||||||
exit;
|
require_once "resources/functions/google_get_contacts.php";
|
||||||
}
|
|
||||||
|
//check permissions
|
||||||
|
if (permission_exists('contact_add')) {
|
||||||
|
//access granted
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "access denied";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
//add multi-lingual support
|
//add multi-lingual support
|
||||||
$language = new text;
|
$language = new text;
|
||||||
|
|
@ -99,11 +102,25 @@ if ($_POST['a'] == 'import') {
|
||||||
}
|
}
|
||||||
//replace contact (delete before inserts below)
|
//replace contact (delete before inserts below)
|
||||||
else if ($duplicate_exists && $_POST['import_duplicates'] == 'replace') {
|
else if ($duplicate_exists && $_POST['import_duplicates'] == 'replace') {
|
||||||
$contact_uuid = $duplicate_contact_uuid;
|
//build array
|
||||||
$included = true;
|
$array[0]['checked'] = 'true';
|
||||||
require_once "contact_delete.php";
|
$array[0]['uuid'] = $duplicate_contact_uuid;
|
||||||
unset($contact_uuid, $duplicate_contact_uuid);
|
unset($duplicate_contact_uuid);
|
||||||
$contacts_replaced++;
|
|
||||||
|
//grant temporary permissions
|
||||||
|
$p = new permissions;
|
||||||
|
$p->add('contact_delete', 'temp');
|
||||||
|
|
||||||
|
//delete duplicate contact
|
||||||
|
$obj = new contacts;
|
||||||
|
$obj->delete($array);
|
||||||
|
unset($array)
|
||||||
|
|
||||||
|
//revoke temporary permissions
|
||||||
|
$p->delete('contact_delete', 'temp');
|
||||||
|
|
||||||
|
//increase counter
|
||||||
|
$contacts_replaced++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//extract contact record from array using contact id
|
//extract contact record from array using contact id
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue