BUGFIX: newly added documents now always appear at the top of the list

This commit is contained in:
Julian Seidenberg 2012-09-21 16:10:16 +12:00
parent 745741344c
commit 9fe54f18bc
2 changed files with 2 additions and 3 deletions

View File

@ -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");
}
/**

View File

@ -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;