Skip to content

Commit

Permalink
correção das URLs para a release 1.4.1 #81 (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrekutianski authored Sep 17, 2021
1 parent 2acaada commit ba15ce0
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 51 deletions.
15 changes: 6 additions & 9 deletions modules/addons/gofasnfeio/addonPage/outputproduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,19 @@
}
$message = '<div style="position:absolute;top: -5px;width: 50%;left: 25%;background: #5cb85c;color: #ffffff;padding: 5px;text-align: center;">Código Salvo</div>';
header_remove();
header('Location: ' . $gnfewhmcsadminurl . 'addonmodules.php?module=gofasnfeio&action=code_product&gnfe_message=' . base64_encode(urlencode($message)));
header('Location: addonmodules.php?module=gofasnfeio&action=code_product&gnfe_message=' . base64_encode(urlencode($message)));

exit;
} catch (\Exception $e) {
$e->getMessage();
$message = '<div style="position:absolute;top: -5px;width: 50%;left: 25%;background: #d9534f;color: #ffffff;padding: 5px;text-align: center;">' . $e->getMessage() . '</div>';
header_remove();
header('Location: ' . $gnfewhmcsadminurl . 'addonmodules.php?module=gofasnfeio&action=code_product&gnfe_message=' . base64_encode(urlencode($message)));
header('Location: addonmodules.php?module=gofasnfeio&action=code_product&gnfe_message=' . base64_encode(urlencode($message)));

exit;
}
}

foreach (Capsule::table('tblconfiguration')->where('setting', '=', 'gnfewhmcsadminurl')->get(['value']) as $gnfewhmcsadminurl_) {
$gnfewhmcsadminurl = $gnfewhmcsadminurl_->value;
}
$nfes = [];
foreach (Capsule::table('tblproducts')->orderBy('id', 'desc')->get(['id']) as $nfes_) {
$nfes[] = $nfes_->id;
Expand All @@ -48,10 +45,10 @@
$created_at = $product->created_at ? date('d/m/Y', strtotime($product->created_at)) : '';
$update_at = $product->update_at ? date('d/m/Y', strtotime($product->update_at)) : '';

$html_table .= '<tr><td><a href="' . $gnfewhmcsadminurl . 'configproducts.php?action=edit&id=' . $product->id . '" target="blank">#' . $product->id . '</a></td>
$html_table .= '<tr><td><a href="configproducts.php?action=edit&id=' . $product->id . '" target="blank">#' . $product->id . '</a></td>
<td style="text-align: center; vertical-align: middle;">' . $created_at . '</td>
<td style="text-align: center; vertical-align: middle;">' . $update_at . '</td>
<td><a href="' . $gnfewhmcsadminurl . 'configproducts.php?action=edit&id=' . $product->id . '" target="blank">' . $product->name . '</a></td>
<td><a href="configproducts.php?action=edit&id=' . $product->id . '" target="blank">' . $product->name . '</a></td>
<form action="" method="post">
<td><input type="text" name="code" value="' . $product->code_service . '" style="width: 100%;"></td>
Expand All @@ -61,8 +58,8 @@
}

echo '
<a href="' . $gnfewhmcsadminurl . 'addonmodules.php?module=gofasnfeio&action=nfeio" class="btn btn-primary" id="gnfe_cancel" title="NFE.io">NFE.io</a>
<a href="' . $gnfewhmcsadminurl . 'addonmodules.php?module=gofasnfeio&action=nfeio_legacy" class="btn btn-primary" title="Sistema legado">Sistema legado</a>
<a href="addonmodules.php?module=gofasnfeio&action=nfeio" class="btn btn-primary" id="gnfe_cancel" title="NFE.io">NFE.io</a>
<a href="addonmodules.php?module=gofasnfeio&action=nfeio_legacy" class="btn btn-primary" title="Sistema legado">Sistema legado</a>
<div class="tab-content admin-tabs">
<table id="sortabletbl0" class="datatable" width="100%" border="0" cellspacing="1" cellpadding="3">
Expand Down
7 changes: 2 additions & 5 deletions modules/addons/gofasnfeio/addonPage/outputsystemlegacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
}
use WHMCS\Database\Capsule;

