mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Return blank Backup object if none exists
This commit is contained in:
parent
34a90d2ba8
commit
43822fbfdd
@ -80,10 +80,10 @@ class ClientContactRepository extends BaseRepository
|
||||
});
|
||||
|
||||
//need to reload here to shake off stale contacts
|
||||
$client->load('contacts');
|
||||
$client->fresh();
|
||||
|
||||
//always made sure we have one blank contact to maintain state
|
||||
if ($client->contacts->count() == 0) {
|
||||
if ($client->contacts()->count() == 0) {
|
||||
$new_contact = ClientContactFactory::create($client->company_id, $client->user_id);
|
||||
$new_contact->client_id = $client->id;
|
||||
$new_contact->contact_key = Str::random(40);
|
||||
|
@ -29,8 +29,19 @@ class InvoiceHistoryTransformer extends EntityTransformer
|
||||
|
||||
public function transform(?Backup $backup)
|
||||
{
|
||||
if(!$backup)
|
||||
return null;
|
||||
if(!$backup){
|
||||
|
||||
return [
|
||||
'id' => '',
|
||||
'activity_id' => '',
|
||||
'json_backup' => (string) '',
|
||||
'html_backup' => (string) '',
|
||||
'amount' => (float) 0,
|
||||
'created_at' => (int) 0,
|
||||
'updated_at' => (int) 0,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $this->encodePrimaryKey($backup->id),
|
||||
|
Loading…
x
Reference in New Issue
Block a user