Fix newfilename calculation

This commit is contained in:
Deon George
2020-01-05 09:37:50 +11:00
parent 1ffc2d994e
commit 9c0a02c425
4 changed files with 26 additions and 10 deletions

View File

@@ -15,6 +15,10 @@ abstract class Catalog extends Model
protected static $includeSubSecTime = FALSE;
protected $dates = ['created'];
protected $casts = [
'subsectime' => 'int',
];
/**
* People in Multimedia Object
*
@@ -220,10 +224,10 @@ abstract class Catalog extends Model
// If the date created is not set, the file name will be based on the ID of the file.
$file = sprintf('%s.%s',(is_null($this->created)
? sprintf('UNKNOWN/%07s',$this->file_path_id())
: $this->created->format('Y/m/d-His').((! is_null($this->subsectime)) ? sprintf('.%03d',$this->subsectime) : '' ).
((! static::$includeSubSecTime OR ! is_null($this->subsectime)) ? '' : sprintf('-%05s',$this->id)).
($this->ignore_duplicate ? sprintf('-%06d',$this->id) : '')
),$this->type()
: $this->created->format('Y/m/d-His').
((! is_null($this->subsectime)) ? sprintf('_%03d',$this->subsectime) : '' ).
sprintf('-%05s',$this->id))
,$this->type()
);
return (($short OR preg_match('/^\//',$file)) ? '' : config($this->type.'.dir').DIRECTORY_SEPARATOR).$file;