From 336f1a2c90fddd9f822cfed327f3efcfa61a5107 Mon Sep 17 00:00:00 2001 From: Damien <damien.burel@maarch.org> Date: Fri, 30 Nov 2018 16:15:00 +0100 Subject: [PATCH] FEAT #8917 Log --- apps/maarch_entreprise/actions/index_mlb.php | 2 +- .../actions/validate_mail.php | 2 +- apps/maarch_entreprise/xml/curlCall.xml | 94 +++++++++++++------ modules/notifications/admin_notif.php | 71 -------------- src/core/models/CurlModel.php | 22 +++++ 5 files changed, 88 insertions(+), 103 deletions(-) delete mode 100755 modules/notifications/admin_notif.php diff --git a/apps/maarch_entreprise/actions/index_mlb.php b/apps/maarch_entreprise/actions/index_mlb.php index d913b8e6d9e..388a847c962 100755 --- a/apps/maarch_entreprise/actions/index_mlb.php +++ b/apps/maarch_entreprise/actions/index_mlb.php @@ -2064,7 +2064,7 @@ function manage_form($arrId, $history, $actionId, $label_action, $status, $collI $_SESSION['action_error'] = _NEW_DOC_ADDED; $_SESSION['indexation'] = true; - if ($catId != 'outgoing') { + if ($catId == 'incoming') { if (\SrcCore\models\CurlModel::isEnabled(['curlCallId' => 'sendResourceToExternalApplication'])) { $bodyData = []; $config = \SrcCore\models\CurlModel::getConfigByCallId(['curlCallId' => 'sendResourceToExternalApplication']); diff --git a/apps/maarch_entreprise/actions/validate_mail.php b/apps/maarch_entreprise/actions/validate_mail.php index 3708c536659..23eb1b092ab 100755 --- a/apps/maarch_entreprise/actions/validate_mail.php +++ b/apps/maarch_entreprise/actions/validate_mail.php @@ -2072,7 +2072,7 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col require 'modules/attachments/remove_letterbox.php'; } - if ($cat_id != 'outgoing' && $cat_id != 'attachment') { + if ($cat_id == 'incoming') { if (\SrcCore\models\CurlModel::isEnabled(['curlCallId' => 'sendResourceToExternalApplication'])) { $bodyData = []; $config = \SrcCore\models\CurlModel::getConfigByCallId(['curlCallId' => 'sendResourceToExternalApplication']); diff --git a/apps/maarch_entreprise/xml/curlCall.xml b/apps/maarch_entreprise/xml/curlCall.xml index 8569defe456..9c6531fe536 100644 --- a/apps/maarch_entreprise/xml/curlCall.xml +++ b/apps/maarch_entreprise/xml/curlCall.xml @@ -20,10 +20,12 @@ </call> <call> <id>sendResourceToExternalApplication</id> - <enabled>false</enabled> - <url></url> + <enabled>true</enabled> + <url>https://grc28.localeo.fr/public/maarch/createquery</url> <method>POST</method> - <header></header> + <header>Api-Key: 7a1167abe554c90584c2541ecs3a0f99</header> + <header>appName: Maarch</header> + <file>filename</file> <sendInObject> <objectName>requete</objectName> <rawData> @@ -73,35 +75,66 @@ </call> <call> <id>sendAttachmentToExternalApplication</id> - <enabled>false</enabled> - <url></url> + <enabled>true</enabled> + <url>https://grc28.localeo.fr/public/maarch/createquery</url> <method>POST</method> - <file> - <key>encodedFile</key> - </file> - <rawData> - <key>parentId</key> - <value>res_id_master</value> - </rawData> - <rawData> - <key>status</key> - <value>status</value> - </rawData> - <data> - <key>column</key> - <value>aString</value> - </data> - <data> - <key>column2</key> - <value>aString2</value> - </data> + <header>Api-Key: 7a1167abe554c90584c2541ecs3a0f99</header> + <header>appName: Maarch</header> + <file>filename</file> + <sendInObject> + <objectName>requete</objectName> + <rawData> + <key>parentQueryId</key> + <value>custom_t1</value> + </rawData> + <rawData> + <key>externalId</key> + <value>res_id</value> + </rawData> + <rawData> + <key>subject</key> + <value>title</value> + </rawData> + <data> + <key>cityId</key> + <value>73</value> + </data> + <data> + <key>servId</key> + <value>4129</value> + </data> + <data> + <key>sqrtId</key> + <value>12178</value> + </data> + <data> + <key>qrtId</key> + <value>125</value> + </data> + <data> + <key>geo</key> + <value>false</value> + </data> + </sendInObject> + <sendInObject> + <objectName>citoyen</objectName> + <rawData> + <key>id</key> + <value>external_contact_id</value> + </rawData> + <rawData> + <key>externalId</key> + <value>address_id</value> + </rawData> + </sendInObject> </call> <call> <id>sendContactToExternalApplication</id> - <enabled>false</enabled> - <url></url> + <enabled>true</enabled> + <url>https://grc28.localeo.fr/public/maarch/createaccount</url> <method>POST</method> - <header></header> + <header>Api-Key: 7a1167abe554c90584c2541ecs3a0f99</header> + <header>appName: Maarch</header> <sendInObject> <objectName>citoyen</objectName> <rawData> @@ -140,10 +173,11 @@ </call> <call> <id>closeResource</id> - <enabled>false</enabled> - <url></url> + <enabled>true</enabled> + <url>https://grc28.localeo.fr/public/maarch/updatestatusquery</url> <method>POST</method> - <header></header> + <header>Api-Key: 7a1167abe554c90584c2541ecs3a0f99</header> + <header>appName: Maarch</header> <sendInObject> <objectName>requete</objectName> <rawData> diff --git a/modules/notifications/admin_notif.php b/modules/notifications/admin_notif.php deleted file mode 100755 index 0e4732c1d98..00000000000 --- a/modules/notifications/admin_notif.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -/* -* Copyright 2008,2009 Maarch -* -* This file is part of Maarch Framework. -* -* Maarch Framework is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Maarch Framework is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with Maarch Framework. If not, see <http://www.gnu.org/licenses/>. -*/ - -/** -* @brief Notification Administration summary Page -* -* Notification Administration summary Page -* -* @file -* @author Loic Vinet <dev@maarch.org> -* @date $date$ -* @version $Revision$ -* @ingroup admin -*/ - -$admin = new core_tools(); -$admin->test_admin('admin_notif', 'notifications'); -/****************Management of the location bar ************/ -$init = false; -if(isset($_REQUEST['reinit']) && $_REQUEST['reinit'] == "true") -{ - $init = true; -} -$level = ""; -if(isset($_REQUEST['level']) && ($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)) -{ - $level = $_REQUEST['level']; -} -$page_path = $_SESSION['config']['businessappurl'].'index.php?page=admin_notif&module=notifications'; -$page_label = _NOTIFICATIONS; -$page_id = "admin_notif"; -$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level); -/***********************************************************/ -unset($_SESSION['m_admin']); -?> -<h1><i class='fa fa-bell fa-2x'> </i> <?php echo _ADMIN_NOTIFICATIONS;?></h1> -<div id="inner_content" class="clearfix"> - <h2 class="admin_subtitle block" ><?php echo _ADMIN_NOTIFICATIONS;?></h2> - <div class="admin_item" id="admin_structures" title="<?php echo _MANAGE_EVENTS;?>" onclick="window.top.location='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=manage_events_list_controler&module=notifications&mode=list';"> - <div class="sum_margin"> - <strong><?php echo _MANAGE_EVENTS;?></strong><br/> - <em><?php echo _MANAGE_EVENTS_DESC;?></em> - </div> - </div> - - <div class="admin_item" id="admin_subfolders" title="<?php echo _TEST_SENDMAIL;?>" onclick="window.top.location='<?php echo $_SESSION['config']['businessappurl'];?>index.php?page=test_sendmail&module=notifications';"> - <div class="sum_margin"> - <strong><?php echo _TEST_SENDMAIL;?></strong><br/> - <em><?php echo _TEST_SENDMAIL_DESC;?></em> - </div> - </div> - - -</div> diff --git a/src/core/models/CurlModel.php b/src/core/models/CurlModel.php index 9a98d76ee2e..b59cf9862da 100644 --- a/src/core/models/CurlModel.php +++ b/src/core/models/CurlModel.php @@ -14,6 +14,8 @@ namespace SrcCore\models; +use SrcCore\controllers\LogsController; + class CurlModel { public static function exec(array $aArgs) @@ -78,6 +80,16 @@ class CurlModel $rawResponse = curl_exec($curl); curl_close($curl); + LogsController::add([ + 'isTech' => true, + 'moduleId' => 'curl', + 'level' => 'DEBUG', + 'tableName' => '', + 'recordId' => '', + 'eventType' => 'Exec Curl : ' . $aArgs['url'], + 'eventId' => $rawResponse + ]); + return json_decode($rawResponse, true); } @@ -133,6 +145,16 @@ class CurlModel $rawResponse = preg_replace($pattern, '', $body); } + LogsController::add([ + 'isTech' => true, + 'moduleId' => 'curl', + 'level' => 'DEBUG', + 'tableName' => '', + 'recordId' => '', + 'eventType' => 'Exec Curl : ' . $aArgs['url'], + 'eventId' => $rawResponse + ]); + return ['response' => simplexml_load_string($rawResponse), 'infos' => $infos, 'cookies' => $cookies, 'raw' => $rawResponse, 'error' => $error]; } -- GitLab