mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-21 08:56:27 +02:00
ajoute ou modifie les infos des contacts
This commit is contained in:
parent
c5c4288139
commit
137b231fae
2 changed files with 13 additions and 9 deletions
|
@ -154,7 +154,7 @@
|
||||||
if (!$db->insertIntoTable('contacts_infos', ['id_contact' => $id_contact, 'civility' => $civility, 'first_name' => $prenom, 'last_name' => $nom, 'birthday' => $birthday, 'love_situation' => $loveSituation]))
|
if (!$db->insertIntoTable('contacts_infos', ['id_contact' => $id_contact, 'civility' => $civility, 'first_name' => $prenom, 'last_name' => $nom, 'birthday' => $birthday, 'love_situation' => $loveSituation]))
|
||||||
{
|
{
|
||||||
$_SESSION['errormessage'] = "Le contact a bien été créé, mais certaines informations n'ont pas pu être enregistrées.";
|
$_SESSION['errormessage'] = "Le contact a bien été créé, mais certaines informations n'ont pas pu être enregistrées.";
|
||||||
header('Location: ' . $this->generateUrl('contacts', 'add'));
|
header('Location: ' . $this->generateUrl('contacts'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,15 +210,18 @@
|
||||||
|
|
||||||
$db->updateTableWhere('contacts', ['name' => $nomComplet, 'number' => $number], ['id' => $id]);
|
$db->updateTableWhere('contacts', ['name' => $nomComplet, 'number' => $number], ['id' => $id]);
|
||||||
|
|
||||||
if (!isset($contact['contacts_infos_id'])) {
|
// si l'option des infos contacts n'est pas activée, on sort de la boucle
|
||||||
|
if (!RASPISMS_SETTINGS_EXTENDED_CONTACTS_INFOS) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($contact['contacts_infos_id'])) {
|
||||||
if (!$db->insertIntoTable('contacts_infos', ['id_contact' => $id, 'civility' => $civility, 'first_name' => $prenom, 'last_name' => $nom, 'birthday' => $birthday, 'love_situation' => $loveSituation]))
|
if (!$db->insertIntoTable('contacts_infos', ['id_contact' => $id, 'civility' => $civility, 'first_name' => $prenom, 'last_name' => $nom, 'birthday' => $birthday, 'love_situation' => $loveSituation]))
|
||||||
{
|
{
|
||||||
$errors[] = $id;
|
$errors[] = $id;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
} elseif (!$db->updateTableWhere('contacts_infos', ['id_contact' => $id, 'civility' => $civility, 'first_name' => $prenom, 'last_name' => $nom, 'birthday' => $birthday, 'love_situation' => $loveSituation], ['id' => $contact['contacts_infos_id']]))
|
||||||
|
|
||||||
if (!$db->updateTableWhere('contacts_infos', ['id_contact' => $id, 'civility' => $civility, 'first_name' => $prenom, 'last_name' => $nom, 'birthday' => $birthday, 'love_situation' => $loveSituation], ['id' => $contact['contacts_infos_id']]))
|
|
||||||
{
|
{
|
||||||
$errors[] = $id;
|
$errors[] = $id;
|
||||||
continue;
|
continue;
|
||||||
|
@ -229,6 +232,7 @@
|
||||||
if (count($errors))
|
if (count($errors))
|
||||||
{
|
{
|
||||||
$_SESSION['errormessage'] = 'Certains contacts n\'ont pas pu êtres mis à jour. Voici leurs identifiants : ' . implode(', ', $errors);
|
$_SESSION['errormessage'] = 'Certains contacts n\'ont pas pu êtres mis à jour. Voici leurs identifiants : ' . implode(', ', $errors);
|
||||||
|
// die();
|
||||||
return header('Location: ' . $this->generateUrl('contacts'));
|
return header('Location: ' . $this->generateUrl('contacts'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//On définit les chemins
|
//On définit les chemins
|
||||||
define('PWD', '/var/www/RaspiSMS/'); //On défini le chemin de base du site
|
define('PWD', '/Users/Romain/Sites/RaspiSMS/'); //On défini le chemin de base du site
|
||||||
define('HTTP_PWD', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost') . '/RaspiSMS/'); //On défini l'adresse url du site
|
define('HTTP_PWD', (isset($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost') . '/'); //On défini l'adresse url du site
|
||||||
|
|
||||||
define('PWD_IMG', PWD . 'img/'); //Chemin dossier des images
|
define('PWD_IMG', PWD . 'img/'); //Chemin dossier des images
|
||||||
define('HTTP_PWD_IMG', HTTP_PWD . 'img/'); //URL dossier des images
|
define('HTTP_PWD_IMG', HTTP_PWD . 'img/'); //URL dossier des images
|
||||||
|
@ -45,4 +45,4 @@
|
||||||
define('DATABASE_HOST', 'localhost'); //Hote de la bdd
|
define('DATABASE_HOST', 'localhost'); //Hote de la bdd
|
||||||
define('DATABASE_NAME', 'raspisms'); //Nom de la bdd
|
define('DATABASE_NAME', 'raspisms'); //Nom de la bdd
|
||||||
define('DATABASE_USER', 'root'); //Utilisateur de la bdd
|
define('DATABASE_USER', 'root'); //Utilisateur de la bdd
|
||||||
define('DATABASE_PASSWORD', ''); //Password de l'utilisateur
|
define('DATABASE_PASSWORD', 'root'); //Password de l'utilisateur
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue