mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Forward requests to V5 and disable V4
This commit is contained in:
parent
a99aa30669
commit
7dc4ecd209
@ -70,7 +70,9 @@ class SendRecurringInvoices extends Command
|
||||
->get();
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
$account->checkCounterReset();
|
||||
|
||||
if(!$account->is_disabled)
|
||||
$account->checkCounterReset();
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,6 +96,11 @@ class SendRecurringInvoices extends Command
|
||||
$this->info(date('r') . ' Processing Invoice: '. $recurInvoice->id);
|
||||
|
||||
$account = $recurInvoice->account;
|
||||
|
||||
if($account->is_disabled){
|
||||
continue;
|
||||
}
|
||||
|
||||
$account->loadLocalizationSettings($recurInvoice->client);
|
||||
Auth::loginUsingId($recurInvoice->activeUser()->id);
|
||||
|
||||
@ -127,7 +134,7 @@ class SendRecurringInvoices extends Command
|
||||
foreach ($expenses as $expense) {
|
||||
$shouldSendToday = $expense->shouldSendToday();
|
||||
|
||||
if (! $shouldSendToday) {
|
||||
if (! $shouldSendToday || $expense->account->is_disabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ class SendReminders extends Command
|
||||
|
||||
/** @var Invoice $invoice */
|
||||
foreach ($delayedAutoBillInvoices as $invoice) {
|
||||
if ($invoice->isPaid()) {
|
||||
if ($invoice->isPaid() || $invoice->account->is_deleted) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ class SendReminders extends Command
|
||||
$this->info(date('r ') . $accounts->count() . ' accounts found with fees enabled');
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
|
||||
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS) || $account->is_disabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ class SendReminders extends Command
|
||||
$this->info(date('r ') . count($accounts) . ' accounts found with reminders enabled');
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS)) {
|
||||
if (! $account->hasFeature(FEATURE_EMAIL_TEMPLATES_REMINDERS) || $account->is_disabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ class SendReminders extends Command
|
||||
$account = $scheduledReport->account;
|
||||
$account->loadLocalizationSettings();
|
||||
|
||||
if (! $account->hasFeature(FEATURE_REPORTS)) {
|
||||
if (! $account->hasFeature(FEATURE_REPORTS) || $account->is_disabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,17 @@ class ClientPortalController extends BaseController
|
||||
$client = $invoice->client;
|
||||
$account = $invoice->account;
|
||||
|
||||
/* Forward requests from V4 to V5 if the domain is set */
|
||||
if(strlen($account->forward_url_for_v5) >1){
|
||||
|
||||
if ($invoice->isType(INVOICE_TYPE_QUOTE))
|
||||
$entity = 'quote';
|
||||
else
|
||||
$entity = 'invoice';
|
||||
|
||||
return redirect($account->forward_url_for_v5."/client/".$entity."/".$invitationKey);
|
||||
}
|
||||
|
||||
if (request()->silent) {
|
||||
session(['silent:' . $client->id => true]);
|
||||
return redirect(request()->url() . (request()->borderless ? '?borderless=true' : ''));
|
||||
|
@ -102,6 +102,14 @@ class StepsController extends BaseController
|
||||
}
|
||||
|
||||
$account = \Auth::user()->account;
|
||||
|
||||
if(strlen($request->input('url')) == 0) {
|
||||
$account->is_disabled = false;
|
||||
}
|
||||
else {
|
||||
$account->is_disabled = true;
|
||||
}
|
||||
|
||||
$account->forward_url_for_v5 = rtrim($request->input('url'),'/');
|
||||
$account->save();
|
||||
|
||||
@ -201,22 +209,28 @@ class StepsController extends BaseController
|
||||
);
|
||||
}
|
||||
|
||||
$completeService = (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN')));
|
||||
|
||||
try {
|
||||
$migrationData = $this->generateMigrationData($request->all());
|
||||
|
||||
$completeService = (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN')))
|
||||
->data($migrationData)
|
||||
|
||||
$completeService->data($migrationData)
|
||||
->endpoint(session('MIGRATION_ENDPOINT'))
|
||||
->start();
|
||||
}
|
||||
finally {
|
||||
catch(\Exception $e){
|
||||
info($e->getMessage());
|
||||
return view('migration.completed', ['customMessage' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
|
||||
if ($completeService->isSuccessful()) {
|
||||
return view('migration.completed');
|
||||
}
|
||||
|
||||
return view('migration.completed', ['customMessage' => $completeService->getErrors()[0]]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function completed()
|
||||
|
@ -171,7 +171,7 @@ info("get company");
|
||||
'all_pages_footer' => $this->account->all_pages_footer ? (bool) $this->account->all_pages_footer : true,
|
||||
'all_pages_header' => $this->account->all_pages_header ? (bool) $this->account->all_pages_header : true,
|
||||
'show_currency_code' => $this->account->show_currency_code ? (bool) $this->account->show_currency_code : false,
|
||||
'enable_client_portal_password' => $this->account->enable_portal_password ? (bool) $this->account->enable_portal_password : true,
|
||||
'enable_client_portal_password' => $this->account->enable_portal_password ? (bool) $this->account->enable_portal_password : false,
|
||||
'send_portal_password' => $this->account->send_portal_password ? (bool) $this->account->send_portal_password : false,
|
||||
'recurring_number_prefix' => $this->account->recurring_invoice_number_prefix ? $this->account->recurring_invoice_number_prefix : 'R',
|
||||
'enable_client_portal' => $this->account->enable_client_portal ? (bool) $this->account->enable_client_portal : false,
|
||||
|
@ -15,6 +15,7 @@ class AddForwardUrlForV5 extends Migration
|
||||
{
|
||||
Schema::table('accounts', function ($table) {
|
||||
$table->text('forward_url_for_v5')->default('');
|
||||
$table->boolean('is_disabled')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,8 @@
|
||||
<label for="modules" class="control-label col-lg-4 col-sm-4"></label>
|
||||
<div class="col-lg-8 col-sm-8">
|
||||
<div class="help-block">
|
||||
Once you are ready to forward your customers, enter your client portal URL for V5 here:<br/>
|
||||
Once you are ready to forward your customers, enter your client portal URL for V5 here:<br/><br/>
|
||||
<b>Please note once enabled. Your V4 account will become disabled. This means that your recurring invoices and any reminders will no longer fire from V4.</b> <br/><br/>To renable your V4 installation simply set the forwarding url to a blank/empty value.
|
||||
</div><br/>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user