mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Send email to confim cancel/purge
This commit is contained in:
parent
229761bf37
commit
eecbb6e558
@ -1365,7 +1365,12 @@ class AccountController extends BaseController
|
||||
|
||||
$user = Auth::user();
|
||||
$account = Auth::user()->account;
|
||||
|
||||
\Log::info("Canceled Account: {$account->name} - {$user->email}");
|
||||
$type = $account->hasMultipleAccounts() ? 'company' : 'account';
|
||||
$subject = trans("texts.deleted_{$type}");
|
||||
$message = trans("texts.deleted_{$type}_details", ['account' => $account->getDisplayName()]);
|
||||
$this->userMailer->sendMessage($user, $subject, $message);
|
||||
|
||||
$refunded = false;
|
||||
if (! $account->hasMultipleAccounts()) {
|
||||
|
@ -8,6 +8,7 @@ use App\Models\LookupAccount;
|
||||
use Auth;
|
||||
use DB;
|
||||
use Exception;
|
||||
use App\Ninja\Mailers\UserMailer;
|
||||
|
||||
class PurgeAccountData extends Job
|
||||
{
|
||||
@ -16,7 +17,7 @@ class PurgeAccountData extends Job
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(UserMailer $userMailer)
|
||||
{
|
||||
$user = Auth::user();
|
||||
$account = $user->account;
|
||||
@ -73,5 +74,9 @@ class PurgeAccountData extends Job
|
||||
|
||||
config(['database.default' => $current]);
|
||||
}
|
||||
|
||||
$subject = trans('texts.purge_successful');
|
||||
$message = trans('texts.purge_details', ['account' => $user->account->getDisplayName()]);
|
||||
$userMailer->sendMessage($user, $subject, $message);
|
||||
}
|
||||
}
|
||||
|
@ -131,8 +131,8 @@ class UserMailer extends Mailer
|
||||
$data = $data ?: [];
|
||||
$data += [
|
||||
'userName' => $user->getDisplayName(),
|
||||
'primaryMessage' => $subject,
|
||||
'secondaryMessage' => $message,
|
||||
'primaryMessage' => $message,
|
||||
//'secondaryMessage' => $message,
|
||||
'invoiceLink' => $invoice ? $invoice->present()->multiAccountLink : false,
|
||||
];
|
||||
|
||||
|
@ -2193,9 +2193,9 @@ $LANG = array(
|
||||
'error_incorrect_gateway_ids' => 'Error: The gateways table has incorrect ids.',
|
||||
'purge_data' => 'Purge Data',
|
||||
'delete_data' => 'Delete Data',
|
||||
'purge_data_help' => 'Permanently delete all data in the account, keeping the account and settings.',
|
||||
'purge_data_help' => 'Permanently delete all data but keep the account and settings.',
|
||||
'cancel_account_help' => 'Permanently delete the account along with all data and setting.',
|
||||
'purge_successful' => 'Successfully purged account data',
|
||||
'purge_successful' => 'Successfully purged company data',
|
||||
'forbidden' => 'Forbidden',
|
||||
'purge_data_message' => 'Warning: This will permanently erase your data, there is no undo.',
|
||||
'contact_phone' => 'Contact Phone',
|
||||
@ -2431,6 +2431,14 @@ $LANG = array(
|
||||
'created_customer' => 'Successfully created customer',
|
||||
'created_customers' => 'Successfully created :count customers',
|
||||
|
||||
'purge_details' => 'The data in your company (:account) has been successfully purged.',
|
||||
'deleted_company' => 'Successfully canceled account',
|
||||
'deleted_account' => 'Successfully deleted company',
|
||||
'deleted_company_details' => 'Your company (:account) has been successfully deleted.',
|
||||
'deleted_account_details' => 'Your account (:account) has been successfully deleted.',
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
||||
return $LANG;
|
||||
|
@ -266,7 +266,7 @@
|
||||
</div>
|
||||
<div class="modal-footer" style="margin-top: 2px">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.go_back') }}</button>
|
||||
<button type="button" class="btn btn-danger" onclick="confirmPurge()">{{ trans('texts.purge_data') }}</button>
|
||||
<button type="button" class="btn btn-danger" id="purgeButton" onclick="confirmPurge()">{{ trans('texts.purge_data') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -301,7 +301,7 @@
|
||||
</div>
|
||||
<div class="modal-footer" style="margin-top: 2px">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.go_back') }}</button>
|
||||
<button type="button" class="btn btn-danger" onclick="confirmCancel()">{{ $account->hasMultipleAccounts() ? trans('texts.delete_company') : trans('texts.cancel_account') }}</button>
|
||||
<button type="button" class="btn btn-danger" id="deleteButton" onclick="confirmCancel()">{{ $account->hasMultipleAccounts() ? trans('texts.delete_company') : trans('texts.cancel_account') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -338,10 +338,12 @@
|
||||
}
|
||||
|
||||
function confirmCancel() {
|
||||
$('#deleteButton').prop('disabled', true);
|
||||
$('form.cancel-account').submit();
|
||||
}
|
||||
|
||||
function confirmPurge() {
|
||||
$('#purgeButton').prop('disabled', true);
|
||||
$('form.purge-data').submit();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user