From 02f41b4190af39ab1c6b630051bc0b9c6fb13e03 Mon Sep 17 00:00:00 2001 From: "florian.azizian" <florian.azizian@maarch.org> Date: Wed, 14 Mar 2018 14:32:23 +0100 Subject: [PATCH] FEAT #202 fusion M2M refactoring --- apps/maarch_entreprise/js/functions.js | 3 +-- rest/index.php | 2 +- src/app/contact/controllers/ContactController.php | 9 ++------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/apps/maarch_entreprise/js/functions.js b/apps/maarch_entreprise/js/functions.js index ee691622aa2..6373aa5f6a0 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 05dd919e26d..5b98219541b 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 abe58c6e7cc..fe5ac8d8f8f 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]); } - - } -- GitLab