Fix for deleting last company in account

This commit is contained in:
David Bomba 2020-06-09 18:59:38 +10:00
parent d35b5be0dd
commit 949061a213
5 changed files with 9 additions and 4 deletions

View File

@ -37,7 +37,7 @@ class RefundCancelledAccount implements ShouldQueue
if(Ninja::isSelfHost() || $this->account->isFreeHostedClient()) if(Ninja::isSelfHost() || $this->account->isFreeHostedClient())
return; return;
$plan_details = $account->getPlanDetails(); $plan_details = $this->account->getPlanDetails();
/* Trial user cancelling early.... */ /* Trial user cancelling early.... */
if($plan_details['trial_active']) if($plan_details['trial_active'])

View File

@ -48,6 +48,6 @@ class CreateInvoiceActivity implements ShouldQueue
$fields->company_id = $event->invoice->company_id; $fields->company_id = $event->invoice->company_id;
$fields->activity_type_id = Activity::CREATE_INVOICE; $fields->activity_type_id = Activity::CREATE_INVOICE;
$this->activity_repo->save($fields, $event->invoice); $this->activity_repo->save($fields, $event->invoice, $event->invoice->company->db);
} }
} }

View File

@ -11,6 +11,7 @@
namespace App\Repositories; namespace App\Repositories;
use App\Libraries\MultiDB;
use App\Models\Activity; use App\Models\Activity;
use App\Models\Backup; use App\Models\Backup;
use App\Models\Client; use App\Models\Client;
@ -31,8 +32,11 @@ class ActivityRepository extends BaseRepository
* @param stdClass $fields The fields * @param stdClass $fields The fields
* @param Collection $entity The entity that you wish to have backed up (typically Invoice, Quote etc etc rather than Payment) * @param Collection $entity The entity that you wish to have backed up (typically Invoice, Quote etc etc rather than Payment)
*/ */
public function save($fields, $entity) public function save($fields, $entity, $db = null)
{ {
if($db)
MultiDB::setDB($db);
$activity = new Activity(); $activity = new Activity();
$activity->is_system = app()->runningInConsole(); $activity->is_system = app()->runningInConsole();

View File

@ -46,7 +46,6 @@
"livewire/livewire": "^1.0", "livewire/livewire": "^1.0",
"maennchen/zipstream-php": "^1.2", "maennchen/zipstream-php": "^1.2",
"nwidart/laravel-modules": "^6.0", "nwidart/laravel-modules": "^6.0",
"omnipay/authorizenet": "3.x@dev",
"omnipay/paypal": "^3.0", "omnipay/paypal": "^3.0",
"omnipay/stripe": "^3.0", "omnipay/stripe": "^3.0",
"predis/predis": "^1.1", "predis/predis": "^1.1",

View File

@ -33,3 +33,5 @@ Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('passw
Route::group(['middleware' => ['url_db']], function () { Route::group(['middleware' => ['url_db']], function () {
Route::get('/user/confirm/{confirmation_code}', 'UserController@confirm'); Route::get('/user/confirm/{confirmation_code}', 'UserController@confirm');
}); });
Route::post('payment_webhook/{company_key}/{$gateway_id}');