mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 03:04:35 -04:00
Adjust client factories to allow contacts to be created by default
This commit is contained in:
parent
872ce3a3bc
commit
46bb38a20c
@ -33,8 +33,8 @@ class ClientFactory
|
|||||||
$client->client_hash = Str::random(40);
|
$client->client_hash = Str::random(40);
|
||||||
$client->settings = ClientSettings::defaults();
|
$client->settings = ClientSettings::defaults();
|
||||||
|
|
||||||
$client_contact = ClientContactFactory::create($company_id, $user_id);
|
// $client_contact = ClientContactFactory::create($company_id, $user_id);
|
||||||
$client->contacts->add($client_contact);
|
// $client->contacts->add($client_contact);
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ class ClientContactRepository extends BaseRepository
|
|||||||
} else {
|
} else {
|
||||||
$contacts = collect();
|
$contacts = collect();
|
||||||
}
|
}
|
||||||
|
info(print_r($client->contacts->toArray(),1));
|
||||||
|
|
||||||
$client->contacts->pluck('id')->diff($contacts->pluck('id'))->each(function ($contact) {
|
$client->contacts->pluck('id')->diff($contacts->pluck('id'))->each(function ($contact) {
|
||||||
ClientContact::destroy($contact);
|
ClientContact::destroy($contact);
|
||||||
|
@ -78,7 +78,7 @@ class ClientRepository extends BaseRepository
|
|||||||
$data['name'] = $client->present()->name();
|
$data['name'] = $client->present()->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
info("{$client->present()->name} has a balance of {$client->balance} with a paid to date of {$client->paid_to_date}");
|
//info("{$client->present()->name} has a balance of {$client->balance} with a paid to date of {$client->paid_to_date}");
|
||||||
|
|
||||||
if (array_key_exists('documents', $data)) {
|
if (array_key_exists('documents', $data)) {
|
||||||
$this->saveDocuments($data['documents'], $client);
|
$this->saveDocuments($data['documents'], $client);
|
||||||
|
@ -126,8 +126,8 @@ class FactoryCreationTest extends TestCase
|
|||||||
$cliz->save();
|
$cliz->save();
|
||||||
|
|
||||||
$this->assertNotNull($cliz->contacts);
|
$this->assertNotNull($cliz->contacts);
|
||||||
$this->assertEquals(1, $cliz->contacts->count());
|
$this->assertEquals(0, $cliz->contacts->count());
|
||||||
$this->assertInternalType("int", $cliz->contacts->first()->id);
|
$this->assertInternalType("int", $cliz->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user