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
{
'%s',
)
);
+
}
/**
'%s'
)
);
+
+ // Create Notification Object
+ $Notifications = new GlmNotifications( $this->wpdb, $this->config );
+
+ echo '<pre>$type: ' . print_r( $type, true ) . '</pre>';
+
+ // 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 '<pre>$notices: ' . print_r( $notices, true ) . '</pre>';
+ foreach ( $notices as $notice ) {
+ $Notifications->sendEmailNotification( $notice['id'], $account );
+ }
+ break;
+ default:
+ break;
+
+ }
+
}
/**
}
// get the Notification type
- var_dump( $notification_id );
+ // var_dump( $notification_id );
$notification_type = $this->getNotificationTypeById( $notification_id );
- echo '<pre>$notification_type: ' . print_r( $notification_type, true ) . '</pre>';
+ // echo '<pre>$notification_type: ' . print_r( $notification_type, true ) . '</pre>';
if ( !$notification_type ) {
// If there's no notification type then return false.
return false;
'phone' => $account['billing_phone'],
)
);
- echo '<pre>$notification_type[message]: ' . print_r( $notification_type['message'], true ) . '</pre>';
+ // echo '<pre>$notification_type[message]: ' . print_r( $notification_type['message'], true ) . '</pre>';
$notification_message = $this->parseSmartyTemplateString(
$account_data,
wpautop( $notification_type['message'] )
);
- echo '<pre>$account_data: ' . print_r( $account_data, true ) . '</pre>';
- echo '<pre>$notification_message: ' . print_r( $notification_message, true ) . '</pre>';
+ // echo '<pre>$account_data: ' . print_r( $account_data, true ) . '</pre>';
+ // echo '<pre>$notification_message: ' . print_r( $notification_message, true ) . '</pre>';
// exit;
$smarty->templateAssign( 'title', $notification_type['subject'] );
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
);
<input type="hidden" name="option" value="insert">
{/if}
+{debug}
<table class="glm-admin-table glm-event-table">
<tr>
<td>
<select name="send_action">
{foreach $send_action as $id => $val}
- <option value="{$id}">{$val}</option>
+ <option value="{$id}"{if $id == $notification.fieldData.send_action} selected{/if}>{$val}</option>
{/foreach}
</select>
</td>