FIX calling $record->write() breaks other 3rd party fields that write to an UnsavedRelationList.

This commit is contained in:
Jake Bentvelzen 2016-07-06 09:42:06 +10:00
parent a449045b09
commit 9afd602007

View File

@ -182,12 +182,6 @@ class ListboxField extends DropdownField {
if($fieldname && $record && $relation &&
($relation instanceof RelationList || $relation instanceof UnsavedRelationList)) {
$idList = (is_array($this->value)) ? array_values($this->value) : array();
if(!$record->ID) {
$record->write(); // record needs to have an ID in order to set relationships
$relation = ($fieldname && $record && $record->hasMethod($fieldname))
? $record->$fieldname()
: null;
}
$relation->setByIDList($idList);
} elseif($fieldname && $record) {
if($this->value) {