Update for merge and purge activity events
This commit is contained in:
parent
7dd0963553
commit
a936c09358
|
|
@ -42,20 +42,17 @@ class ClientPurgedActivity implements ShouldQueue
|
|||
{
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$client = $event->client;
|
||||
|
||||
$fields = new stdClass();
|
||||
|
||||
$user_id = array_key_exists('user_id', $event->event_vars)
|
||||
? $event->event_vars['user_id']
|
||||
: $event->client->user_id;
|
||||
: $event->user->id;
|
||||
|
||||
$fields->client_id = $client->id;
|
||||
$fields->user_id = $user_id;
|
||||
$fields->company_id = $client->company_id;
|
||||
$fields->company_id = $event->company->id;
|
||||
$fields->activity_type_id = Activity::PURGE_CLIENT;
|
||||
$fields->notes = $event->purged_client;
|
||||
|
||||
$this->activity_repo->save($fields, $client, $event->event_vars);
|
||||
$this->activity_repo->save($fields, $event->user, $event->event_vars);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class VendorMergedActivity implements ShouldQueue
|
|||
|
||||
$user_id = array_key_exists('user_id', $event->event_vars)
|
||||
? $event->event_vars['user_id']
|
||||
: $event->client->user_id;
|
||||
: $event->vendor->user_id;
|
||||
|
||||
$fields->vendor_id = $vendor->id;
|
||||
$fields->user_id = $user_id;
|
||||
|
|
|
|||
|
|
@ -150,8 +150,8 @@ class ClientRepository extends BaseRepository
|
|||
$purged_client = $client->present()->name();
|
||||
$user = auth()->user() ?? $client->user;
|
||||
$company = $client->company;
|
||||
|
||||
event(new \App\Events\Client\ClientWasPurged($purged_client, $user, $company, \App\Utils\Ninja::eventVars()));
|
||||
|
||||
event(new \App\Events\Client\ClientWasPurged($purged_client, $user, $company, \App\Utils\Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
nlog("Purging client id => {$client->id} => {$client->number}");
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class Merge extends AbstractService
|
|||
$this->client->credit_balance = $this->client->service()->getCreditBalance();
|
||||
$this->client->saveQuietly();
|
||||
|
||||
event(new \App\Events\Client\ClientWasMerged($mergeable_client, $this->client, $this->client->company, \App\Utils\Ninja::eventVars()));
|
||||
event(new \App\Events\Client\ClientWasMerged($mergeable_client, $this->client, $this->client->company, \App\Utils\Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->client;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class Merge extends AbstractService
|
|||
|
||||
$this->mergable_vendor->forceDelete();
|
||||
|
||||
event(new \App\Events\Vendor\VendorWasMerged($_mergeable_vendor, $this->vendor, $this->vendor->company, \App\Utils\Ninja::eventVars()));
|
||||
event(new \App\Events\Vendor\VendorWasMerged($_mergeable_vendor, $this->vendor, $this->vendor->company, \App\Utils\Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->vendor;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue