ENHANCEMENT: removing extension from document title when uploading a new document

This commit is contained in:
Julian Seidenberg 2012-09-20 15:28:44 +12:00
parent c708551982
commit 16d1f74b28

View File

@ -445,7 +445,8 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
//write the filename of the stored document //write the filename of the stored document
$this->Filename = $toFilename; $this->Filename = $toFilename;
$this->Folder = $toFolder; $this->Folder = $toFolder;
if (empty($this->Title)) $this->Title = $fromFilename; //don't overwrite existing document titles $extension = pathinfo($this->Filename, PATHINFO_EXTENSION);
if (empty($this->Title)) $this->Title = basename($filePath,'.'.$extension); //don't overwrite existing document titles
$this->LastChanged = SS_Datetime::now()->Rfc2822(); $this->LastChanged = SS_Datetime::now()->Rfc2822();
$this->write(); $this->write();