intégration envoi mail lors d'une erreur de paramètres ou de réponse avec infogreffe, issue #0000251

This commit is contained in:
Michael RICOIS 2010-04-16 06:56:21 +00:00
parent cfc8c42beb
commit 040aed2e3c
2 changed files with 70 additions and 47 deletions

View File

@ -644,6 +644,12 @@ function getGreffeActes($siren, $typeCommande = '', $ref = '', $idCommande = 0)
else
{
//Paramètres incorrect
sendMail(
"Erreur : getGreffeActes",
"getGreffeActes($siren, $typeCommande , $ref, $idCommande )",
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support'),
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support')
);
}
//Gestion du retour infogreffe
if(infogreffe_erreur($xmlReponse))
@ -675,10 +681,20 @@ function infogreffe_filetimeover($fichier)
*/
function infogreffe_erreur($xml)
{
$doc = new DOMDocument();
$load = $doc->loadXML($xml, LIBXML_NOERROR | LIBXML_NOWARNING);
$output = false;
if (!$load){ $output = true;}
if (!empty($xml)){
$doc = new DOMDocument();
$load = $doc->loadXML($xml, LIBXML_NOERROR | LIBXML_NOWARNING);
$output = false;
if (!$load){ $output = true;}
}else{
sendMail(
"Erreur : infogreffe_erreur",
"Pas de reponse xml infogreffe",
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support'),
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support')
);
$output = true;
}
return $output;
}
@ -689,42 +705,46 @@ function infogreffe_erreur($xml)
*/
function infogreffe_erreur_msg($xml)
{
global $tabErrInfoGref;
$doc = new DOMDocument();
$load = $doc->loadXML($xml, LIBXML_NOERROR | LIBXML_NOWARNING);
FB::log($load, 'erreur_msg');
if (!$load){
FB::info('Test erreur infogreffe');
$tmp = explode('-', $xml);
$errNum = $tmp[0]*1; FB::log($errNum, 'errNum');
$errMsg = $tabErrInfoGref[$errNum]; FB::log($errMsg, 'errMsg');
if ($errNum == '23'){
$fj = $_SESSION['tabInfo']['entrep']['fj'];
$nafEn = $_SESSION['tabInfo']['entrep']['nafEn'];
if ( (substr($fj,0,2)=='53' ||
substr($fj,0,2)=='54' ||
substr($fj,0,2)=='55' ||
substr($fj,0,2)=='56' ||
substr($fj,0,2)=='57' ) && $fj!=5306 && $fj!=5307 &&
( $nafEn!='6411Z' ||
$nafEn!='6419Z' ||
$nafEn!='6621Z' ||
$nafEn!='6622Z' ||
$nafEn!='6629Z' ||
$nafEn!='6512Z' ||
$nafEn!='6520Z' ||
$nafEn!='6530Z' ||
$nafEn!='6512Z' ||
$nafEn!='8430A' ||
$nafEn!='8430B' ||
$nafEn!='6420Z' ||
$nafEn!='6430Z' ||
$nafEn!='6611Z' ||
$nafEn!='8430B' ||
$nafEn!='6612Z' ||
$nafEn!='6630Z') ){
$errMsg = 'Aucun bilan disponible.';
}
$errNum = '';
$errMsg = '';
if (!empty($xml)){
global $tabErrInfoGref;
$doc = new DOMDocument();
$load = $doc->loadXML($xml, LIBXML_NOERROR | LIBXML_NOWARNING);
FB::log($load, 'erreur_msg');
if (!$load) {
FB::info('Test erreur infogreffe');
$tmp = explode('-', $xml);
$errNum = $tmp[0]*1;
$errMsg = $tabErrInfoGref[$errNum];
if ($errNum == '23'){
$fj = $_SESSION['tabInfo']['entrep']['fj'];
$nafEn = $_SESSION['tabInfo']['entrep']['nafEn'];
if ( (substr($fj,0,2)=='53' ||
substr($fj,0,2)=='54' ||
substr($fj,0,2)=='55' ||
substr($fj,0,2)=='56' ||
substr($fj,0,2)=='57' ) && $fj!=5306 && $fj!=5307 &&
( $nafEn!='6411Z' ||
$nafEn!='6419Z' ||
$nafEn!='6621Z' ||
$nafEn!='6622Z' ||
$nafEn!='6629Z' ||
$nafEn!='6512Z' ||
$nafEn!='6520Z' ||
$nafEn!='6530Z' ||
$nafEn!='6512Z' ||
$nafEn!='8430A' ||
$nafEn!='8430B' ||
$nafEn!='6420Z' ||
$nafEn!='6430Z' ||
$nafEn!='6611Z' ||
$nafEn!='8430B' ||
$nafEn!='6612Z' ||
$nafEn!='6630Z') ){
$errMsg = 'Aucun bilan disponible.';
}
}
}
}
return array( 'errNum' => $errNum , 'errMsg' => $errMsg );
@ -816,6 +836,12 @@ function getGreffeBilans($siren, $typeCommande = '', $ref = '', $idCommande = 0)
else
{
//Paramètres incorrect
sendMail(
"Erreur : getGreffeBilans",
"getGreffeBilans($siren, $typeCommande, $ref, $idCommande )",
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support'),
array('email' => EMAIL_SUPPORTDEV, 'name' => 'Support')
);
}
//Gestion du retour infogreffe
if(infogreffe_erreur($xmlReponse))

View File

@ -513,8 +513,8 @@ else
break;
}
}
if( isset($reponse) && !empty($reponse['error']) && $reponse['error']['errNum']!=17)
{
if( isset($reponse) && !empty($reponse['error']) &&
$reponse['error']['errNum']!=17 ){
if(in_array($erreurStop, $reponse['error']))
{
$message = $reponse['error']['errNum'].' - '.
@ -526,9 +526,7 @@ else
if(!INFOGREFFE_DEBUG)
$client->setLog('greffe_'.$vue, $siren, 0,
'Erreur '.$reponse['error']['errNum']);
}
else
{
} else {
//Mise à jour de la commande dans la bdd
mysql_update('commandes', array('statutCommande'=>0),
'idCommande = '.$idCommande);
@ -540,8 +538,7 @@ else
' sous la référence '.$type.$idCommande;
//Envoi mail de commande courrier
if($type=='C')
{
if($type=='C'){
sendCmdMail(
'[COMMANDE PIECES] - '.'COMMANDE DE '.strtoupper($vue),
'COMMANDE DE '.strtoupper($vue).