diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 0ed106bb742..79b8d8923eb 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -69,7 +69,7 @@ if (isModEnabled('eventorganization')) { if ($mysoc->country_code == 'GR') { $u = getDolGlobalString('AADE_WEBSERVICE_USER'); $p = getDolGlobalString('AADE_WEBSERVICE_KEY'); - $myafm = getDolGlobalString('MAIN_INFO_TVAINTRA'); + $myafm = preg_replace('/\D/', '', getDolGlobalString('MAIN_INFO_TVAINTRA')); } @@ -3225,7 +3225,7 @@ function GRVAT(a, u, p, myafm) { $.ajax({ type: "GET", - url: "/societe/checkvat/checkVatGr.php", + url: '/societe/checkvat/checkVatGr.php', data: { afm }, // Set request parameters success: function(data) { var obj = data; // Parse response data as JSON @@ -3235,6 +3235,7 @@ function GRVAT(a, u, p, myafm) { alert(obj.pErrorRec_out.errorDescr); // Display error message if AFM is null } else { $("#name").val(obj.RgWsPublicBasicRt_out.onomasia); // Set 'name' field value + $("#address").val(obj.RgWsPublicBasicRt_out.postalAddress + " " + obj.RgWsPublicBasicRt_out.postalAddressNo); // Set 'address' field value $("#zipcode").val(obj.RgWsPublicBasicRt_out.postalZipCode); // Set 'zipcode' field value $("#town").val(obj.RgWsPublicBasicRt_out.postalAreaDescription); // Set 'town' field value $("#idprof2").val(obj.RgWsPublicBasicRt_out.doyDescr); // Set 'idprof2' field value diff --git a/htdocs/societe/checkvat/checkVatGr.php b/htdocs/societe/checkvat/checkVatGr.php index bc678db1a1d..ac94cb9dadc 100644 --- a/htdocs/societe/checkvat/checkVatGr.php +++ b/htdocs/societe/checkvat/checkVatGr.php @@ -27,7 +27,7 @@ require "../../main.inc.php"; $username = getDolGlobalString('AADE_WEBSERVICE_USER'); // Get username from request $password = getDolGlobalString('AADE_WEBSERVICE_KEY'); // Get password from request -$myafm = getDolGlobalString('MAIN_INFO_TVAINTRA'); // Get Vat from request +$myafm = preg_replace('/\D/', '', getDolGlobalString('MAIN_INFO_TVAINTRA')); // Get Vat from request after removing non-digit characters $afm = GETPOST('afm'); // Get client Vat from request // Make call to check VAT for Greek client @@ -40,11 +40,11 @@ echo json_encode($result); // Encode the result as JSON and output * Request VAT details * @param string $username Company AADE username * @param string $password Company AADE password -* @param string $AFMcalledfor Company vat number -* @param string $AFMcalledby Client vat number +* @param string $AFMcalledby Company vat number +* @param string $AFMcalledfor Client vat number * @return string */ -function checkVATGR($username, $password, $AFMcalledfor, $AFMcalledby = '') +function checkVATGR($username, $password, $AFMcalledby, $AFMcalledfor) { /* $WS_DOL_URL_WSDL = "https://www1.gsis.gr/webtax2/wsgsis/RgWsPublic/RgWsPublicPort?WSDL"; @@ -76,7 +76,7 @@ function checkVATGR($username, $password, $AFMcalledfor, $AFMcalledby = '') $authHeader->UsernameToken = new stdClass(); $authHeader->UsernameToken->Username = "$username"; $authHeader->UsernameToken->Password = "$password"; - $Headers[] = new SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', $authHeader, true); + $Headers[] = new SoapHeader('https://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', $authHeader, true); $client->__setSoapHeaders($Headers); $result = $client->rgWsPublicAfmMethod( array(