mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
BUGFIX Marking fields as readonly in CMSMain->compareversions() before loading data, to avoid loading invalid values (HTML diffs) into the fields (AIR-39)
This commit is contained in:
parent
093eb6cd53
commit
f7d322a004
@ -409,14 +409,23 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
if($record) {
|
if($record) {
|
||||||
$form = $this->getEditForm($id, null, null, true);
|
$form = $this->getEditForm($id, null, null, true);
|
||||||
$form->setActions(new FieldSet());
|
$form->setActions(new FieldSet());
|
||||||
$form->loadDataFrom($record);
|
$form->addExtraClass('compare');
|
||||||
|
|
||||||
|
// Comparison views shouldn't be editable.
|
||||||
|
// Its important to convert fields *before* loading data,
|
||||||
|
// as the comparison output is HTML and not valid values for the various field types
|
||||||
|
$readonlyFields = $form->Fields()->makeReadonly();
|
||||||
|
$form->setFields($readonlyFields);
|
||||||
|
|
||||||
|
$form->loadDataFrom($record);
|
||||||
$form->loadDataFrom(array(
|
$form->loadDataFrom(array(
|
||||||
"ID" => $id,
|
"ID" => $id,
|
||||||
"Version" => $fromVersion,
|
"Version" => $fromVersion,
|
||||||
));
|
));
|
||||||
|
|
||||||
$form->addExtraClass('compare');
|
foreach($form->Fields()->dataFields() as $field) {
|
||||||
|
$field->dontEscape = true;
|
||||||
|
}
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user