$Accounts = new GlmDataAccounts( $this->wpdb, $this->config );
- if ( isset( $memberId ) && $memberId ) {
- require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php';
- $accountId = $this->wpdb->get_var(
- $this->wpdb->prepare(
- "SELECT id
- FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
- WHERE ref_dest = %d",
- $this->memberId
- )
- );
- if ( isset( $accountId ) && $accountId ) {
- $account_status = apply_filters( 'glm-billing-get-account-status', '', $accountId );
- }
- }
+ // if ( isset( $memberId ) && $memberId ) {
+ // require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php';
+ // $accountId = $this->wpdb->get_var(
+ // $this->wpdb->prepare(
+ // "SELECT id
+ // FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ // WHERE ref_dest = %d",
+ // $this->memberId
+ // )
+ // );
+ // if ( isset( $accountId ) && $accountId ) {
+ // $account_status = apply_filters( 'glm-billing-get-account-status', '', $accountId );
+ // }
+ // }
switch ( $option ) {
case 'payment':
$management = $Management->getEntry( 1 );
require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php';
- if ( $accountId ) {
- // Need to see if there's an account for this member.
- $account = $Accounts->editEntry( $accountId );
- } else {
- $account = $Accounts->newEntry();
- }
+ $account = $Accounts->newEntry();
}
break;
// Look at the payment option given
$payment_option = filter_var( $_REQUEST['payment_option'], FILTER_SANITIZE_STRING );
- // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
- // echo '<pre>$payment_option: ' . print_r( $payment_option, true ) . '</pre>';
switch ( $payment_option ) {
case 'pay_by_credit_card':
// Get list of payable invoice_types
$payable_types = $BillingSupport->getAllPayableInvoiceTypes();
- // $member_invoice_id = $BillingSupport->getMembersInvoiceTypeByRefDest( $this->memberId );
- // if ( $member_invoice_id ) {
- // $member_invoice = $BillingSupport->getInvoiceTypeById( $member_invoice_id );
- // }
-
if ( $this->config['settings']['allow_employees'] ) {
// Get a list of this accounts employees. If they have any.
$employees = $BillingSupport->getListOfAccountEmployees( $this->memberId );
$management = $Management->getEntry( 1 );
// Need to see if there's an account for this member.
- $account = $Accounts->editEntry( $accountId );
+ // $account = $Accounts->editEntry( $accountId );
+ $account = $Accounts->newEntry();
+ // Assign posted values to the $account object.
+ if ( $this->config['settings']['billing_contact_name_enabled'] ) {
+ if ( isset( $_REQUEST['billing_contact_name'] ) && $_REQUEST['billing_contact_name'] ) {
+ $account['fieldData']['billing_contact_name'] = $_REQUEST['billing_contact_name'];
+ }
+ } else {
+ if ( isset( $_REQUEST['billing_fname'] ) && $_REQUEST['billing_fname'] ) {
+ $account['fieldData']['billing_fname'] = $_REQUEST['billing_fname'];
+ }
+ if ( isset( $_REQUEST['billing_lname'] ) && $_REQUEST['billing_lname'] ) {
+ $account['fieldData']['billing_lname'] = $_REQUEST['billing_lname'];
+ }
+ }
+ if ( isset( $_REQUEST['billing_addr1'] ) && $_REQUEST['billing_addr1'] ) {
+ $account['fieldData']['billing_addr1'] = $_REQUEST['billing_addr1'];
+ }
+ if ( isset( $_REQUEST['billing_state'] ) && $_REQUEST['billing_state'] ) {
+ $account['fieldData']['billing_state']['value'] = $_REQUEST['billing_state'];
+ }
+ if ( isset( $_REQUEST['billing_city'] ) && $_REQUEST['billing_city'] ) {
+ $account['fieldData']['billing_city'] = $_REQUEST['billing_city'];
+ }
+ if ( isset( $_REQUEST['billing_zip'] ) && $_REQUEST['billing_zip'] ) {
+ $account['fieldData']['billing_zip'] = $_REQUEST['billing_zip'];
+ }
+ if ( isset( $_REQUEST['email'] ) && $_REQUEST['email'] ) {
+ $account['fieldData']['email'] = $_REQUEST['email'];
+ }
}
break;
case 'pay_by_check':