1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Working on Delete user bug

This commit is contained in:
David Bomba 2020-09-28 12:56:11 +10:00
parent 604827f551
commit 5c0776cf14
4 changed files with 45 additions and 8 deletions

View File

@ -44,9 +44,11 @@ class RecurringInvoicesCron
if (! config('ninja.db.multi_db_enabled')) {
$recurring_invoices = RecurringInvoice::whereDate('next_send_date', '=', now())->cursor();
$recurring_invoices = RecurringInvoice::whereDate('next_send_date', '=', now())
->where('status_id', RecurringInvoice::STATUS_ACTIVE)
->cursor();
Log::info(now()->format('Y-m-d') . ' Sending Recurring Invoices. Count = '.$recurring_invoices->count().' On Database # '.$db);
Log::info(now()->format('Y-m-d') . ' Sending Recurring Invoices. Count = '.$recurring_invoices->count());
$recurring_invoices->each(function ($recurring_invoice, $key) {
@ -62,7 +64,9 @@ class RecurringInvoicesCron
MultiDB::setDB($db);
$recurring_invoices = RecurringInvoice::whereDate('next_send_date', '=', now())->cursor();
$recurring_invoices = RecurringInvoice::whereDate('next_send_date', '=', now())
->where('status_id', RecurringInvoice::STATUS_ACTIVE)
->cursor();
Log::info(now()->format('Y-m-d') . ' Sending Recurring Invoices. Count = '.$recurring_invoices->count().' On Database # '.$db);

View File

@ -53,4 +53,32 @@ class Gateway extends StaticModel
{
return in_array($this->id, [62, 67, 68]); //static table ids of the custom gateways
}
public function getHelp()
{
$link = '';
if ($this->id == 1) {
$link = 'http://reseller.authorize.net/application/?id=5560364';
} elseif ($this->id == 15) {
$link = 'https://www.paypal.com/us/cgi-bin/webscr?cmd=_login-api-run';
} elseif ($this->id == 24) {
$link = 'https://www.2checkout.com/referral?r=2c37ac2298';
} elseif ($this->id == 35) {
$link = 'https://bitpay.com/dashboard/signup';
} elseif ($this->id == 18) {
$link = 'https://applications.sagepay.com/apply/2C02C252-0F8A-1B84-E10D-CF933EFCAA99';
} elseif ($this->id == 20) {
$link = 'https://dashboard.stripe.com/account/apikeys';
}
$key = 'texts.gateway_help_'.$this->id;
$str = trans($key, [
'link' => "<a href='$link' >Click here</a>",
'complete_link' => url('/complete'),
]);
return $key != $str ? $str : '';
}
}

View File

@ -372,8 +372,6 @@ class RecurringInvoice extends BaseModel
/* Return early if nothing to send back! */
if( $this->status_id == self::STATUS_COMPLETED ||
$this->status_id == self::STATUS_DRAFT ||
$this->status_id == self::STATUS_PAUSED ||
$this->remaining_cycles == 0 ||
!$this->next_send_date) {

View File

@ -105,6 +105,9 @@ class UserRepository extends BaseRepository
public function destroy(array $data, User $user)
{
info("destroy user");
if (array_key_exists('company_user', $data)) {
$this->forced_includes = 'company_users';
@ -118,10 +121,10 @@ class UserRepository extends BaseRepository
$cu->forceDelete();
}
$user->delete();
event(new UserWasDeleted($user, $company, Ninja::eventVars()));
$user->delete();
return $user->fresh();
}
@ -130,6 +133,9 @@ class UserRepository extends BaseRepository
*/
public function delete($user)
{
info("delete user");
$company = auth()->user()->company();
$cu = CompanyUser::whereUserId($user->id)
@ -141,11 +147,12 @@ class UserRepository extends BaseRepository
$cu->delete();
}
event(new UserWasDeleted($user, $company, Ninja::eventVars()));
$user->is_deleted = true;
$user->save();
$user->delete();
event(new UserWasDeleted($user, $company, Ninja::eventVars()));
return $user->fresh();
}