diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index f0688b19746..5f4c358347c 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2010 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,7 +60,14 @@ else // Set the WebService URL dol_syslog("Create soapclient_nusoap for URL=".$WS_DOL_URL); - $soapclient = new soapclient_nusoap($WS_DOL_URL); + $soapclient = new soapclient_nusoap($WS_DOL_URL.'?wsdl',true); + + // Check for an error + $err = $soapclient->getError(); + if ($err) + { + dol_syslog("Constructor error ".$WS_DOL_URL, LOG_ERR); + } // Call the WebService and store its result in $result. dol_syslog("Call method ".$WS_METHOD); @@ -92,6 +99,11 @@ else print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
'; $messagetoshow=$soapclient->response; } + elseif ($result['faultstring']) + { + print ''.$langs->trans("Error").'
'; + $messagetoshow=$result['faultstring']; + } // Syntaxe ko elseif (preg_match('/INVALID_INPUT/i',$result['faultstring']) || ($result['requestDate'] && ! $result['valid'])) @@ -113,7 +125,7 @@ else } else { - if ($result['valid']) + if (! empty($result['valid']) && ($result['valid']==1 || $result['valid']=='true')) { print ''.$langs->trans("Yes").''; print '
'; @@ -123,10 +135,16 @@ else else { print ''.$langs->trans("No").''; - print '
'; + print '
'."\n"; } } } + + // Show log data into page + print "\n"; + print ''; } print '
'; @@ -136,7 +154,8 @@ print '

Error returned:
'; + print '

'; + print "\n".'Error returned:
'; print nl2br($messagetoshow); }