FIX Don't show the upload field when inappropriate

This fix is quite ugly, but in theory, it's fine. By ugly,
  I mean the interface is kind of weird without it.
Because 3.1 allows uploading when a DataObject doesn't exist,
  we need to override the new defaults to not allow such if
  the DO isn't saved yet.
This commit is contained in:
Stephen Shkardoon 2013-09-10 21:03:42 +12:00
parent 144043c437
commit 8d4b24b68d
1 changed files with 9 additions and 0 deletions

View File

@ -57,6 +57,15 @@ class DMSUploadField extends UploadField {
return true;
}
public function isDisabled() {
return (parent::isDisabled() || !$this->isSaveable());
}
public function isSaveable() {
return (!empty($this->getRecord()->ID));
}
/**
* Action to handle upload of a single file
*