MINOR Checking for valid field type in DataDifferencer (built-in fields like 'RecordClassName' can't be casted to a field object)

This commit is contained in:
Ingo Schommer 2011-09-15 09:20:01 +02:00
parent f37640b493
commit 67568b08a3

View File

@ -154,6 +154,21 @@ class DataDifferencer extends ViewableData {
if(in_array($field, $this->ignoredFields)) continue;
if(!$this->fromRecord || $this->fromRecord->$field != $this->toRecord->$field) {
// Only show HTML diffs for fields which allow HTML values in the first place
$fieldObj = $this->toRecord->dbObject($field);
if($this->fromRecord) {
$fieldDiff = Diff::compareHTML(
$this->fromRecord->$field,
$this->toRecord->$field,
(!$fieldObj || $fieldObj->stat('escape_type') != 'xml')
);
} else {
if($fieldObj && $fieldObj->stat('escape_type') == 'xml') {
$fieldDiff = "<ins>" . $this->toRecord->$field . "</ins>";
} else {
$fieldDiff = "<ins>" . Convert::raw2xml($this->toRecord->$field) . "</ins>";
}
}
$changedFields->push(new ArrayData(array(
'Name' => $field,
'Title' => $base->fieldLabel($field),