From 4cf923d6b7b82e8a2db4044299ccec9767ed2698 Mon Sep 17 00:00:00 2001 From: loiclau Date: Mon, 7 Aug 2017 15:56:10 +0200 Subject: [PATCH] * #5497 duplicate acl --- .../configObject/contact/DB-Func.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/www/include/configuration/configObject/contact/DB-Func.php b/www/include/configuration/configObject/contact/DB-Func.php index 8357ecac904..7db31356ab1 100644 --- a/www/include/configuration/configObject/contact/DB-Func.php +++ b/www/include/configuration/configObject/contact/DB-Func.php @@ -250,6 +250,22 @@ function multipleContactInDB($contacts = array(), $nbrDup = array()) $DBRESULT = $pearDB->query("SELECT MAX(contact_id) FROM contact"); $maxId = $DBRESULT->fetchRow(); if (isset($maxId["MAX(contact_id)"])) { + + /* + * ACL update + */ + $query = "SELECT DISTINCT acl_group_id FROM acl_group_contacts_relations " . + "WHERE contact_contact_id = " . (int)$key; + $dbResult = $pearDB->query($query); + $fields["contact_aclRelation"] = ""; + while ($aclRelation = $dbResult->fetchRow()) { + $query = "INSERT INTO acl_group_contacts_relations VALUES ('', '" . + $maxId["MAX(contact_id)"] . "', '" . $aclRelation["acl_group_id"] . "')"; + $pearDB->query($query); + $fields["contact_aclRelation"] .= $aclRelation["acl_group_id"] . ","; + } + $fields["contact_aclRelation"] = trim($fields["contact_aclRelation"], ","); + /* * Command update */