diff --git a/controllers/contacts.php b/controllers/contacts.php index 7527a10..cd8febe 100755 --- a/controllers/contacts.php +++ b/controllers/contacts.php @@ -243,6 +243,17 @@ { global $db; - echo json_encode($db->getFromTableWhere('contacts')); + if (RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS) + { + $contacts = $db->getFromTableWhere('contacts', array(), '', false, false, false, array(array( + 'table' => 'contacts_infos', + 'type' => 'LEFT', + 'on' => 'contacts_infos.id_contact = contacts.id' + ))); + } else { + $contacts = $db->getFromTableWhere('contacts'); + } + + echo json_encode($contacts); } } diff --git a/model/DataBase.php b/model/DataBase.php index 9511bbf..f5386fd 100755 --- a/model/DataBase.php +++ b/model/DataBase.php @@ -228,14 +228,25 @@ */ public function deleteContactsIn($contacts_ids) { + //On génère la clause IN et les paramètres adaptés depuis le tableau des id + $generted_in = $this->generateInFromArray($contacts_ids); + $params = $generted_in['PARAMS']; + + if (RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS) { + $query = " + DELETE FROM contacts_infos + WHERE id_contact "; + + $query .= $generted_in['QUERY']; + + $this->runQuery($query, $params, self::ROWCOUNT); + } + $query = " DELETE FROM contacts WHERE id "; - //On génère la clause IN et les paramètres adaptés depuis le tableau des id - $generted_in = $this->generateInFromArray($contacts_ids); $query .= $generted_in['QUERY']; - $params = $generted_in['PARAMS']; return $this->runQuery($query, $params, self::ROWCOUNT); }