mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Enforce registration for subscriptions if configured
This commit is contained in:
parent
2b4c3b799d
commit
971787161c
@ -93,6 +93,10 @@ class ClientRegistrationFields
|
|||||||
'key' => 'vat_number',
|
'key' => 'vat_number',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'key' => 'currency_id',
|
||||||
|
'required' => false,
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
@ -58,7 +58,7 @@ class ContactRegisterController extends Controller
|
|||||||
|
|
||||||
Auth::guard('contact')->loginUsingId($client_contact->id, true);
|
Auth::guard('contact')->loginUsingId($client_contact->id, true);
|
||||||
|
|
||||||
return redirect()->route('client.dashboard');
|
return redirect()->intended('client.dashboard');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getClient(array $data)
|
private function getClient(array $data)
|
||||||
@ -66,7 +66,15 @@ class ContactRegisterController extends Controller
|
|||||||
$client = ClientFactory::create($data['company']->id, $data['company']->owner()->id);
|
$client = ClientFactory::create($data['company']->id, $data['company']->owner()->id);
|
||||||
|
|
||||||
$client->fill($data);
|
$client->fill($data);
|
||||||
|
|
||||||
$client->save();
|
$client->save();
|
||||||
|
|
||||||
|
if(isset($data['currency_id'])) {
|
||||||
|
$settings = $client->settings;
|
||||||
|
$settings->currency_id = isset($data['currency_id']) ? $data['currency_id'] : $data['company']->settings->currency_id;
|
||||||
|
$client->settings = $settings;
|
||||||
|
}
|
||||||
|
|
||||||
$client->number = $this->getNextClientNumber($client);
|
$client->number = $this->getNextClientNumber($client);
|
||||||
$client->save();
|
$client->save();
|
||||||
|
|
||||||
|
@ -53,6 +53,16 @@ class SubscriptionPurchaseController extends Controller
|
|||||||
$this->setLocale($request->query('locale'));
|
$this->setLocale($request->query('locale'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!auth()->guard('contact')->check() && $subscription->registration_required && $subscription->company->client_can_register) {
|
||||||
|
|
||||||
|
session()->put('url.intended', route('client.subscription.upgrade',['subscription' => $subscription->hashed_id]));
|
||||||
|
|
||||||
|
return redirect()->route('client.register', ['company_key' => $subscription->company->company_key]);
|
||||||
|
}
|
||||||
|
elseif(!auth()->guard('contact')->check() && $subscription->registration_required && ! $subscription->company->client_can_register) {
|
||||||
|
return render('generic.subscription_blocked', ['account' => $subscription->company->account, 'company' => $subscription->company]);
|
||||||
|
}
|
||||||
|
|
||||||
return view('billing-portal.purchasev2', [
|
return view('billing-portal.purchasev2', [
|
||||||
'subscription' => $subscription,
|
'subscription' => $subscription,
|
||||||
'hash' => Str::uuid()->toString(),
|
'hash' => Str::uuid()->toString(),
|
||||||
|
@ -158,6 +158,13 @@ class BillingPortalPurchasev2 extends Component
|
|||||||
{
|
{
|
||||||
MultiDB::setDb($this->company->db);
|
MultiDB::setDb($this->company->db);
|
||||||
|
|
||||||
|
if(auth()->guard('contact')->check()){
|
||||||
|
$this->email = auth()->guard('contact')->user()->email;
|
||||||
|
$this->contact = auth()->guard('contact')->user();
|
||||||
|
$this->authenticated = true;
|
||||||
|
$this->payment_started = true;
|
||||||
|
}
|
||||||
|
|
||||||
$this->discount = 0;
|
$this->discount = 0;
|
||||||
$this->sub_total = 0;
|
$this->sub_total = 0;
|
||||||
$this->float_amount_total = 0;
|
$this->float_amount_total = 0;
|
||||||
|
@ -29,14 +29,8 @@ class ProductFactory extends Factory
|
|||||||
'cost' => $this->faker->numberBetween(1, 1000),
|
'cost' => $this->faker->numberBetween(1, 1000),
|
||||||
'price' => $this->faker->numberBetween(1, 1000),
|
'price' => $this->faker->numberBetween(1, 1000),
|
||||||
'quantity' => $this->faker->numberBetween(1, 100),
|
'quantity' => $this->faker->numberBetween(1, 100),
|
||||||
// 'tax_name1' => 'GST',
|
'custom_value1' => 'https://picsum.photos/200',
|
||||||
// 'tax_rate1' => 10,
|
'custom_value2' => rand(0,100),
|
||||||
// 'tax_name2' => 'VAT',
|
|
||||||
// 'tax_rate2' => 17.5,
|
|
||||||
// 'tax_name3' => 'THIRDTAX',
|
|
||||||
// 'tax_rate3' => 5,
|
|
||||||
'custom_value1' => $this->faker->text(20),
|
|
||||||
'custom_value2' => $this->faker->text(20),
|
|
||||||
'custom_value3' => $this->faker->text(20),
|
'custom_value3' => $this->faker->text(20),
|
||||||
'custom_value4' => $this->faker->text(20),
|
'custom_value4' => $this->faker->text(20),
|
||||||
'is_deleted' => false,
|
'is_deleted' => false,
|
||||||
|
@ -4910,6 +4910,8 @@ $LANG = array(
|
|||||||
'notification_purchase_order_created_subject' => 'Purchase Order :purchase_order was created for :vendor',
|
'notification_purchase_order_created_subject' => 'Purchase Order :purchase_order was created for :vendor',
|
||||||
'notification_purchase_order_sent_subject' => 'Purchase Order :purchase_order was sent to :vendor',
|
'notification_purchase_order_sent_subject' => 'Purchase Order :purchase_order was sent to :vendor',
|
||||||
'notification_purchase_order_sent' => 'The following vendor :vendor was emailed Purchase Order :purchase_order for :amount.',
|
'notification_purchase_order_sent' => 'The following vendor :vendor was emailed Purchase Order :purchase_order for :amount.',
|
||||||
|
'subscription_blocked' => 'This product is a restricted item, please contact the vendor for further information.',
|
||||||
|
'subscription_blocked_title' => 'Product not available.',
|
||||||
);
|
);
|
||||||
|
|
||||||
return $LANG;
|
return $LANG;
|
||||||
|
@ -5,9 +5,17 @@
|
|||||||
|
|
||||||
<div class="grid lg:grid-cols-12 py-8">
|
<div class="grid lg:grid-cols-12 py-8">
|
||||||
<div class="col-span-12 lg:col-span-8 lg:col-start-3 xl:col-span-6 xl:col-start-4 px-6">
|
<div class="col-span-12 lg:col-span-8 lg:col-start-3 xl:col-span-6 xl:col-start-4 px-6">
|
||||||
|
@if($register_company->account && !$register_company->account->isPaid())
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<img class="h-32 w-auto" src="{{ $register_company->present()->logo() }}" alt="{{ ctrans('texts.logo') }}">
|
<img src="{{ asset('images/invoiceninja-black-logo-2.png') }}"
|
||||||
|
class="border-b border-gray-100 h-18 pb-4" alt="Invoice Ninja logo">
|
||||||
</div>
|
</div>
|
||||||
|
@elseif(isset($register_company) && !is_null($register_company))
|
||||||
|
<div class="flex justify-center">
|
||||||
|
<img src="{{ $register_company->present()->logo() }}"
|
||||||
|
class="mx-auto border-b border-gray-100 h-18 pb-4" alt="{{ $register_company->present()->name() }} logo">
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
<h1 class="text-center text-3xl mt-8">{{ ctrans('texts.register') }}</h1>
|
<h1 class="text-center text-3xl mt-8">{{ ctrans('texts.register') }}</h1>
|
||||||
<p class="block text-center text-gray-600">{{ ctrans('texts.register_label') }}</p>
|
<p class="block text-center text-gray-600">{{ ctrans('texts.register_label') }}</p>
|
||||||
|
|
||||||
@ -54,6 +62,18 @@
|
|||||||
type="password"
|
type="password"
|
||||||
name="{{ $field['key'] }}"
|
name="{{ $field['key'] }}"
|
||||||
/>
|
/>
|
||||||
|
@elseif($field['key'] === 'currency_id')
|
||||||
|
<select
|
||||||
|
id="currency_id"
|
||||||
|
class="input w-full form-select bg-white"
|
||||||
|
name="currency_id">
|
||||||
|
@foreach(App\Utils\TranslationHelper::getCurrencies() as $currency)
|
||||||
|
<option
|
||||||
|
{{ $currency->id == $register_company->settings->currency_id ? 'selected' : null }} value="{{ $currency->id }}">
|
||||||
|
{{ $currency->name }}
|
||||||
|
</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
@elseif($field['key'] === 'country_id')
|
@elseif($field['key'] === 'country_id')
|
||||||
<select
|
<select
|
||||||
id="shipping_country"
|
id="shipping_country"
|
||||||
|
@ -196,6 +196,13 @@
|
|||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
|
@if(auth()->guard('contact')->check())
|
||||||
|
<li class="flex py-6">
|
||||||
|
<div class="flex w-full text-left mt-8">
|
||||||
|
<a href="{{route('client.dashboard')}}" class="button-link text-primary">{{ ctrans('texts.go_back') }}</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
@endif
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user