foreach (Capsule::table('tblconfiguration')->where('setting', '=', 'gnfewhmcsadminurl')->get(['value']) as $gnfewhmcsadminurl_) {
$gnfewhmcsadminurl = $gnfewhmcsadminurl_->value;
}
?>
<div style="margin-bottom: 1%;">
<a href="<?php echo $gnfewhmcsadminurl; ?>addonmodules.php?module=gofasnfeio&action=code_product" class="btn btn-primary" id="gnfe_cancel" title="Código de Serviços">Código de Serviços</a>
<a href="<?php echo $gnfewhmcsadminurl; ?>addonmodules.php?module=gofasnfeio&action=nfeio" class="btn btn-primary" id="gnfe_cancel" title="NFE.io">NFE.io</a>
<a href="addonmodules.php?module=gofasnfeio&action=code_product" class="btn btn-primary" id="gnfe_cancel" title="Código de Serviços">Código de Serviços</a>
<a href="addonmodules.php?module=gofasnfeio&action=nfeio" class="btn btn-primary" id="gnfe_cancel" title="NFE.io">NFE.io</a>
</div>
<ul class="nav nav-tabs admin-tabs" role="tablist">
<li class="<?php if (!$_GET['aba']) {
Expand Down
2 changes: 1 addition & 1 deletion modules/addons/gofasnfeio/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ function gofasnfeio_config() {
'name' => 'NFE.io',
'description' => 'Módulo Nota Fiscal NFE.io para WHMCS',
'version' => $module_version,
'author' => '<a title="NFE.io Nota Fiscal WHMCS" href="https://github.com/nfe/whmcs-addon/" target="_blank" ><img src="' . $whmcs_url . 'modules/addons/gofasnfeio/lib/logo.png"></a>',
'author' => '<a title="NFE.io Nota Fiscal WHMCS" href="https://github.com/nfe/whmcs-addon/" target="_blank" ><img src="../modules/addons/gofasnfeio/lib/logo.png"></a>',
'fields' => $fields,
];

Expand Down
23 changes: 10 additions & 13 deletions modules/addons/gofasnfeio/hooks/admininvoicescontrolsoutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
$invoice = localAPI('GetInvoice', ['invoiceid' => $vars['invoiceid']], false);
$client = localAPI('GetClientsDetails', ['clientid' => $vars['userid'], 'stats' => false], false);

foreach (Capsule::table('tblconfiguration')->where('setting', '=', 'gnfewhmcsadminurl')->get(['value']) as $gnfewhmcsadminurl_) {
$gnfewhmcsadminurl = $gnfewhmcsadminurl_->value;
}
if ($_REQUEST['gnfe_create']) {
if ($nfe_for_invoice['status'] !== (string) 'Created' && $nfe_for_invoice['status'] !== (string) 'Issued' && $nfe_for_invoice['status'] !== (string) 'Waiting') {
foreach ($invoice['items']['item'] as $value) {
Expand All @@ -23,15 +20,15 @@
if ($queue !== 'success') {
logModuleCall('gofas_nfeio', 'admininvoicecontorloutput - gnfe_create',$vars['invoiceid'], $queue, 'ERROR', '');
header_remove();
header('Location: ' . $gnfewhmcsadminurl . 'invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_error=Erro ao criar nota fiscal: ' . $queue);
header('Location: invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_error=Erro ao criar nota fiscal: ' . $queue);

exit;
}
if ($queue === 'success') {
logModuleCall('gofas_nfeio', 'admininvoicecontorloutput - gnfe_create',$vars['invoiceid'], $queue, 'OK', '');
$message = '<div style="position:absolute;top: -5px;width: 50%;left: 25%;background: #5cb85c;color: #ffffff;padding: 5px;text-align: center;">Nota Fiscal enviada para processamento</div>';
header_remove();
header('Location: ' . $gnfewhmcsadminurl . 'invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_message=' . base64_encode(urlencode($message)));
header('Location: invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_message=' . base64_encode(urlencode($message)));

exit;
}
Expand All @@ -52,7 +49,7 @@
logModuleCall('gofas_nfeio', 'admininvoicecontorloutput - gnfe_cancel',$nfe->nfe_id, $delete_nfe, 'ERROR', '');
$message = '<div style="position:absolute;top: -5px;width: 50%;left: 25%;background: #d9534f;color: #ffffff;padding: 5px;text-align: center;">' . $delete_nfe->message . '</div>';
header_remove();
header('Location: ' . $gnfewhmcsadminurl . 'invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_message=' . base64_encode(urlencode($message)));
header('Location: invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_message=' . base64_encode(urlencode($message)));

return '';
}
Expand All @@ -62,7 +59,7 @@
$gnfe_update_nfe = gnfe_update_nfe((object) ['id' => $nfe_for_invoice['nfe_id'], 'status' => 'Cancelled', 'servicesAmount' => $nfe_for_invoice['services_amount'], 'environment' => $nfe_for_invoice['environment'], 'flow_status' => $nfe_for_invoice['flow_status']], $nfe_for_invoice['user_id'], $vars['invoiceid'], 'n/a', $nfe_for_invoice['created_at'], date('Y-m-d H:i:s'));
$message = '<div style="position:absolute;top: -5px;width: 50%;left: 25%;background: #5cb85c;color: #ffffff;padding: 5px;text-align: center;">Nota Fiscal Cancelada com Sucesso</div>';
header_remove();
header('Location: ' . $gnfewhmcsadminurl . 'invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_message=' . base64_encode(urlencode($message)));
header('Location: invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_message=' . base64_encode(urlencode($message)));

return '';
}
Expand All @@ -74,7 +71,7 @@
logModuleCall('gofas_nfeio', 'admininvoicecontorloutput - gnfe_email',$_REQUEST['gnfe_email'], $gnfe_email, 'OK', '');
$message = '<div style="position:absolute;top: -5px;width: 50%;left: 25%;background: #5cb85c;color: #ffffff;padding: 5px;text-align: center;">Email Enviado com Sucesso</div>';
header_remove();
header('Location: ' . $gnfewhmcsadminurl . 'invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_message=' . base64_encode(urlencode($message)));
header('Location: invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_message=' . base64_encode(urlencode($message)));

exit;
}
Expand All @@ -83,7 +80,7 @@
logModuleCall('gofas_nfeio', 'admininvoicecontorloutput - gnfe_email',$_REQUEST['gnfe_email'], $gnfe_email, 'ERROR', '');
$message = '<div style="position:absolute;top: -5px;width: 50%;left: 25%;background: #d9534f;color: #ffffff;padding: 5px;text-align: center;">' . $gnfe_email->message . '</div>';
header_remove();
header('Location: ' . $gnfewhmcsadminurl . 'invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_message=' . base64_encode(urlencode($message)));
header('Location: invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_message=' . base64_encode(urlencode($message)));

