mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-05-09 01:36:26 +02:00
mise à jour d'un contact avec infos étendues
This commit is contained in:
parent
edf544b276
commit
17789f5b27
3 changed files with 106 additions and 21 deletions
model
|
@ -249,18 +249,27 @@
|
|||
{
|
||||
if (RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS) {
|
||||
$extended_contact_join = '
|
||||
LEFT JOIN contacts_infos as inf
|
||||
ON (inf.id_contact = contacts.id)
|
||||
LEFT JOIN contacts_infos
|
||||
ON (contacts_infos.id_contact = contacts.id)
|
||||
';
|
||||
$tableToDescribe = "contacts,contacts_infos";
|
||||
} else {
|
||||
$extended_contact_join = '';
|
||||
$tableToDescribe = "contacts";
|
||||
}
|
||||
|
||||
$query = "
|
||||
SELECT *
|
||||
$fields = $this->describeTable($tableToDescribe);
|
||||
|
||||
// liste les champs disponibles pour ajouter des alias et éviter des problèmes en cas de colonnes avec le même nom
|
||||
$fieldNames = array_keys($fields);
|
||||
foreach ($fieldNames as $key => $fieldName) {
|
||||
$fieldNames[$key] = $fieldName . " AS '" . $fieldName . "'";
|
||||
}
|
||||
|
||||
$query = "SELECT " . implode(', ', $fieldNames) . "
|
||||
FROM contacts
|
||||
".$extended_contact_join."
|
||||
WHERE id ";
|
||||
WHERE contacts.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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue