Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
enh(BE): optimizing the data sent when importing contact (#7559)
Browse files Browse the repository at this point in the history
* enh(BE): optimizing the data sent when importing data
* renaming variable and removing useless steps
* udpating the composer.lock
* fix(ldap): login after manual import
  • Loading branch information
sc979 authored Jun 3, 2019
1 parent 03eff16 commit 47676de
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,29 @@

$valid = false;
if ($form->validate()) {
if (isset($_POST["contact_select"]["select"])) {
if ($form->getSubmitValue("submitA")) {
insertLdapContactInDB($_POST["contact_select"]);
if (isset($_POST["contact_select"]["select"]) && $form->getSubmitValue("submitA")) {
// extracting the chosen contacts Id from the POST
$selectedUsers = $_POST["contact_select"]['select'];
unset($_POST["contact_select"]['select']);

// removing the useless data sent
$arrayToReturn = array();
foreach ($_POST["contact_select"] as $key => $subKey) {
$arrayToReturn[$key] = array_intersect_key($_POST["contact_select"][$key], $selectedUsers);
}

// restoring the filtered $_POST['contact_select']['select'] as it's needed in some DB-Func.php functions
$arrayToReturn['select'] = $selectedUsers;
$_POST['contact_select'] = $arrayToReturn;
unset($selectedUsers);
unset($arrayToReturn);

insertLdapContactInDB($_POST["contact_select"]);
}
$form->freeze();
$valid = true;
}


if ($valid) {
require_once($path . "listContact.php");
} else {
Expand Down

0 comments on commit 47676de

Please sign in to comment.