exit;
}
Expand Down Expand Up @@ -126,10 +123,10 @@
}
echo '<div style="text-align: left; padding: 8px 0px; max-width: 445px; border-top: 1px solid #ccc; margin: 8px 0px;">';
echo '<div style="margin: 0px 0px 5px 0px;"><strong>Nota Fiscal:</strong>' . $invoice_nfe . '</div>';
echo '<button ' . $disabled['a'] . ' style="margin-right: 4px;" onclick="location.href=`' . $gnfewhmcsadminurl . 'invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_create=yes`" class="btn btn-primary" id="gnfe_generate" title="Emitir Nota Fiscal">Emitir NFE</button>';
echo '<button ' . $disabled['b'] . ' style="margin-right: 4px;" onclick="location.href=`' . $gnfewhmcsadminurl . 'invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_open=' . $vars['invoiceid'] . '`" class="btn btn-success" id="gnfe_view" title="Ver Nota Fiscal">Visualizar NFE</button>';
echo '<button ' . $disabled['c'] . ' style="margin-right: 4px;" onclick="location.href=`' . $gnfewhmcsadminurl . 'invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_cancel=' . $nfe_for_invoice['nfe_id'] . '`" class="btn btn-danger" id="gnfe_cancel" title="Cancelar Nota Fiscal">Cancelar NFE</button>';
echo '<button ' . $disabled['d'] . ' onclick="location.href=`' . $gnfewhmcsadminurl . 'invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_email=' . $nfe_for_invoice['nfe_id'] . '`" class="btn btn-primary" id="gnfe_email" title="Enviar Nota Fiscal por Email">Enviar Email</button>';
echo '<button ' . $disabled['a'] . ' style="margin-right: 4px;" onclick="location.href=`invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_create=yes`" class="btn btn-primary" id="gnfe_generate" title="Emitir Nota Fiscal">Emitir NFE</button>';
echo '<button ' . $disabled['b'] . ' style="margin-right: 4px;" onclick="location.href=`invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_open=' . $vars['invoiceid'] . '`" class="btn btn-success" id="gnfe_view" title="Ver Nota Fiscal">Visualizar NFE</button>';
echo '<button ' . $disabled['c'] . ' style="margin-right: 4px;" onclick="location.href=`invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_cancel=' . $nfe_for_invoice['nfe_id'] . '`" class="btn btn-danger" id="gnfe_cancel" title="Cancelar Nota Fiscal">Cancelar NFE</button>';
echo '<button ' . $disabled['d'] . ' onclick="location.href=`invoices.php?action=edit&id=' . $vars['invoiceid'] . '&gnfe_email=' . $nfe_for_invoice['nfe_id'] . '`" class="btn btn-primary" id="gnfe_email" title="Enviar Nota Fiscal por Email">Enviar Email</button>';
echo '<div>';

if ($_REQUEST['gnfe_error']) {
Expand Down
Loading

0 comments on commit ba15ce0

Please sign in to comment.