mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Make state field optional
This commit is contained in:
parent
a4215a6fbe
commit
ca3ff553e5
@ -988,7 +988,7 @@ class ClientPortalController extends BaseController
|
||||
'email' => 'required',
|
||||
'address1' => 'required',
|
||||
'city' => 'required',
|
||||
'state' => 'required',
|
||||
'state' => $account->requiresAddressState() ? 'required' : '',
|
||||
'postal_code' => 'required',
|
||||
'country_id' => 'required',
|
||||
];
|
||||
|
@ -1791,6 +1791,11 @@ class Account extends Eloquent
|
||||
return url('/');
|
||||
}
|
||||
}
|
||||
|
||||
public function requiresAddressState() {
|
||||
return true;
|
||||
//return ! $this->country_id || $this->country_id == DEFAULT_COUNTRY;
|
||||
}
|
||||
}
|
||||
|
||||
Account::creating(function ($account)
|
||||
|
@ -242,10 +242,13 @@ class BasePaymentDriver
|
||||
$rules = array_merge($rules, [
|
||||
'address1' => 'required',
|
||||
'city' => 'required',
|
||||
'state' => 'required',
|
||||
'postal_code' => 'required',
|
||||
'country_id' => 'required',
|
||||
]);
|
||||
|
||||
if ($this->account()->requiresAddressState()) {
|
||||
$rules['state'] = 'required';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
'vat_number' => 'required',
|
||||
'address1' => 'required',
|
||||
'city' => 'required',
|
||||
'state' => 'required',
|
||||
'state' => $account->requiresAddressState() ? 'required' : '',
|
||||
'postal_code' => 'required',
|
||||
'country_id' => 'required',
|
||||
)) !!}
|
||||
|
@ -133,7 +133,7 @@
|
||||
'cvv' => 'required',
|
||||
'address1' => 'required',
|
||||
'city' => 'required',
|
||||
'state' => 'required',
|
||||
'state' => $account->requiresAddressState() ? 'required' : '',
|
||||
'postal_code' => 'required',
|
||||
'country_id' => 'required',
|
||||
'phone' => 'required',
|
||||
@ -146,7 +146,7 @@
|
||||
'account_holder_type' => 'required',
|
||||
'shipping_address1' => 'required',
|
||||
'shipping_city' => 'required',
|
||||
'shipping_state' => 'required',
|
||||
'shipping_state' => $account->requiresAddressState() ? 'required' : '',
|
||||
'shipping_postal_code' => 'required',
|
||||
'shipping_country_id' => 'required',
|
||||
)) !!}
|
||||
|
Loading…
Reference in New Issue
Block a user