mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 11:20:57 -04:00
changes according to: https://github.com/invoiceninja/invoiceninja/pull/9042#discussion_r1432330656
This commit is contained in:
parent
77a615adb6
commit
ad009b5837
@ -56,7 +56,7 @@ class StoreCompanyRequest extends Request
|
||||
}
|
||||
}
|
||||
|
||||
$rules['expense_mailbox'] = new ValidExpenseMailbox($this->company->key, $this->company->account->isPaid() && $this->company->account->plan == 'enterprise'); // @turbo124 check if this is right
|
||||
$rules['expense_mailbox'] = new ValidExpenseMailbox($this->company->key);
|
||||
|
||||
return $rules;
|
||||
}
|
||||
@ -77,6 +77,10 @@ class StoreCompanyRequest extends Request
|
||||
$input['portal_domain'] = rtrim(strtolower($input['portal_domain']), "/");
|
||||
}
|
||||
|
||||
if (isset($input['expense_mailbox']) && Ninja::isHosted() && !($this->company->account->isPaid() && $this->company->account->plan == 'enterprise')) {
|
||||
unset($input['expense_mailbox']);
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ use Illuminate\Contracts\Validation\Rule;
|
||||
class ValidExpenseMailbox implements Rule
|
||||
{
|
||||
|
||||
private $is_enterprise_error = false;
|
||||
private $validated_schema = false;
|
||||
private $company_key = false;
|
||||
private $isEnterprise = false;
|
||||
@ -32,7 +31,6 @@ class ValidExpenseMailbox implements Rule
|
||||
public function __construct(string $company_key, bool $isEnterprise = false)
|
||||
{
|
||||
$this->company_key = $company_key;
|
||||
$this->isEnterprise = $isEnterprise;
|
||||
$this->endings = explode(",", config('ninja.ingest_mail.expense_mailbox_endings'));
|
||||
}
|
||||
|
||||
@ -42,12 +40,6 @@ class ValidExpenseMailbox implements Rule
|
||||
return true;
|
||||
}
|
||||
|
||||
// denie on hosted and not enterprise
|
||||
if (Ninja::isHosted() && !$this->isEnterprise) {
|
||||
$this->is_enterprise_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// early return, if we dont have any additional validation
|
||||
if (!config('ninja.ingest_mail.expense_mailbox_endings')) {
|
||||
$this->validated_schema = true;
|
||||
@ -75,9 +67,6 @@ class ValidExpenseMailbox implements Rule
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
if ($this->is_enterprise_error)
|
||||
return ctrans('texts.expense_mailbox_not_available');
|
||||
|
||||
if (!$this->validated_schema)
|
||||
return ctrans('texts.expense_mailbox_invalid');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user