mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Recurring invoices at wrong date #1404
This commit is contained in:
parent
bd6edb2d2c
commit
35fd940806
@ -1181,10 +1181,18 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
if (! $this->last_sent_date) {
|
if (! $this->last_sent_date) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
$date1 = new DateTime($this->last_sent_date);
|
||||||
|
$date2 = new DateTime();
|
||||||
|
$diff = $date2->diff($date1);
|
||||||
|
$daysSinceLastSent = $diff->format('%a');
|
||||||
|
$monthsSinceLastSent = ($diff->format('%y') * 12) + $diff->format('%m');
|
||||||
|
|
||||||
|
/*
|
||||||
$date1 = Carbon::parse($this->last_sent_date, $timezone);
|
$date1 = Carbon::parse($this->last_sent_date, $timezone);
|
||||||
$date2 = Carbon::now($timezone);
|
$date2 = Carbon::now($timezone);
|
||||||
$daysSinceLastSent = $date1->diffInDays($date2);
|
$daysSinceLastSent = $date1->diffInDays($date2);
|
||||||
$monthsSinceLastSent = $date1->diffInMonths($date2);
|
$monthsSinceLastSent = $date1->diffInMonths($date2);
|
||||||
|
*/
|
||||||
|
|
||||||
if ($daysSinceLastSent == 0) {
|
if ($daysSinceLastSent == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -161,8 +161,8 @@ trait GeneratesNumbers
|
|||||||
if (count($matches) > 1) {
|
if (count($matches) > 1) {
|
||||||
$format = $matches[1];
|
$format = $matches[1];
|
||||||
$search[] = $matches[0];
|
$search[] = $matches[0];
|
||||||
//$date = date_create()->format($format);
|
$date = date_create()->format($format);
|
||||||
$date = Carbon::now(session(SESSION_TIMEZONE, DEFAULT_TIMEZONE))->format($format);
|
//$date = Carbon::now(session(SESSION_TIMEZONE, DEFAULT_TIMEZONE))->format($format);
|
||||||
$replace[] = str_replace($format, $date, $matches[1]);
|
$replace[] = str_replace($format, $date, $matches[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user