From: Steve Sutton Date: Tue, 3 Apr 2018 20:56:21 +0000 (-0400) Subject: WIP: get accounts with renewal dates X-Git-Tag: v1.0.0^2~77 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=56fc8bd98a747fdb7a6e4fa151e7065289181153;p=WP-Plugins%2Fglm-member-db-billing.git WIP: get accounts with renewal dates Working on getting accounts for a notificition based on renewal date before. --- diff --git a/classes/billingSupport.php b/classes/billingSupport.php index 84c42bc..96d9528 100644 --- a/classes/billingSupport.php +++ b/classes/billingSupport.php @@ -550,7 +550,8 @@ class GlmBillingSupport return $this->wpdb->get_results( "SELECT * FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts - WHERE renewal_date + INTERVAL 1 YEAR " . ($before ? '-' : '+' ) . " $days DAY <= '$curDate'" + WHERE renewal_date + INTERVAL 1 YEAR " . ($before ? '-' : '+' ) . " $days DAY = '$curDate' + AND archived <> true" ); } diff --git a/models/admin/ajax/setupQueue.php b/models/admin/ajax/setupQueue.php index fec9a79..9c6e0f4 100644 --- a/models/admin/ajax/setupQueue.php +++ b/models/admin/ajax/setupQueue.php @@ -81,6 +81,16 @@ class GlmMembersAdmin_ajax_setupQueue foreach ( $notifications as $notice ) { echo '
$notice: ' . print_r( $notice, true ) . '
'; + switch( $notice['send_date_period'] ) { + case $this->config['send_date_when_numb']['After']: + $before = false; + break; + case $this->config['send_date_when_numb']['Before']: + $before = true; + break; + } + $accounts = $billingSupport->getAccountsRenewing( $notice['send_date_number'], $before ); + echo '
$accounts: ' . print_r( $accounts, true ) . '
'; } // Loop through the invoices and for each one see if any notices are to be sent out.