Customer portal : Fixed regression in request template that was introduced by #4095

SVN:trunk[4099]
This commit is contained in:
Guillaume Lajarige
2016-05-17 15:43:23 +00:00
parent 1aacf1adae
commit d9a5b85c67
2 changed files with 7 additions and 16 deletions

View File

@@ -294,6 +294,10 @@ EOF
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="' . $this->oField->GetCurrentValue() . '" class="form-control" />');
$oOutput->AddHtml('</div>');
break;
case 'Combodo\\iTop\\Form\\Field\\HiddenField':
$oOutput->AddHtml('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="')->AddHtml($this->oField->GetCurrentValue(), true)->AddHtml('"/>');
break;
}
}
}

View File

@@ -29,20 +29,8 @@ class BsSubFormFieldRenderer extends FieldRenderer
{
$oOutput = new RenderingOutput();
// Checking if subform has visible fields
$bHasVisibleFields = false;
foreach ($this->oField->GetForm()->GetFields() as $oSubFormField)
{
$sSubFormFieldClass = get_class($oSubFormField);
// Note : This is a dirty hack for templates. As they show a label when there is no template, we have to detect it...
if (($sSubFormFieldClass !== 'Combodo\iTop\Form\Field\HiddenField') && ($oSubFormField->GetId() !== '_no_template_'))
{
$bHasVisibleFields = true;
}
}
// Showing subform if there are visible fields
if (!$bHasVisibleFields)
if (!$this->oField->GetForm()->HasVisibleFields())
{
$oOutput->AddHtml('<div class="hidden">');
}
@@ -56,14 +44,13 @@ class BsSubFormFieldRenderer extends FieldRenderer
{
$oOutput->AddHtml('</fieldset>');
}
if (!$bHasVisibleFields)
if (!$this->oField->GetForm()->HasVisibleFields())
{
$oOutput->AddHtml('</div>');
}
$oRenderer = new BsFormRenderer($this->oField->GetForm());
$aRenderRes = $oRenderer->Render();
$aFieldSetOptions = array(
'fields_list' => $aRenderRes,
'fields_impacts' => $this->oField->GetForm()->GetFieldsImpacts(),