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 { ...@@ -1014,25 +1014,30 @@ class QuickFormQuery {
throw new UserFormException("MultiMode selected, but MultiSQL missing", ERROR_MULTI_SQL_MISSING); throw new UserFormException("MultiMode selected, but MultiSQL missing", ERROR_MULTI_SQL_MISSING);
} }
if ($formMode !== FORM_DELETE) { if ($formMode === FORM_DELETE) {
$sipArray = $this->store->getStore(STORE_SIP); return $sipFound;
// 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]; $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]); $requiredParameterArr = explode('#', $requiredParameter, 2);
foreach ($param AS $name) {
$name = trim($name[0]); $param = explode(',', $requiredParameterArr[0]);
foreach ($param AS $name) {
if ($name === '') { $name = trim($name);
continue;
}
if (!isset($sipArray[$name])) { if ($name === '') {
throw new UserFormException("Missing required SIP parameter: $name", ERROR_MISSING_REQUIRED_PARAMETER); continue;
} }
if (!isset($sipArray[$name])) {
throw new UserFormException("Missing required SIP parameter: $name", ERROR_MISSING_REQUIRED_PARAMETER);
} }
} }
......
Supports Markdown
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