Commit 4820c4d0 authored by Carsten  Rose's avatar Carsten Rose
Browse files

QuickFormQuery.php: validateForm() code refactored.

parent ebd2bf85
......@@ -1014,25 +1014,30 @@ class QuickFormQuery {
throw new UserFormException("MultiMode selected, but MultiSQL missing", ERROR_MULTI_SQL_MISSING);
}
if ($formMode !== FORM_DELETE) {
$sipArray = $this->store->getStore(STORE_SIP);
// Check: requiredParameter: '' or 'form' or 'form,grId' or 'form #formname for form,grId'
$requiredParameter = ($r > 0) ? $this->formSpec[F_REQUIRED_PARAMETER_EDIT] : $this->formSpec[F_REQUIRED_PARAMETER_NEW];
if ($formMode === FORM_DELETE) {
return $sipFound;
}
$sipArray = $this->store->getStore(STORE_SIP);
// Check: requiredParameter: '' or 'form' or 'form,grId' or 'form #formname for form,grId'
$requiredParameter = ($r > 0) ? $this->formSpec[F_REQUIRED_PARAMETER_EDIT] : $this->formSpec[F_REQUIRED_PARAMETER_NEW];
$requiredParameterArr = explode('#', $requiredParameter, 2);
if (trim($requiredParameter) == '') {
return $sipFound;
}
$param = explode(',', $requiredParameterArr[0]);
foreach ($param AS $name) {
$requiredParameterArr = explode('#', $requiredParameter, 2);
$name = trim($name[0]);
$param = explode(',', $requiredParameterArr[0]);
foreach ($param AS $name) {
if ($name === '') {
continue;
}
$name = trim($name);
if (!isset($sipArray[$name])) {
throw new UserFormException("Missing required SIP parameter: $name", ERROR_MISSING_REQUIRED_PARAMETER);
}
if ($name === '') {
continue;
}
if (!isset($sipArray[$name])) {
throw new UserFormException("Missing required SIP parameter: $name", ERROR_MISSING_REQUIRED_PARAMETER);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment