$billingContactNameRequired = false;
$billingFieldsRequired = $this->config['settings']['billing_fields_required'];
$billingContactNameEnabled = $this->config['settings']['billing_contact_name_enabled'];
+ $billingAccountEnabled = $this->config['settings']['account_number_enabled'];
+ $billingAccountRequired = $this->config['settings']['account_number_required'];
+ $billingAccountUnique = $this->config['settings']['account_number_unique'];
if ( $billingFieldsRequired && $billingContactNameEnabled ) {
$billingContactNameRequired = true;
} else if ( $billingFieldsRequired && !$billingContactNameEnabled ) {
'field' => 'account_number',
'type' => 'text',
'use' => 'a',
- 'required' => true,
- 'unique' => true,
+ 'required' => (bool)$billingAccountRequired,
+ 'unique' => (bool)$billingAccountUnique,
),
// Invoice Delivery Methods
$glmMembersBillingManagement = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX."management WHERE id = 1", ARRAY_A );
unset($glmMembersBillingManagement['id']);
+
+ $glmMembersBillingTerms = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX."settings_terms WHERE id = 1", ARRAY_A );
+ unset($glmMembersBillingTerms['id']);
}
function glmMembersBillingRegisterAddOn($addOns) {
'slug' => GLM_MEMBERS_BILLING_PLUGIN_SLUG,
'actions' => $GLOBALS['glmMembersBillingAddOnValidActions'],
'config' => array(
- 'settings' => $GLOBALS['glmMembersBillingSettings'],
+ 'settings' => $GLOBALS['glmMembersBillingSettings'],
'billing_settings' => $GLOBALS['glmMembersBillingManagement'],
+ 'billing_terms' => $GLOBALS['glmMembersBillingTerms'],
),
'shortcodes' => $GLOBALS['glmMembersBillingShortcodes'],
'shortcodesDescription' => $GLOBALS['glmMembersBillingShortcodesDescription']
*/
public function createPdf( $invoices, $outputStyle = 'stream' )
{
+ // $config = $this->config;
+ // echo '<pre>$config: ' . print_r( $config, true ) . '</pre>';
+ // exit;
+ $accountNumberLabel = $this->config['billing_terms']['account_number'];
+ $showAccountNumber = $this->config['settings']['invoice_show_account_number'];
+ $showInvoiceNumber = $this->config['settings']['invoice_show_invoice_number'];
$this->setupPages();
$totalPdfs = count( $invoices );
$this->ezSetY( $companyNameSaveY );
// Add the Date of invoice and the member account number using ezTable.
- $invoiceData = array(
- array( 'header' => 'Date:', 'value' => date( 'm/d/Y', strtotime( $invoice['due_date'] ) ), 'headerFill' => $this->color_white, 'valueFill' => $this->color_white ),
- array( 'header' => 'Member Billing #:', 'value' => $account['account_number'], 'headerFill' => $this->color_white, 'valueFill' => $this->color_white )
+ $invoiceData[] = array(
+ 'header' => 'Date:', 'value' => date( 'm/d/Y', strtotime( $invoice['due_date'] ) ), 'headerFill' => $this->color_white, 'valueFill' => $this->color_white
);
+ if ( $showAccountNumber ) {
+ $invoiceData[] = array(
+ 'header' => $accountNumberLabel . ':', 'value' => $account['account_number'], 'headerFill' => $this->color_white, 'valueFill' => $this->color_white
+ );
+ }
+ if ( $showInvoiceNumber ) {
+ $invoiceData[] = array(
+ 'header' => 'Invoice #:', 'value' => $invoice['id'], 'headerFill' => $this->color_white, 'valueFill' => $this->color_white
+ );
+ }
$this->ezTable(
$invoiceData,
array( 'header' => '', 'value' => '' ),
$newY = $this->ezText( '', $this->pdf_font_size );
$newY = $this->addText( 375, $newY, 14, '<b>NO PAYMENT REQUIRED</b>' );
}
- $paymentForm3 = array(
- array( 'header' => '<b>Member Billing #:</b>', 'value' => $account['account_number'] ),
- );
+ if ( $showAccountNumber ) {
+ $paymentForm3[] = array( 'header' => '<b>'.$accountNumberLabel . ':</b>', 'value' => $account['account_number'] );
+ }
+ if ( $showInvoiceNumber ) {
+ $paymentForm3[] = array( 'header' => '<b>Invoice #:</b>', 'value' => $invoice['id'], 'headerFill' => $this->color_white, 'valueFill' => $this->color_white );
+ }
$this->ezTable(
$paymentForm3,
array( 'header' => 'Header', 'value' => 'Value' ),
{if $accountID}
<input type="hidden" name="id" value="{$accountID}">
{/if}
+ {if !$settings.account_number_enabled}<input type="hidden" name="account_number" value="{$account.fieldData.account_number}" />{/if}
<fieldset>
<legend>Account Information</legend>
</div>
{if !$lockedToMember}
-
- <div class="glm-billing-field">
- <div class="glm-billing-label{if $account.fieldRequired.account_number} glm-required{/if}">Account Number</div>
- <div class="glm-billing-input{if $account.fieldFail.account_number} glm-form-bad-input{/if}" data-tabid="glm-account_number">
- <input type="text" name="account_number" value="{$account.fieldData.account_number}" class="glm-form-text-input-medium"{if $account.fieldRequired.account_number} required{/if}>
- {if $account.fieldFail.account_number}<p>{$account.fieldFail.account_number}</p>{/if}<br>
+ {if $settings.account_number_enabled}
+ <div class="glm-billing-field">
+ <div class="glm-billing-label{if $account.fieldRequired.account_number} glm-required{/if}">Account Number</div>
+ <div class="glm-billing-input{if $account.fieldFail.account_number} glm-form-bad-input{/if}" data-tabid="glm-account_number">
+ <input type="text" name="account_number" value="{$account.fieldData.account_number}" class="glm-form-text-input-medium"{if $account.fieldRequired.account_number} required{/if}>
+ {if $account.fieldFail.account_number}<p>{$account.fieldFail.account_number}</p>{/if}<br>
+ </div>
</div>
- </div>
+ {/if}
{if !$settings.member_types_enabled}