$option = $_REQUEST['option'];
}
+ // Special case for option 'delete'
+ if ( $option == 'delete' ) {
+ $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+ if ( isset( $_REQUEST['invoice_id'] ) && $invoice_id = filter_var( $_REQUEST['invoice_id'], FILTER_VALIDATE_INT ) ) {
+ $deleteNumber = $BillingSupport->removeInvoiceById( $invoice_id );
+ }
+
+ if ( $deleteNumber ) {
+ $invoiceDeleted = true;
+ } else {
+ $invoiceDeleteError = true;
+ }
+ }
+
+ // Special case for option 'send_invoice'
+ if ( $option == 'send_invoice' ) {
+ $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+
+ $invoice_id = false;
+ $member_id = false;
+ $account_id = false;
+
+ $type = $this->config['transaction_numb']['Invoice'];
+
+ // Get invoice method for a member account
+ if ( isset( $_REQUEST['invoice_id'] ) ) {
+ $invoice_id = filter_var( $_REQUEST['invoice_id'], FILTER_VALIDATE_INT );
+ }
+ if ( isset( $_REQUEST['member_id'] ) ) {
+ $member_id = filter_var( $_REQUEST['member_id'], FILTER_VALIDATE_INT );
+ }
+ if ( isset( $_REQUEST['account_id'] ) ) {
+ $account_id = filter_var( $_REQUEST['account_id'], FILTER_VALIDATE_INT );
+ }
+
+ if ( $invoice_id && $member_id && $account_id ) {
+ $Notifications = new GlmNotifications( $this->wpdb, $this->config );
+ $invoice = $BillingSupport->getInvoiceById( $invoice_id );
+ $invoice_total = $invoice['balance'];
+ $data = array(
+ 'type' => $type,
+ 'type_id' => $invoice_id,
+ 'account' => $account_id,
+ 'amount' => $invoice_total,
+ 'payment' => 0,
+ );
+ $notices = $Notifications->getNotificationsWithSendByAction( $type );
+ foreach ( $notices as $notice ) {
+ $Notifications->sendEmailNotification( $notice['id'], $account_id, $data );
+ }
+ }
+ echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+ $invoiceSent = true;
+ }
+
// Do selected option
switch ($option) {
break;
- case 'delete':
- $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
- if ( isset( $_REQUEST['invoice_id'] ) && $invoice_id = filter_var( $_REQUEST['invoice_id'], FILTER_VALIDATE_INT ) ) {
- $deleteNumber = $BillingSupport->removeInvoiceById( $invoice_id );
- }
-
- if ( $deleteNumber ) {
- $invoiceDeleted = true;
- } else {
- $invoiceDeleteError = true;
- }
-
- case 'send_invoice':
- $BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
-
- $invoice_id = false;
- $member_id = false;
- $account_id = false;
-
- $type = $this->config['transaction_numb']['Invoice'];
-
- // Get invoice method for a member account
- if ( isset( $_REQUEST['invoice_id'] ) ) {
- $invoice_id = filter_var( $_REQUEST['invoice_id'], FILTER_VALIDATE_INT );
- }
- if ( isset( $_REQUEST['member_id'] ) ) {
- $member_id = filter_var( $_REQUEST['member_id'], FILTER_VALIDATE_INT );
- }
- if ( isset( $_REQUEST['account_id'] ) ) {
- $account_id = filter_var( $_REQUEST['account_id'], FILTER_VALIDATE_INT );
- }
-
- if ( $invoice_id && $member_id && $account_id ) {
- $Notifications = new GlmNotifications( $this->wpdb, $this->config );
- $invoice = $BillingSupport->getInvoiceById( $invoice_id );
- $invoice_total = $invoice['balance'];
- $data = array(
- 'type' => $type,
- 'type_id' => $invoice_id,
- 'account' => $account_id,
- 'amount' => $invoice_total,
- 'payment' => 0,
- );
- $notices = $Notifications->getNotificationsWithSendByAction( $type );
- foreach ( $notices as $notice ) {
- $Notifications->sendEmailNotification( $notice['id'], $account_id, $data );
- }
- }
- // echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
- $invoiceSent = true;
-
case 'list':
default:
<div class="billing-search-form-container">
<label>Invoice #: </label>
<input id="member-invoice-id" type="hidden" name="filterInvoice" value="{$filterInvoices}">
- <input id="invoice_id" name="searchInvoice" value="" />
+ <input id="invoiceId" name="searchInvoice" value="" />
</div>
<div class="billing-search-form-container">
<label>
{/if}
</span>
<span class="account-dashboard-link">
- <a onClick="return confirm('This will delete the invoice. This cannot be undone. Are you Sure?');" href="{$thisUrl}?page={$thisPage}&glm_action=invoices&option=delete&invoice_id={$t.id}">Delete</a>
+ <a onClick="return confirm('This will delete the invoice. This cannot be undone. Are you Sure?');"
+ href="{$thisUrl}?page={$thisPage}&glm_action=invoices&option=delete&invoice_id={$t.id}">Delete</a>
</span>
</td>
</tr>
{ label: "{$m.id} ( {$m.member_name|unescape:'html'|replace:'"':''} )", value: "{$m.id|unescape:'html'|replace:'"':''}", id: '{$m.id}' },
{/foreach}
]
- $('#invoice_id').autocomplete({
+ $('#invoiceId').autocomplete({
source: availableInvoices,
select: function( event, ui ){
$('#member-invoice-id').val( ui.item.id );
- $('#invoice_id').val( ui.item.id );
+ $('#invoiceId').val( ui.item.id );
// console.log( 'selected invoice id: ', ui.item.id );
$('#searchForm').submit();
},