Skip to content

Commit

Permalink
Merge pull request #202 from Icinga/fix-template-form
Browse files Browse the repository at this point in the history
Don't populate `UploadedFile` on `text/select` elements & vice versa
  • Loading branch information
sukhwinder33445 authored Sep 1, 2023
2 parents 2e09144 + 69f9397 commit 062ba04
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions library/Reporting/Web/Forms/TemplateForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@ protected function addColumnSettings($name, $label)
]
]);

$valueType = $this->getValue($type, 'none');
$populated = $this->getPopulatedValue($value);
if (
($valueType === 'image' && ! $populated instanceof UploadedFile)
|| ($valueType !== 'image' && $populated instanceof UploadedFile)
) {
$this->clearPopulatedValue($value);
}

switch ($this->getValue($type, 'none')) {
case 'image':
$this->addElement('file', $value, [
Expand Down

0 comments on commit 062ba04

Please sign in to comment.