mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-30 21:44:34 -04:00
Improve subscription currencies
This commit is contained in:
parent
372ec488bc
commit
528c96addb
@ -265,6 +265,9 @@ class BillingPortalPurchase extends Component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nlog($this->subscription->group_settings->settings);
|
||||||
|
// nlog($this->subscription->group_settings->settings->currency_id);
|
||||||
|
|
||||||
if(array_key_exists('currency_id', $this->request_data)) {
|
if(array_key_exists('currency_id', $this->request_data)) {
|
||||||
|
|
||||||
$currency = Cache::get('currencies')->filter(function ($item){
|
$currency = Cache::get('currencies')->filter(function ($item){
|
||||||
@ -274,6 +277,16 @@ class BillingPortalPurchase extends Component
|
|||||||
if($currency)
|
if($currency)
|
||||||
$data['settings']->currency_id = $currency->id;
|
$data['settings']->currency_id = $currency->id;
|
||||||
|
|
||||||
|
}
|
||||||
|
elseif($this->subscription->group_settings && property_exists($this->subscription->group_settings->settings, 'currency_id')) {
|
||||||
|
|
||||||
|
$currency = Cache::get('currencies')->filter(function ($item){
|
||||||
|
return $item->id == $this->subscription->group_settings->settings->currency_id;
|
||||||
|
})->first();
|
||||||
|
|
||||||
|
if($currency)
|
||||||
|
$data['settings']->currency_id = $currency->id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists('locale', $this->request_data)) {
|
if (array_key_exists('locale', $this->request_data)) {
|
||||||
|
@ -83,6 +83,11 @@ class Subscription extends BaseModel
|
|||||||
return $this->belongsTo(User::class)->withTrashed();
|
return $this->belongsTo(User::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function group_settings()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(GroupSetting::class, 'group_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
public function nextDateByInterval($date, $frequency_id)
|
public function nextDateByInterval($date, $frequency_id)
|
||||||
{
|
{
|
||||||
switch ($frequency_id) {
|
switch ($frequency_id) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user