1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Temp fix for partial due dates

This commit is contained in:
David Bomba 2024-01-05 09:51:41 +11:00
parent 8d07c4d2c5
commit 5ccd6949bd
3 changed files with 6 additions and 7 deletions

View File

@ -97,11 +97,7 @@ class BaseModel extends Model
public function dateMutator($value)
{
if (! empty($value)) {
return (new Carbon($value))->format('Y-m-d');
}
return $value;
return (new Carbon($value))->format('Y-m-d');
}
// public function __call($method, $params)

View File

@ -245,6 +245,9 @@ class Invoice extends BaseModel
public function getPartialDueDateAttribute($value)
{
if($value == "0000-00-00 00:00:00")
return null;
return $this->dateMutator($value);
}
@ -396,7 +399,7 @@ class Invoice extends BaseModel
public function getStatusAttribute()
{
$due_date = $this->due_date ? Carbon::parse($this->due_date) : false;
$partial_due_date = $this->partial_due_Date ? Carbon::parse($this->partial_due_date) : false;
$partial_due_date = $this->partial_due_date ? Carbon::parse($this->partial_due_date) : false;
if ($this->status_id == self::STATUS_SENT && $due_date && $due_date->gt(now())) {
return self::STATUS_UNPAID;

View File

@ -132,7 +132,7 @@ class InvoiceTransformer extends EntityTransformer
'is_amount_discount' => (bool) ($invoice->is_amount_discount ?: false),
'footer' => $invoice->footer ?: '',
'partial' => (float) ($invoice->partial ?: 0.0),
'partial_due_date' => $invoice->partial_due_date ?: '',
'partial_due_date' => ($invoice->partial_due_date && $invoice->partial_due_date != "-0001-11-30") ?: '',
'custom_value1' => (string) $invoice->custom_value1 ?: '',
'custom_value2' => (string) $invoice->custom_value2 ?: '',
'custom_value3' => (string) $invoice->custom_value3 ?: '',