Skip to content

Commit

Permalink
Merge pull request #37 from ole1986/fixed-invoice-reminder
Browse files Browse the repository at this point in the history
Fixed invoice reminder
  • Loading branch information
ole1986 authored Apr 29, 2022
2 parents 2a0bd8b + 211b80c commit b65e607
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions model/invoice-task.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,13 @@ public function payment_reminder()
if (!empty($res)) {
foreach ($res as $v) {
$due_date = new \DateTime($v->due_date);
$due_date->add(new \DateInterval("P{$age}D"));

$diff = $due_date->diff(new \DateTime());
$diffDays = intval($diff->format("%a"));

$acceptableDays = $age + ($interval * $v->reminder_sent);
$acceptableDays = $age + ($interval * intval($v->reminder_sent));

if ($v->reminder_sent >= 1 && $diffDays <= $acceptableDays) {
if ($diffDays <= $acceptableDays) {
// age: 2 days, interval: 2 days
// 4 days later for the second reminder
// 6 days later for the third reminder
Expand Down
2 changes: 1 addition & 1 deletion wc-invoice-pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Plugin Name: WC Recurring Invoice PDF
* Description: WooCommerce invoice pdf plugin with recurring payments (scheduled)
* Version: 1.5.15
* Version: 1.5.16
* Author: ole1986 <[email protected]>
* Author URI: https://github.com/ole1986/wc-invoice-pdf
* Plugin URI: https://github.com/ole1986/wc-invoice-pdf/releases
Expand Down

0 comments on commit b65e607

Please sign in to comment.