mirror of
https://github.com/silverstripe/silverstripe-dms
synced 2024-10-22 12:05:56 +00:00
BUGFIX: newly added documents now always appear at the top of the list
This commit is contained in:
parent
745741344c
commit
9fe54f18bc
@ -44,6 +44,8 @@ class DMSDocument extends DataObject implements DMSDocumentInterface {
|
||||
*/
|
||||
function addPage($pageObject) {
|
||||
$this->Pages()->add($pageObject);
|
||||
|
||||
DB::query("UPDATE DMSDocument_Pages SET DocumentSort=DocumentSort+1 WHERE SiteTreeID = $pageObject->ID");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,9 +45,6 @@ class DMSUploadField extends UploadField {
|
||||
// Relate to the underlying page being edited.
|
||||
// Not applicable when editing the document itself and replacing it.
|
||||
$doc->addPage($record);
|
||||
|
||||
//increase the sort value by one for the newly uploaded document and every other document attached to this page
|
||||
DB::query("UPDATE DMSDocument_Pages SET DocumentSort=DocumentSort+1 WHERE SiteTreeID = $record->ID");
|
||||
}
|
||||
|
||||
return $doc;
|
||||
|
Loading…
x
Reference in New Issue
Block a user