Skip to content

Commit

Permalink
Merge pull request #9 from LinkNacional/issues
Browse files Browse the repository at this point in the history
  • Loading branch information
souzadavi authored Jan 18, 2021
2 parents 9efe4dd + 4acbd1d commit 68c485b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 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
1 change: 0 additions & 1 deletion modules/addons/gofasnfeio/outputproduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@

echo '
<a href="'.$gnfewhmcsadminurl.'addonmodules.php?module=gofasnfeio&action=nfeio" class="btn btn-primary" id="gnfe_cancel" title="NFE.oi">NFE.oi</a>
<div><h3>Listagem produtos</h3>'.$nfes_total.' Itens encontrados.<br>Exibindo de '.$nfes_from.' a '.$nfes_to.'. Página '.$nfes_page.' de '.$nfes_pages.'</div>
<div class="tab-content admin-tabs">
<table id="sortabletbl0" class="datatable" width="100%" border="0" cellspacing="1" cellpadding="3">
<tbody>
Expand Down

0 comments on commit 68c485b

Please sign in to comment.