1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

Set recurring due date using account payment terms

This commit is contained in:
Hillel Coren 2017-02-01 13:20:14 +02:00
parent e6588ac3b2
commit 1737af10c4

View File

@ -1030,14 +1030,20 @@ class Invoice extends EntityModel implements BalanceAffecting
if($dueDate) {
return date('Y-m-d', $dueDate);// SQL format
}
}
else if ($this->client->payment_terms != 0) {
} elseif ($this->client->payment_terms != 0) {
// No custom due date set for this invoice; use the client's payment terms
$days = $this->client->payment_terms;
if ($days == -1) {
$days = 0;
}
return date('Y-m-d', strtotime('+'.$days.' day', $now));
} elseif ($this->account->payment_terms != 0) {
// No custom due date set for this invoice; use the client's payment terms
$days = $this->account->payment_terms;
if ($days == -1) {
$days = 0;
}
return date('Y-m-d', strtotime('+'.$days.' day', $now));
}
}