Last active
January 12, 2021 20:50
-
-
Save mauriciogofas/c83aaac28c14c2d51f066a7b60345bd8 to your computer and use it in GitHub Desktop.
Ignorar Grupos de produtos ao gerar o Boleto - Módulo Gofas Gerencianet Boleto para WHMCS #whmcs #gerencianet #boleto #ggnb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Módulo Gerencinet Boleto para WHMCS | |
* @author Mauricio Gofas | gofas.net | |
* @see https://gofas.net/?p=7893 | |
* @copyright 2016->2018 Gofas Softwares | |
* @license https://gofas.net?p=9340 | |
* @support https://gofas.net/?p=7856 | |
* @version 2.2.1 | |
*/ | |
if(!defined('WHMCS')) { die(); } | |
/** | |
* | |
* Adicione aqui as variáveis personalizadas que irão alterar o funcionamento do módulo. | |
* Exemplo: Para alterar o URL da instalação do WHMCS, use | |
* $system_url = 'https://exemplo.com.br'; | |
* | |
* | |
*/ | |
// Define groups to not generate billet | |
use WHMCS\Database\Capsule; | |
if( $params['product_groups_to_ignore'] ) { | |
if(!stripos($_SERVER['REQUEST_URI'], 'viewinvoice') and $params['billetonemail']) { | |
$extra_conf = explode(',', $params['product_groups_to_ignore']); | |
$tblproducts = array(); | |
$tblinvoiceitems = array(); | |
foreach($extra_conf as $gid) { | |
foreach( Capsule::table('tblproducts') -> where( 'gid', '=', $gid ) -> get( array( 'id' ) ) as $tblproducts_ ) { | |
$tblproducts[] = $tblproducts_->id; | |
} | |
} | |
foreach( Capsule::table('tblinvoiceitems') -> where( 'invoiceid', '=', $invoice_id ) -> get( array( 'relid' ) ) as $tblinvoiceitems ) { | |
$GetClientsProducts = localAPI('GetClientsProducts', array('clientid' => $params['clientdetails']['id'],'serviceid'=>$tblinvoiceitems->relid,'stats' => false), $whmcsAdmin); | |
$GetClientsProductsProducts = $GetClientsProducts['products']['product']; | |
foreach( $GetClientsProductsProducts as $GetClientsProductsProduct ) { | |
if ( in_array($GetClientsProductsProduct['pid'], $tblproducts )) { | |
$generate_billet = false; | |
} | |
} | |
} | |
} | |
if($debug_or_log) { | |
$log_result['tblproducts'] = $tblproducts; | |
$log_result['GetClientsProducts'] = $GetClientsProductsProduct['orderid']; | |
if(!$generate_billet) { | |
$log_result['product_groups_to_ignore'] = 'Não gerar o Boleto'; | |
} | |
else { | |
$log_result['product_groups_to_ignore'] = 'Gerar o Boleto'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment