mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
Use Datetime::now() for last edited updates in OrderableRows
This commit is contained in:
parent
09f6cdf299
commit
9d4ac960a7
@ -470,12 +470,13 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
$sortTable = $this->getSortTable($list);
|
$sortTable = $this->getSortTable($list);
|
||||||
$additionalSQL = '';
|
$additionalSQL = '';
|
||||||
$baseTable = $sortTable;
|
$baseTable = $sortTable;
|
||||||
|
$now = SS_Datetime::now()->Rfc2822();
|
||||||
if(class_exists($sortTable)) {
|
if(class_exists($sortTable)) {
|
||||||
$baseTable = singleton($sortTable)->baseTable();
|
$baseTable = singleton($sortTable)->baseTable();
|
||||||
}
|
}
|
||||||
$isBaseTable = ($baseTable == $sortTable);
|
$isBaseTable = ($baseTable == $sortTable);
|
||||||
if(!$list instanceof ManyManyList && $isBaseTable){
|
if(!$list instanceof ManyManyList && $isBaseTable){
|
||||||
$additionalSQL = ', "LastEdited" = NOW()';
|
$additionalSQL = ", \"LastEdited\" = '$now'";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($sortedIDs as $sortValue => $id) {
|
foreach($sortedIDs as $sortValue => $id) {
|
||||||
@ -491,7 +492,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
|
|
||||||
if(!$isBaseTable) {
|
if(!$isBaseTable) {
|
||||||
DB::query(sprintf(
|
DB::query(sprintf(
|
||||||
'UPDATE "%s" SET "LastEdited" = NOW() WHERE %s',
|
"UPDATE \"%s\" SET \"LastEdited\" = '$now' WHERE %s",
|
||||||
$baseTable,
|
$baseTable,
|
||||||
$this->getSortTableClauseForIds($list, $id)
|
$this->getSortTableClauseForIds($list, $id)
|
||||||
));
|
));
|
||||||
@ -520,6 +521,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
$field = $this->getSortField();
|
$field = $this->getSortField();
|
||||||
$table = $this->getSortTable($list);
|
$table = $this->getSortTable($list);
|
||||||
$clause = sprintf('"%s"."%s" = 0', $table, $this->getSortField());
|
$clause = sprintf('"%s"."%s" = 0', $table, $this->getSortField());
|
||||||
|
$now = SS_Datetime::now()->Rfc2822();
|
||||||
|
|
||||||
$additionalSQL = '';
|
$additionalSQL = '';
|
||||||
$baseTable = $table;
|
$baseTable = $table;
|
||||||
@ -528,7 +530,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
}
|
}
|
||||||
$isBaseTable = ($baseTable == $table);
|
$isBaseTable = ($baseTable == $table);
|
||||||
if(!$list instanceof ManyManyList && $isBaseTable){
|
if(!$list instanceof ManyManyList && $isBaseTable){
|
||||||
$additionalSQL = ', "LastEdited" = NOW()';
|
$additionalSQL = ", \"LastEdited\" = '$now'";
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($list->where($clause)->column('ID') as $id) {
|
foreach($list->where($clause)->column('ID') as $id) {
|
||||||
@ -546,7 +548,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
|||||||
|
|
||||||
if(!$isBaseTable) {
|
if(!$isBaseTable) {
|
||||||
DB::query(sprintf(
|
DB::query(sprintf(
|
||||||
'UPDATE "%s" SET "LastEdited" = NOW() WHERE %s',
|
"UPDATE \"%s\" SET \"LastEdited\" = '$now' WHERE %s",
|
||||||
$baseTable,
|
$baseTable,
|
||||||
$this->getSortTableClauseForIds($list, $id)
|
$this->getSortTableClauseForIds($list, $id)
|
||||||
));
|
));
|
||||||
|
Loading…
Reference in New Issue
Block a user