From 171d0778610332013b6f5e25b294e9781f67c8a4 Mon Sep 17 00:00:00 2001 From: ole Date: Fri, 24 Nov 2017 00:13:13 +0100 Subject: [PATCH] hotfix: customer does not receive recurring reminders, when invoice is exported --- model/invoice-task.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/invoice-task.php b/model/invoice-task.php index 20a6c05..28f6475 100644 --- a/model/invoice-task.php +++ b/model/invoice-task.php @@ -179,7 +179,7 @@ public function payment_recur_reminder() { $messageBody = WCInvoicePdf::$OPTIONS['wc_recur_reminder_message']; // fetch all invoices which have status = Sent (ignore all invoice which are already marked as paid) - $sql = "SELECT * FROM {$wpdb->prefix}".Invoice::TABLE." WHERE `status` = 1 AND DATE_ADD(NOW(), INTERVAL -{$age} DAY) > due_date AND reminder_sent < $max"; + $sql = "SELECT * FROM {$wpdb->prefix}".Invoice::TABLE." WHERE deleted = 0 AND NOT (`status` & ".Invoice::PAID.") AND `status` < ".Invoice::CANCELED." AND DATE_ADD(NOW(), INTERVAL -{$age} DAY) > due_date AND reminder_sent < $max"; $res = $wpdb->get_results($sql, OBJECT);