Commit f6172fca authored by Carsten  Rose's avatar Carsten Rose
Browse files

#3546 / lean: Internal Server Error

Throw of a UserFormException with wrong parameter. Fixed.
parent 9c795bb7
......@@ -148,34 +148,41 @@ class BuildFormBootstrap extends AbstractBuildForm {
*/
private function buildViewForm() {
$form = false;
$url = '';
$status = '';
switch ($this->formSpec[F_NAME]) {
case 'form':
$form = $this->store->getVar(F_NAME, STORE_RECORD);
break;
case 'formElement':
$row = $this->db->sql("SELECT f.name FROM Form AS f WHERE id=" . $this->store->getVar(FE_FORM_ID, STORE_RECORD), ROW_EXPECT_1);
$form = current($row);
if (false !== ($formId = $this->store->getVar(FE_FORM_ID, STORE_SIP . STORE_RECORD))) {
$row = $this->db->sql("SELECT f.name FROM Form AS f WHERE id=" . $formId, ROW_EXPECT_1);
$form = current($row);
}
break;
default:
return '';
}
if ($form === false) {
return '';
$toolTip = "Form not 'form' or 'formElement'";
$status = 'disabled';
} else {
$queryStringArray = [
'id' => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM),
'form' => $form,
'r' => 0
];
$queryString = Support::arrayToQueryString($queryStringArray);
$sip = $this->store->getSipInstance();
$url = $sip->queryStringToSip($queryString);
$toolTip = "View current form with r=0" . PHP_EOL . PHP_EOL . OnArray::toString($queryStringArray, ' = ', PHP_EOL, "'");
}
$queryStringArray = [
'id' => $this->store->getVar(SYSTEM_EDIT_FORM_PAGE, STORE_SYSTEM),
'form' => $form,
'r' => 0
];
$queryString = Support::arrayToQueryString($queryStringArray);
$sip = $this->store->getSipInstance();
$url = $sip->queryStringToSip($queryString);
$toolTip = "View current form with r=0" . PHP_EOL . PHP_EOL . OnArray::toString($queryStringArray, ' = ', PHP_EOL, "'");
return $this->buildButtonAnchor('form-view-' . $this->formSpec[F_ID], $url, $toolTip, GLYPH_ICON_VIEW, '');
return $this->buildButtonAnchor('form-view-' . $this->formSpec[F_ID], $url, $toolTip, GLYPH_ICON_VIEW, $status);
}
......
......@@ -14,6 +14,7 @@ require_once(__DIR__ . '/../store/Store.php');
require_once(__DIR__ . '/../Evaluate.php');
require_once(__DIR__ . '/../report/Sendmail.php');
require_once(__DIR__ . '/../helper/HelperFormElement.php');
require_once(__DIR__ . '/../exceptions/UserFormException.php');
/**
* Class formAction
......@@ -100,7 +101,7 @@ class FormAction {
}
} else {
// At the moment 'action' elements have to point to a templateGroup - nothing else is defined. Break if there is something else
throw new UserFormException("Expect a 'templateGroup' record in FormElement.id=", $fe[FE_ID_CONTAINER], ERROR_RECORD_NOT_FOUND);
throw new UserFormException("Expect a 'templateGroup' record in FormElement.id=" . $fe[FE_ID_CONTAINER], ERROR_RECORD_NOT_FOUND);
}
continue; // skip to next FormElement
}
......
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