Browse Source

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

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4099 a333f486-631f-4898-b8df-5754b55c2be0
glajarige 9 years ago
parent
commit
6ad1c25a24

+ 4 - 0
sources/renderer/bootstrap/fieldrenderer/bssimplefieldrenderer.class.inc.php

@@ -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('<input type="hidden" id="' . $this->oField->GetGlobalId() . '" name="' . $this->oField->GetId() . '" value="' . $this->oField->GetCurrentValue() . '" class="form-control" />');
 						$oOutput->AddHtml('</div>');
 						$oOutput->AddHtml('</div>');
 						break;
 						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;
 				}
 				}
 			}
 			}
 		}
 		}

+ 3 - 16
sources/renderer/bootstrap/fieldrenderer/bssubformfieldrenderer.class.inc.php

@@ -29,20 +29,8 @@ class BsSubFormFieldRenderer extends FieldRenderer
 	{
 	{
 		$oOutput = new RenderingOutput();
 		$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
 		// Showing subform if there are visible fields
-		if (!$bHasVisibleFields)
+		if (!$this->oField->GetForm()->HasVisibleFields())
 		{
 		{
 			$oOutput->AddHtml('<div class="hidden">');
 			$oOutput->AddHtml('<div class="hidden">');
 		}
 		}
@@ -56,14 +44,13 @@ class BsSubFormFieldRenderer extends FieldRenderer
 		{
 		{
 			$oOutput->AddHtml('</fieldset>');
 			$oOutput->AddHtml('</fieldset>');
 		}
 		}
-		if (!$bHasVisibleFields)
+		if (!$this->oField->GetForm()->HasVisibleFields())
 		{
 		{
 			$oOutput->AddHtml('</div>');
 			$oOutput->AddHtml('</div>');
 		}
 		}
-
+		
 		$oRenderer = new BsFormRenderer($this->oField->GetForm());
 		$oRenderer = new BsFormRenderer($this->oField->GetForm());
 		$aRenderRes = $oRenderer->Render();
 		$aRenderRes = $oRenderer->Render();
-
 		$aFieldSetOptions = array(
 		$aFieldSetOptions = array(
 			'fields_list' => $aRenderRes,
 			'fields_list' => $aRenderRes,
 			'fields_impacts' => $this->oField->GetForm()->GetFieldsImpacts(),
 			'fields_impacts' => $this->oField->GetForm()->GetFieldsImpacts(),