From 745741344cc20837965445d69ad128528d7e760c Mon Sep 17 00:00:00 2001 From: Julian Seidenberg Date: Fri, 21 Sep 2012 15:45:05 +1200 Subject: [PATCH] BUGFIX: newly added documents now appear at the top of the list --- code/cms/DMSUploadField.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/cms/DMSUploadField.php b/code/cms/DMSUploadField.php index 0f6fdaa..0961e9d 100644 --- a/code/cms/DMSUploadField.php +++ b/code/cms/DMSUploadField.php @@ -45,8 +45,11 @@ 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; }