Skip to content

Commit

Permalink
modificado forma de separar o endereço com virugla
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoVictorLNacional committed Jan 18, 2021
1 parent cd3032d commit 4acbd1d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
19 changes: 14 additions & 5 deletions modules/addons/gofasnfeio/hooks/aftercronjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
exit();
}
use WHMCS\Database\Capsule;

if ($params['debug']) {
logModuleCall('gofas_nfeio', 'check', 'check', '', 'replaceVars');
}
Expand Down Expand Up @@ -72,7 +73,15 @@
} else {
$desc = substr(implode("\n", $line_items), 0, 600);
}

if (strpos($client['address1'], ',')) {
$array_adress=explode(",", $client['address1']);
$street = $array_adress[0];
$number=$array_adress[1];
} else {
$street = str_replace(',', '', preg_replace('/[0-9]+/i', '', $client['address1']));
$number=preg_replace('/[^0-9]/', '', $client['address1']);
}

if (0 == !strlen($customer['insc_municipal'])) {
$postfields = [
'cityServiceCode' => $service_code,
Expand All @@ -86,8 +95,8 @@
'address' => [
'country' => gnfe_country_code($client['countrycode']),
'postalCode' => preg_replace('/[^0-9]/', '', $client['postcode']),
'street' => str_replace(',', '', preg_replace('/[0-9]+/i', '', $client['address1'])),
'number' => preg_replace('/[^0-9]/', '', $client['address1']),
'street' => $street,
'number' => $number,
'additionalInformation' => '',
'district' => $client['address2'],
'city' => [
Expand All @@ -112,8 +121,8 @@
'address' => [
'country' => gnfe_country_code($client['countrycode']),
'postalCode' => preg_replace('/[^0-9]/', '', $client['postcode']),
'street' => str_replace(',', '', preg_replace('/[0-9]+/i', '', $client['address1'])),
'number' => preg_replace('/[^0-9]/', '', $client['address1']),
'street' => $street,
'number' => $number,
'additionalInformation' => '',
'district' => $client['address2'],
'city' => [
Expand Down
17 changes: 13 additions & 4 deletions modules/addons/gofasnfeio/hooks/dailycronjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
} else {
$desc = substr(implode("\n", $line_items), 0, 600);
}
if (strpos($client['address1'], ',')) {
$array_adress=explode(",", $client['address1']);
$street = $array_adress[0];
$number=$array_adress[1];
} else {
$street = str_replace(',', '', preg_replace('/[0-9]+/i', '', $client['address1']));
$number=preg_replace('/[^0-9]/', '', $client['address1']);
}

if (0 == !strlen($customer['insc_municipal'])) {
$postfields = [
'cityServiceCode' => $service_code,
Expand All @@ -67,8 +76,8 @@
'address' => [
'country' => gnfe_country_code($client['countrycode']),
'postalCode' => preg_replace('/[^0-9]/', '', $client['postcode']),
'street' => str_replace(',', '', preg_replace('/[0-9]+/i', '', $client['address1'])),
'number' => preg_replace('/[^0-9]/', '', $client['address1']),
'street' => $street,
'number' => $number,
'additionalInformation' => '',
'district' => $client['address2'],
'city' => [
Expand All @@ -93,8 +102,8 @@
'address' => [
'country' => gnfe_country_code($client['countrycode']),
'postalCode' => preg_replace('/[^0-9]/', '', $client['postcode']),
'street' => str_replace(',', '', preg_replace('/[0-9]+/i', '', $client['address1'])),
'number' => preg_replace('/[^0-9]/', '', $client['address1']),
'street' => $street,
'number' => $number,
'additionalInformation' => '',
'district' => $client['address2'],
'city' => [
Expand Down

0 comments on commit 4acbd1d

Please sign in to comment.