remove unnecessary checks as getParam() validates the existance already
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -209,12 +209,7 @@ class Customers extends ApiCommand implements ResourceEntity
|
||||
standard_error('youcantallocatemorethanyouhave', '', true);
|
||||
}
|
||||
|
||||
if ($email == '') {
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'emailadd'
|
||||
), '', true);
|
||||
} elseif (! validateEmail($email)) {
|
||||
if (! validateEmail($email)) {
|
||||
standard_error('emailiswrong', $email, true);
|
||||
} else {
|
||||
|
||||
@@ -687,7 +682,8 @@ class Customers extends ApiCommand implements ResourceEntity
|
||||
$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 = $this->getParam('company', true, $result['company']);
|
||||
$company_required = (! empty($name) && empty($firstname)) || (empty($name) && ! empty($firstname)) || (empty($name) && empty($firstname));
|
||||
$company = $this->getParam('company', ($company_required ? false : true), $result['company']);
|
||||
$street = $this->getParam('street', true, $result['street']);
|
||||
$zipcode = $this->getParam('zipcode', true, $result['zipcode']);
|
||||
$city = $this->getParam('city', true, $result['city']);
|
||||
@@ -767,18 +763,7 @@ class Customers extends ApiCommand implements ResourceEntity
|
||||
standard_error('youcantallocatemorethanyouhave', '', true);
|
||||
}
|
||||
|
||||
// Either $name and $firstname or the $company must be inserted
|
||||
if ($name == '' && $company == '') {
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'myname'
|
||||
), '', true);
|
||||
} elseif ($firstname == '' && $company == '') {
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'myfirstname'
|
||||
), '', true);
|
||||
} elseif ($email == '') {
|
||||
if ($email == '') {
|
||||
standard_error(array(
|
||||
'stringisempty',
|
||||
'emailadd'
|
||||
|
||||
Reference in New Issue
Block a user