WIP: get accounts with renewal dates
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 3 Apr 2018 20:56:21 +0000 (16:56 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 3 Apr 2018 20:56:21 +0000 (16:56 -0400)
Working on getting accounts for a notificition based on renewal date
before.

classes/billingSupport.php
models/admin/ajax/setupQueue.php

index 84c42bc..96d9528 100644 (file)
@@ -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"
         );
     }
 
index fec9a79..9c6e0f4 100644 (file)
@@ -81,6 +81,16 @@ class GlmMembersAdmin_ajax_setupQueue
 
         foreach ( $notifications as $notice ) {
             echo '<pre>$notice: ' . print_r( $notice, true ) . '</pre>';
+            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 '<pre>$accounts: ' . print_r( $accounts, true ) . '</pre>';
         }
 
         // Loop through the invoices and for each one see if any notices are to be sent out.