Fixes for clone quotes

This commit is contained in:
David Bomba 2024-01-05 11:45:51 +11:00
parent a3b0d199f5
commit 6236bf0dee
2 changed files with 5 additions and 4 deletions

View File

@ -28,6 +28,7 @@ class CloneQuoteToInvoiceFactory
unset($quote_array['invoice_id']);
unset($quote_array['id']);
unset($quote_array['invitations']);
unset($quote_array['user']);
//preserve terms if they exist on Quotes
//if(array_key_exists('terms', $quote_array) && strlen($quote_array['terms']) < 2)
@ -38,7 +39,6 @@ class CloneQuoteToInvoiceFactory
// unset($quote_array['public_notes']);
unset($quote_array['footer']);
unset($quote_array['design_id']);
unset($quote_array['user']);
foreach ($quote_array as $key => $value) {
$invoice->{$key} = $value;
@ -59,6 +59,7 @@ class CloneQuoteToInvoiceFactory
$invoice->last_sent_date = null;
$invoice->last_viewed = null;
return $invoice;
}
}

View File

@ -240,12 +240,12 @@ class Invoice extends BaseModel
public function getDueDateAttribute($value)
{
return $this->dateMutator($value);
return $value ? $this->dateMutator($value) : null;
}
public function getPartialDueDateAttribute($value)
{
return $this->dateMutator($value);
return $value ? $this->dateMutator($value) : null;
}
public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo