Permalink
Browse files

Improved how the last edit table is found using ClassInfo::baseDataCl…

…ass()
  • Loading branch information...
1 parent 60c8939 commit f75ebaea34d0a951320264fbfb2f56ee06aea92b @UndefinedOffset committed May 25, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 code/forms/GridFieldSortableRows.php
@@ -183,6 +183,8 @@ protected function fixSortColumn($gridField, SS_List $dataList) {
user_error('Sort column '.$this->sortColumn.' could not be found in '.$gridField->getModelClass().'\'s ancestry', E_USER_ERROR);
exit;
}
+
+ $baseDataClass=ClassInfo::baseDataClass($gridField->getModelClass());
}
@@ -202,7 +204,7 @@ protected function fixSortColumn($gridField, SS_List $dataList) {
. '" SET "' . $sortColumn . '" = ' . ($max + $i)
. ' WHERE "ID" = '. $obj->ID);
- DB::query('UPDATE "' . ClassInfo::baseDataClass($gridField->getModelClass())
+ DB::query('UPDATE "' . $baseDataClass
. '" SET "LastEdited" = \'' . date('Y-m-d H:i:s') . '\''
. ' WHERE "ID" = '. $obj->ID);
}
@@ -312,6 +314,8 @@ protected function saveGridRowSort(GridField $gridField, $data) {
user_error('Sort column '.$this->sortColumn.' could not be found in '.$gridField->getModelClass().'\'s ancestry', E_USER_ERROR);
exit;
}
+
+ $baseDataClass=ClassInfo::baseDataClass($gridField->getModelClass());
}
@@ -333,7 +337,7 @@ protected function saveGridRowSort(GridField $gridField, $data) {
. '" SET "' . $sortColumn . '" = ' . (($sort + 1) + $pageOffset)
. ' WHERE "ID" = '. $id);
- DB::query('UPDATE "' . ClassInfo::baseDataClass($gridField->getModelClass())
+ DB::query('UPDATE "' . $baseDataClass
. '" SET "LastEdited" = \'' . date('Y-m-d H:i:s') . '\''
. ' WHERE "ID" = '. $id);
}

0 comments on commit f75ebae

Please sign in to comment.