mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 12:54:31 -04:00
Check invoices aren't sent hours early
This commit is contained in:
parent
9fe32b903d
commit
b2730463eb
@ -1207,13 +1207,12 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
$daysSinceLastSent = $diff->format('%a');
|
$daysSinceLastSent = $diff->format('%a');
|
||||||
$monthsSinceLastSent = ($diff->format('%y') * 12) + $diff->format('%m');
|
$monthsSinceLastSent = ($diff->format('%y') * 12) + $diff->format('%m');
|
||||||
|
|
||||||
/*
|
// check we don't send a few hours early due to timezone difference
|
||||||
$date1 = Carbon::parse($this->last_sent_date, $timezone);
|
if (Carbon::now()->format('Y-m-d') != Carbon::now($timezone)->format('Y-m-d')) {
|
||||||
$date2 = Carbon::now($timezone);
|
return false;
|
||||||
$daysSinceLastSent = $date1->diffInDays($date2);
|
}
|
||||||
$monthsSinceLastSent = $date1->diffInMonths($date2);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
// check we never send twice on one day
|
||||||
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