diff --git a/lib/Froxlor/Api/Commands/Customers.php b/lib/Froxlor/Api/Commands/Customers.php index f9cd52a8a..e6cb2c0f4 100644 --- a/lib/Froxlor/Api/Commands/Customers.php +++ b/lib/Froxlor/Api/Commands/Customers.php @@ -1053,7 +1053,7 @@ public function update() $email = $this->getParam('email', true, $idna_convert->decode($result['email'])); $name = $this->getParam('name', true, $result['name']); $firstname = $this->getParam('firstname', true, $result['firstname']); - $company_required = empty($result['company']) && ((!empty($name) && empty($firstname)) || (empty($name) && !empty($firstname)) || (empty($name) && empty($firstname))); + $company_required = (!empty($name) && empty($firstname)) || (empty($name) && !empty($firstname)) || (empty($name) && empty($firstname)); $company = $this->getParam('company', !$company_required, $result['company']); $street = $this->getParam('street', true, $result['street']); $zipcode = $this->getParam('zipcode', true, $result['zipcode']); diff --git a/templates/Froxlor/assets/js/jquery/validation.js b/templates/Froxlor/assets/js/jquery/validation.js index f4692e055..b3ccc6a9f 100644 --- a/templates/Froxlor/assets/js/jquery/validation.js +++ b/templates/Froxlor/assets/js/jquery/validation.js @@ -8,18 +8,18 @@ export default function () { rules: { 'name': { required: function () { - return $('#company').val().length === 0 || $('#firstname').val().length > 0; + return $('#company').val().trim().length === 0 || $('#firstname').val().trim().length > 0; } }, 'firstname': { required: function () { - return $('#company').val().length === 0 || $('#name').val().length > 0; + return $('#company').val().trim().length === 0 || $('#name').val().trim().length > 0; } }, 'company': { required: function () { - return $('#name').val().length === 0 - && $('#firstname').val().length === 0; + return $('#name').val().trim().length === 0 + && $('#firstname').val().trim().length === 0; } } },