mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
permet la suppression et le retour JSON de contact avec l'option des infos étendues
This commit is contained in:
parent
f3d36cd8a4
commit
c5c4288139
2 changed files with 26 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue