1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Merge pull request #9776 from turbo124/v5-develop

Minor fixes
This commit is contained in:
David Bomba 2024-07-16 12:01:44 +10:00 committed by GitHub
commit e952c225ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 19 deletions

View File

@ -65,7 +65,7 @@ class UpdateCompanyRequest extends Request
$rules['smtp_local_domain'] = 'sometimes|string|nullable';
// $rules['smtp_verify_peer'] = 'sometimes|string';
// $rules['e_invoice'] = ['sometimes','nullable', new ValidCompanyScheme()];
$rules['e_invoice'] = ['sometimes','nullable', new ValidCompanyScheme()];
if (isset($input['portal_mode']) && ($input['portal_mode'] == 'domain' || $input['portal_mode'] == 'iframe')) {
$rules['portal_domain'] = 'bail|nullable|sometimes|url';

View File

@ -34,18 +34,20 @@ class ValidClientScheme implements ValidationRule, ValidatorAwareRule
public function validate(string $attribute, mixed $value, Closure $fail): void
{
$r = new EInvoice();
$errors = $r->validateRequest($value['Invoice'], ClientLevel::class);
if(isset($value['Invoice']))
{
$r = new EInvoice();
$errors = $r->validateRequest($value['Invoice'], ClientLevel::class);
foreach ($errors as $key => $msg) {
foreach ($errors as $key => $msg) {
$this->validator->errors()->add(
"e_invoice.{$key}",
"{$key} - {$msg}"
);
$this->validator->errors()->add(
"e_invoice.{$key}",
"{$key} - {$msg}"
);
}
}
}
/**

View File

@ -35,18 +35,21 @@ class ValidCompanyScheme implements ValidationRule, ValidatorAwareRule
public function validate(string $attribute, mixed $value, Closure $fail): void
{
$r = new EInvoice();
$errors = $r->validateRequest($value['Invoice'], CompanyLevel::class);
foreach ($errors as $key => $msg) {
if(isset($value['Invoice']))
{
$r = new EInvoice();
$errors = $r->validateRequest($value['Invoice'], CompanyLevel::class);
foreach ($errors as $key => $msg) {
$this->validator->errors()->add(
"e_invoice.{$key}",
"{$key} - {$msg}"
);
$this->validator->errors()->add(
"e_invoice.{$key}",
"{$key} - {$msg}"
);
}
}
}
/**

View File

@ -147,7 +147,7 @@ class UpdatePaymentMethods
{
$sources = $customer->sources ?? false;
if (!$customer || is_null($sources) || !property_exists($sources, 'data')) {
if (!$customer || is_null($sources) || !$sources || !property_exists($sources, 'data')) {
return;
}