Anomalie #14315
Mis à jour par Laurent GIOVANNONI il y a presque 4 ans
En travaillant sur un ticket support SITIV concernant des documents ne revenant dans Maarch Courrier suite à l'exécution du batch retrieveMailFromExternalSignatoryBook, je me suis rendu compte de deux anomalies :
1. si un courrier génère une erreur dans le batch, tous les courriers en attente de retour se retrouvent bloqués
voici le patch associé pour ne pas bloquer l'ensemble des courriers :
~~~ php
[maarch@dcmaarch-prod MaarchCourrier]$ git diff modules/visa/class/IParapheurController.php
diff --git a/modules/visa/class/IParapheurController.php b/modules/visa/class/IParapheurController.php
index 7b0ee3b..282b84f 100755
--- a/modules/visa/class/IParapheurController.php
+++ b/modules/visa/class/IParapheurController.php
@@ -23,7 +23,7 @@ class IParapheurController
'options' => [
CURLOPT_SSLCERT => $config['data']['certPath'],
CURLOPT_SSLCERTTYPE => $config['data']['certType'],
- CURLOPT_SSL_VERIFYPEER => 'false',
+ CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_USERPWD => $config['data']['userId'] . ':' . $config['data']['password'],
],
'delete_header' => true
@@ -232,13 +232,25 @@ class IParapheurController
echo $curlReturn['error'];
return false;
}
-
- $response = $curlReturn['response']->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children('http://www.adullact.org/spring-ws/iparapheur/1.0
-
+//var_dump($curlReturn);
+try {
+ if (is_bool($curlReturn['response']) === true) {
+ echo "error" . PHP_EOL;
+ var_dump($aArgs['config']);
+ var_dump($noVersion);
+ var_dump($curlReturn);
+ break;
+ }
+ //var_dump($curlReturn);
+ $response = $curlReturn['response']->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children('http://www.adullact.org/spring-ws/iparapheur/1.0')->GetHisto
+} catch (Exception $e) {
+ echo 'Exception : ', $e->getMessage(), "\n";
+}
if ($response->MessageRetour->codeRetour == $aArgs['config']['data']['errorCode']) {
// TODO gestion d'une potentielle erreur
echo 'retrieveSignedMails noVersion : [' . $response->MessageRetour->severite . ']' . $response->MessageRetour->message;
- return false;
+ //return false;
+ break;
} else {
$noteContent = '';
foreach ($response->LogDossier as $res) { // Loop on all steps of the documents (prepared, send to signature, signed etc...)
@@ -286,7 +298,7 @@ class IParapheurController
if (!empty($curlReturn['response'])) {
// TODO gestin d'une erreur
- echo $curlReturn['error'];
+ echo 'error : ' . $curlReturn['error'];
return false;
}
~~~
2. client Soap : si l'enveloppe XML de retour suite à l'appel à un WS SOAP comporte un double retour chariot cela tronque le body du xml
voici le patch correctif :
~~~ text
- $body = explode(PHP_EOL . PHP_EOL, $rawResponse)[1]; // put the header ahead
+ $body = strstr($rawResponse, '<?xml');
~~~
Les deux patchs en PJ sont à appliquer depuis la 18.10.
1. si un courrier génère une erreur dans le batch, tous les courriers en attente de retour se retrouvent bloqués
voici le patch associé pour ne pas bloquer l'ensemble des courriers :
~~~ php
[maarch@dcmaarch-prod MaarchCourrier]$ git diff modules/visa/class/IParapheurController.php
diff --git a/modules/visa/class/IParapheurController.php b/modules/visa/class/IParapheurController.php
index 7b0ee3b..282b84f 100755
--- a/modules/visa/class/IParapheurController.php
+++ b/modules/visa/class/IParapheurController.php
@@ -23,7 +23,7 @@ class IParapheurController
'options' => [
CURLOPT_SSLCERT => $config['data']['certPath'],
CURLOPT_SSLCERTTYPE => $config['data']['certType'],
- CURLOPT_SSL_VERIFYPEER => 'false',
+ CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_USERPWD => $config['data']['userId'] . ':' . $config['data']['password'],
],
'delete_header' => true
@@ -232,13 +232,25 @@ class IParapheurController
echo $curlReturn['error'];
return false;
}
-
- $response = $curlReturn['response']->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children('http://www.adullact.org/spring-ws/iparapheur/1.0
-
+//var_dump($curlReturn);
+try {
+ if (is_bool($curlReturn['response']) === true) {
+ echo "error" . PHP_EOL;
+ var_dump($aArgs['config']);
+ var_dump($noVersion);
+ var_dump($curlReturn);
+ break;
+ }
+ //var_dump($curlReturn);
+ $response = $curlReturn['response']->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children('http://www.adullact.org/spring-ws/iparapheur/1.0')->GetHisto
+} catch (Exception $e) {
+ echo 'Exception : ', $e->getMessage(), "\n";
+}
if ($response->MessageRetour->codeRetour == $aArgs['config']['data']['errorCode']) {
// TODO gestion d'une potentielle erreur
echo 'retrieveSignedMails noVersion : [' . $response->MessageRetour->severite . ']' . $response->MessageRetour->message;
- return false;
+ //return false;
+ break;
} else {
$noteContent = '';
foreach ($response->LogDossier as $res) { // Loop on all steps of the documents (prepared, send to signature, signed etc...)
@@ -286,7 +298,7 @@ class IParapheurController
if (!empty($curlReturn['response'])) {
// TODO gestin d'une erreur
- echo $curlReturn['error'];
+ echo 'error : ' . $curlReturn['error'];
return false;
}
~~~
2. client Soap : si l'enveloppe XML de retour suite à l'appel à un WS SOAP comporte un double retour chariot cela tronque le body du xml
voici le patch correctif :
~~~ text
- $body = explode(PHP_EOL . PHP_EOL, $rawResponse)[1]; // put the header ahead
+ $body = strstr($rawResponse, '<?xml');
~~~
Les deux patchs en PJ sont à appliquer depuis la 18.10.