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);
|
standard_error('youcantallocatemorethanyouhave', '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($email == '') {
|
if (! validateEmail($email)) {
|
||||||
standard_error(array(
|
|
||||||
'stringisempty',
|
|
||||||
'emailadd'
|
|
||||||
), '', true);
|
|
||||||
} elseif (! validateEmail($email)) {
|
|
||||||
standard_error('emailiswrong', $email, true);
|
standard_error('emailiswrong', $email, true);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -687,7 +682,8 @@ class Customers extends ApiCommand implements ResourceEntity
|
|||||||
$email = $this->getParam('email', true, $idna_convert->decode($result['email']));
|
$email = $this->getParam('email', true, $idna_convert->decode($result['email']));
|
||||||
$name = $this->getParam('name', true, $result['name']);
|
$name = $this->getParam('name', true, $result['name']);
|
||||||
$firstname = $this->getParam('firstname', true, $result['firstname']);
|
$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']);
|
$street = $this->getParam('street', true, $result['street']);
|
||||||
$zipcode = $this->getParam('zipcode', true, $result['zipcode']);
|
$zipcode = $this->getParam('zipcode', true, $result['zipcode']);
|
||||||
$city = $this->getParam('city', true, $result['city']);
|
$city = $this->getParam('city', true, $result['city']);
|
||||||
@@ -767,18 +763,7 @@ class Customers extends ApiCommand implements ResourceEntity
|
|||||||
standard_error('youcantallocatemorethanyouhave', '', true);
|
standard_error('youcantallocatemorethanyouhave', '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Either $name and $firstname or the $company must be inserted
|
if ($email == '') {
|
||||||
if ($name == '' && $company == '') {
|
|
||||||
standard_error(array(
|
|
||||||
'stringisempty',
|
|
||||||
'myname'
|
|
||||||
), '', true);
|
|
||||||
} elseif ($firstname == '' && $company == '') {
|
|
||||||
standard_error(array(
|
|
||||||
'stringisempty',
|
|
||||||
'myfirstname'
|
|
||||||
), '', true);
|
|
||||||
} elseif ($email == '') {
|
|
||||||
standard_error(array(
|
standard_error(array(
|
||||||
'stringisempty',
|
'stringisempty',
|
||||||
'emailadd'
|
'emailadd'
|
||||||
|
|||||||
Reference in New Issue
Block a user