From: Steve Sutton Date: Tue, 13 Mar 2018 21:26:04 +0000 (-0400) Subject: WIP work on notifications X-Git-Tag: v1.0.0^2~152 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=6dd8cd0ffa380f5596c0eb1cb5bc5b9f9356242b;p=WP-Plugins%2Fglm-member-db-billing.git WIP work on notifications Need to work on the notifications for payments and invoices. --- diff --git a/classes/billingSupport.php b/classes/billingSupport.php index 0f70398..923184e 100644 --- a/classes/billingSupport.php +++ b/classes/billingSupport.php @@ -19,6 +19,7 @@ require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataAccounts.php'; require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataInvoices.php'; require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataInvoiceTypes.php'; require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/data/dataNotificationTypes.php'; +require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/notifications.php'; class GlmBillingSupport { @@ -233,6 +234,7 @@ class GlmBillingSupport '%s', ) ); + } /** @@ -296,6 +298,28 @@ class GlmBillingSupport '%s' ) ); + + // Create Notification Object + $Notifications = new GlmNotifications( $this->wpdb, $this->config ); + + echo '
$type: ' . print_r( $type, true ) . '
'; + + // Trigger sending the email notifications for send by action 'payment received' + switch ( $type ) { + + case $this->config['transaction_numb']['Invoice']: + case $this->config['transaction_numb']['Payment']: + $notices = $Notifications->getNotificationsWithSendByAction( $type ); + echo '
$notices: ' . print_r( $notices, true ) . '
'; + foreach ( $notices as $notice ) { + $Notifications->sendEmailNotification( $notice['id'], $account ); + } + break; + default: + break; + + } + } /** diff --git a/classes/notifications.php b/classes/notifications.php index b58b5c8..1a625aa 100644 --- a/classes/notifications.php +++ b/classes/notifications.php @@ -88,9 +88,9 @@ class GlmNotifications } // get the Notification type - var_dump( $notification_id ); + // var_dump( $notification_id ); $notification_type = $this->getNotificationTypeById( $notification_id ); - echo '
$notification_type: ' . print_r( $notification_type, true ) . '
'; + // echo '
$notification_type: ' . print_r( $notification_type, true ) . '
'; if ( !$notification_type ) { // If there's no notification type then return false. return false; @@ -124,13 +124,13 @@ class GlmNotifications 'phone' => $account['billing_phone'], ) ); - echo '
$notification_type[message]: ' . print_r( $notification_type['message'], true ) . '
'; + // echo '
$notification_type[message]: ' . print_r( $notification_type['message'], true ) . '
'; $notification_message = $this->parseSmartyTemplateString( $account_data, wpautop( $notification_type['message'] ) ); - echo '
$account_data: ' . print_r( $account_data, true ) . '
'; - echo '
$notification_message: ' . print_r( $notification_message, true ) . '
'; + // echo '
$account_data: ' . print_r( $account_data, true ) . '
'; + // echo '
$notification_message: ' . print_r( $notification_message, true ) . '
'; // exit; $smarty->templateAssign( 'title', $notification_type['subject'] ); @@ -284,7 +284,7 @@ class GlmNotifications FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "notification_types WHERE send_by_action AND send_action = %d", - $this->config['send_action_numb'][$type] + $this->config['send_action'][$type] ), ARRAY_A ); diff --git a/views/admin/settings/editNotificationType.html b/views/admin/settings/editNotificationType.html index b71f269..c52b7e6 100644 --- a/views/admin/settings/editNotificationType.html +++ b/views/admin/settings/editNotificationType.html @@ -15,6 +15,7 @@ {/if} +{debug} @@ -66,7 +67,7 @@