diff --git a/apps/maarch_entreprise/js/functions.js b/apps/maarch_entreprise/js/functions.js index ee691622aa293c59b92351e756241d191460db70..6373aa5f6a04e0995a30e3938b0826721168bfef 100755 --- a/apps/maarch_entreprise/js/functions.js +++ b/apps/maarch_entreprise/js/functions.js @@ -1813,10 +1813,9 @@ function checkCommunication(contactId){ } $j.ajax({ - url : '../../rest/contact/checkCommunication', + url : '../../rest/contact/checkCommunication/'+contactId, type : 'get', data: { - contactId : contactId }, success: function(answer) { if(answer[0]) { diff --git a/rest/index.php b/rest/index.php index 05dd919e26d89c405428d6f096b6270f553c4a1d..5b98219541b18e8fd7c2499b768c48a26e64086e 100755 --- a/rest/index.php +++ b/rest/index.php @@ -298,7 +298,7 @@ $app->get('/listinstance/{id}', \Entity\controllers\ListInstanceController::clas //Contacts $app->post('/contacts', \Contact\controllers\ContactController::class . ':create'); -$app->get('/contact/checkCommunication', \Contact\controllers\ContactController::class . ':getCheckCommunication'); +$app->get('/contact/checkCommunication/{contactId}', \Contact\controllers\ContactController::class . ':getCheckCommunication'); //Templates $app->post('/templates/{id}/duplicate', \Template\controllers\TemplateController::class . ':duplicate'); diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php index abe58c6e7cc8f705323b7afbd9ce83af10c0f573..fe5ac8d8f8fb346ee5b108413dfc80374c39752d 100644 --- a/src/app/contact/controllers/ContactController.php +++ b/src/app/contact/controllers/ContactController.php @@ -74,12 +74,9 @@ class ContactController public function getCheckCommunication(Request $request, Response $response, $aArgs) { - $data = $request->getParams(); - - if (isset($data['contactId'])) { - $contactId = $data['contactId']; + if (!empty($aArgs['contactId'])) { $obj = ContactModel::getCommunicationByContactId([ - 'contactId' => $contactId + 'contactId' => $aArgs['contactId'] ]); } else { return $response @@ -89,6 +86,4 @@ class ContactController return $response->withJson([$obj]); } - - }