// Set transaction_time to current time.
$_REQUEST['transaction_time'] = date('Y-m-d H:i:s');
$_REQUEST['due_date'] = date('Y-m-d', strtotime($_REQUEST['due_date']));
- // echo '<pre>' . print_r( $_REQUEST, true ) . '</pre>';
$invoices = $this->insertEntry();
// TODO: Need to check to see if we received a good response
array( '%s' ),
array( '%d' )
);
+ // Check the billing account and see if it needs to have invoice_type set.
+ $invoice_type_id = $this->wpdb->get_var(
+ $this->wpdb->prepare(
+ "SELECT invoice_type
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts
+ WHERE id = %d",
+ $_REQUEST['account']
+ )
+ );
+ if ( !$invoice_type_id ) {
+ // Then setup the invoice_type id
+ $this->wpdb->update(
+ GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'accounts',
+ array(
+ 'invoice_type' => $line_item,
+ 'email_invoice' => true
+ ),
+ array( 'id' => $_REQUEST['account'] ),
+ array(
+ '%d',
+ '%d'
+ ),
+ array( '%d' )
+ );
+ }
}
}
}