Skip to content

Instantly share code, notes, and snippets.

@mauriciogofas
Last active April 2, 2023 22:50
Show Gist options
  • Save mauriciogofas/b44412a3183b15ae33960f6b8100b713 to your computer and use it in GitHub Desktop.
Save mauriciogofas/b44412a3183b15ae33960f6b8100b713 to your computer and use it in GitHub Desktop.
Definir gerar ou não o boleto ao gerar a fatura no perfil do cliente, via custom field #whmcs #gerencinet #boleto #ggnb
<?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';
*
*
*/
use WHMCS\Database\Capsule;
//////////
// Define if billet generate for this user, on invoice generate
if( $params['custom_field_to_ignore'] ) {
if(!stripos($_SERVER['REQUEST_URI'], 'viewinvoice') and $params['billetonemail']) {
foreach( Capsule::table('tblcustomfieldsvalues') -> where( 'fieldid', '=', $params['custom_field_to_ignore'] ) -> where( 'relid', '=', $params['clientdetails']['id'] ) -> get( array( 'value' ) ) as $customfieldvalue_ ) {
$not_generate_billet_field = $customfieldvalue_->value;
}
if ( $not_generate_billet_field === 'on') {
$generate_billet = false;
}
if($debug_or_log) {
if(!$generate_billet) {
$log_result['custom_field_to_ignore'] = $not_generate_billet_field.': Não gerar o Boleto ao gerar a fatura.';
}
else {
$log_result['custom_field_to_ignore'] = $not_generate_billet_field.': Gerar o Boleto ao gerar a fatura.';
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment