Last active
April 2, 2023 22:50
-
-
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
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'; | |
* | |
* | |
*/ | |
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