diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php index b7782956fa11cba05fe32ed17f3b88ebf60c3e68..cf3c5c1013e802368310ad3c066be457c2f8c4ac 100755 --- a/src/app/contact/controllers/ContactController.php +++ b/src/app/contact/controllers/ContactController.php @@ -15,6 +15,7 @@ namespace Contact\controllers; use Contact\models\ContactCustomFieldListModel; use Contact\models\ContactFillingModel; +use Contact\models\ContactGroupModel; use Contact\models\ContactModel; use Contact\models\ContactParameterModel; use Entity\models\EntityModel; @@ -379,6 +380,8 @@ class ContactController 'data' => [$args['id']] ]); + ContactGroupModel::deleteByContactId(['contactId' => $args['id']]); + $historyInfoContact = ''; if (!empty($contact[0]['firstname']) || !empty($contact[0]['lastname'])) { $historyInfoContact .= $contact[0]['firstname'] . ' ' . $contact[0]['lastname']; diff --git a/src/app/contact/models/ContactGroupModelAbstract.php b/src/app/contact/models/ContactGroupModelAbstract.php index d79690832814078af8bc2a7cd2ca215de75ce4a1..a1ed7996bdae04e77f786b5be7286b17241cd611 100755 --- a/src/app/contact/models/ContactGroupModelAbstract.php +++ b/src/app/contact/models/ContactGroupModelAbstract.php @@ -157,4 +157,18 @@ abstract class ContactGroupModelAbstract return true; } + + public static function deleteByContactId(array $aArgs) + { + ValidatorModel::notEmpty($aArgs, ['contactId']); + ValidatorModel::intVal($aArgs, ['contactId']); + + DatabaseModel::delete([ + 'table' => 'contacts_groups_lists', + 'where' => ['contact_id = ?'], + 'data' => [$aArgs['contactId']] + ]); + + return true; + } } diff --git a/test/unitTests/app/configuration/ConfigurationControllerTest.php b/test/unitTests/app/configuration/ConfigurationControllerTest.php index 6f11dde8836c519eaf0485c7d6508f26e22a38d8..f6628ab538252da6d601059bec6f953fe68a12eb 100755 --- a/test/unitTests/app/configuration/ConfigurationControllerTest.php +++ b/test/unitTests/app/configuration/ConfigurationControllerTest.php @@ -120,7 +120,8 @@ class ConfigurationControllerTest extends TestCase $request = \Slim\Http\Request::createFromEnvironment($environment); $aArgs = [ - 'type' => 'sendmail' + 'type' => 'sendmail', + 'from' => 'notifications@maarch.org' ]; $fullRequest = \httpRequestCustom::addContentInBody($aArgs, $request); @@ -141,9 +142,10 @@ class ConfigurationControllerTest extends TestCase $jsonTest = json_encode( [ - 'type' => 'sendmail', + 'type' => 'sendmail', + 'from' => 'notifications@maarch.org', 'passwordAlreadyExists' => false, - 'charset' => 'utf-8' + 'charset' => 'utf-8' ] );