Commit 4a66da51 authored by Carsten  Rose's avatar Carsten Rose
Browse files

F6121 Append record id at form title.

parent 0b7f4061
This diff is collapsed.
......@@ -120,6 +120,9 @@ formDataMatchError = match error
# cat=form-config/config; type=string; label=Form data error message:Default is 'error'. Customizable error message used in validator.js. generic violation.
formDataError = error
# cat=form-config/config; type=string; label=Record-ID in form title:Default is '0' (off). If '1', append the current record id on the title.
showIdInFormTitle = 0
......
......@@ -88,6 +88,7 @@ abstract class AbstractBuildForm {
* @param array $db
* @throws CodeException
* @throws UserFormException
* @throws UserReportException
*/
public function __construct(array $formSpec, array $feSpecAction, array $feSpecNative, array $db = null) {
$this->formSpec = $formSpec;
......@@ -1793,6 +1794,7 @@ abstract class AbstractBuildForm {
* @param array $json
* @return string
* @throws CodeException
* @throws UserFormException
*/
public function buildCheckboxMulti(array $formElement, $htmlFormElementName, $attributeBase, $value, array $itemKey, array $itemValue, array &$json) {
......
......@@ -515,6 +515,7 @@ const SYSTEM_FORM_LANGUAGE_D_ID = 'formLanguageDId';
const SYSTEM_FORM_LANGUAGE_D_LABEL = 'formLanguageDLabel';
const SYSTEM_ENTER_AS_SUBMIT = 'enterAsSubmit';
const SYSTEM_SHOW_ID_IN_FORM_TITLE = 'showIdInFormTitle';
const SYSTEM_CMD_WKHTMLTOPDF = 'cmdWkhtmltopdf';
......@@ -864,6 +865,8 @@ const F_ORDER_INTERVAL = 'orderInterval';
const F_ORDER_COLUMN = 'orderColumn';
const F_ORDER_COLUMN_NAME = 'ord';
const F_SHOW_ID_IN_FORM_TITLE = SYSTEM_SHOW_ID_IN_FORM_TITLE;
// FORM_ELEMENT_STATI
const FE_MODE_SHOW = 'show';
const FE_MODE_READONLY = 'readonly';
......
......@@ -751,7 +751,7 @@ class QuickFormQuery {
$formSpec = HelperFormElement::setLanguage($formSpec, $parameterLanguageFieldName);
$formSpec = $this->syncSystemFormConfig($formSpec);
$formSpec = $this->initForm($formSpec);
$formSpec = $this->initForm($formSpec, $recordId);
$formSpec = array_merge($formSpec, $parseLater);
......@@ -980,7 +980,7 @@ class QuickFormQuery {
/**
* The named $keys will be synced between STORE_SYSTEM and $formSpec (both directions).
* The per form definition has precedence over STORE_SYSTEM.
* STORE_SYSTEM if filled with the default values (config.qfq.ini or if note exist than QFQ hardcoded)
* STORE_SYSTEM if filled with the default values (config.qfq.php or if note exist than QFQ hardcoded)
* Copying the 'Form' definition back to the system store helps to access the values
* by '{{ ...:Y}}' (system store). E.g. the value of bs-*-columns might be displayed as placeholder in the
* corresponding input field.
......@@ -1029,6 +1029,7 @@ class QuickFormQuery {
F_RECORD_LOCK_TIMEOUT_SECONDS,
FE_INPUT_EXTRA_BUTTON_INFO_CLASS,
F_SHOW_ID_IN_FORM_TITLE,
];
// By definition: existing vars which are empty, means: EMPTY - do not use any default!
......@@ -1056,12 +1057,13 @@ class QuickFormQuery {
* Set form parameter which are expected to exist.
*
* @param array $formSpec
* @param int $recordId
*
* @return array
* @throws CodeException
* @throws UserFormException
*/
private function initForm(array $formSpec) {
private function initForm(array $formSpec, $recordId) {
Support::setIfNotSet($formSpec, F_EXTRA_DELETE_FORM, '');
Support::setIfNotSet($formSpec, F_SUBMIT_BUTTON_TEXT, '');
......@@ -1088,6 +1090,11 @@ class QuickFormQuery {
$formSpec[F_ESCAPE_TYPE_DEFAULT] = $this->store->getVar(F_ESCAPE_TYPE_DEFAULT, STORE_SYSTEM);
}
// Append recordId to title
if($formSpec[F_SHOW_ID_IN_FORM_TITLE]=='1'){
$formSpec[F_TITLE] .= ($recordId==0) ? " (new)" : " ($recordId)";
}
return $formSpec;
}
......
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