mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
Merge branch '3.1' into 3
This commit is contained in:
commit
96af48a2fe
@ -3,6 +3,7 @@
|
||||
namespace Symbiote\GridFieldExtensions;
|
||||
|
||||
use SilverStripe\Core\Convert;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Forms\Form;
|
||||
use SilverStripe\Forms\GridField\GridField;
|
||||
use SilverStripe\Forms\GridField\GridField_HTMLProvider;
|
||||
@ -13,7 +14,6 @@ use SilverStripe\ORM\DataObjectInterface;
|
||||
use SilverStripe\ORM\FieldType\DBField;
|
||||
use SilverStripe\ORM\ManyManyList;
|
||||
use SilverStripe\View\ArrayData;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\View\Requirements;
|
||||
use Exception;
|
||||
|
||||
|
@ -244,7 +244,7 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
|
||||
|
||||
GridFieldExtensions::include_requirements();
|
||||
|
||||
$field = new DropdownField(sprintf('%s[ClassName]', self::POST_KEY), '', $classes, $this->defaultClass);
|
||||
$field = new DropdownField(sprintf('%s[%s]', __CLASS__, $grid->getName()), '', $classes, $this->defaultClass);
|
||||
if (Config::inst()->get(__CLASS__, 'showEmptyString')) {
|
||||
$field->setEmptyString(_t('GridFieldExtensions.SELECTTYPETOCREATE', '(Select type to create)'));
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ use SilverStripe\Forms\ReadonlyField;
|
||||
use SilverStripe\ORM\DataList;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\DataObjectInterface;
|
||||
use SilverStripe\ORM\FieldType\DBField;
|
||||
use SilverStripe\ORM\ManyManyList;
|
||||
|
||||
/**
|
||||
|
@ -21,6 +21,7 @@ use SilverStripe\ORM\DB;
|
||||
use SilverStripe\ORM\ManyManyList;
|
||||
use SilverStripe\ORM\Map;
|
||||
use SilverStripe\ORM\SS_List;
|
||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\View\ViewableData;
|
||||
|
||||
@ -542,6 +543,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
// match to order the objects.
|
||||
if (!$isVersioned) {
|
||||
$sortTable = $this->getSortTable($list);
|
||||
$now = DBDatetime::now()->Rfc2822();
|
||||
$additionalSQL = '';
|
||||
$baseTable = $sortTable;
|
||||
if (class_exists($sortTable)) {
|
||||
@ -549,7 +551,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
}
|
||||
$isBaseTable = ($baseTable == $sortTable);
|
||||
if (!$list instanceof ManyManyList && $isBaseTable) {
|
||||
$additionalSQL = ', "LastEdited" = NOW()';
|
||||
$additionalSQL = ", \"LastEdited\" = '$now'";
|
||||
}
|
||||
|
||||
foreach ($sortedIDs as $sortValue => $id) {
|
||||
@ -565,8 +567,9 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
|
||||
if (!$isBaseTable) {
|
||||
DB::query(sprintf(
|
||||
'UPDATE "%s" SET "LastEdited" = NOW() WHERE %s',
|
||||
'UPDATE "%s" SET "LastEdited" = \'%s\' WHERE %s',
|
||||
$baseTable,
|
||||
$now,
|
||||
$this->getSortTableClauseForIds($list, $id)
|
||||
));
|
||||
}
|
||||
@ -595,7 +598,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
$field = $this->getSortField();
|
||||
$table = $this->getSortTable($list);
|
||||
$clause = sprintf('"%s"."%s" = 0', $table, $this->getSortField());
|
||||
|
||||
$now = DBDatetime::now()->Rfc2822();
|
||||
$additionalSQL = '';
|
||||
$baseTable = $table;
|
||||
if (class_exists($table)) {
|
||||
@ -603,7 +606,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
}
|
||||
$isBaseTable = ($baseTable == $table);
|
||||
if (!$list instanceof ManyManyList && $isBaseTable) {
|
||||
$additionalSQL = ', "LastEdited" = NOW()';
|
||||
$additionalSQL = ", \"LastEdited\" = '$now'";
|
||||
}
|
||||
|
||||
foreach ($list->where($clause)->column('ID') as $id) {
|
||||
@ -621,8 +624,9 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
|
||||
if (!$isBaseTable) {
|
||||
DB::query(sprintf(
|
||||
'UPDATE "%s" SET "LastEdited" = NOW() WHERE %s',
|
||||
'UPDATE "%s" SET "LastEdited" = \'%s\' WHERE %s',
|
||||
$baseTable,
|
||||
$now,
|
||||
$this->getSortTableClauseForIds($list, $id)
|
||||
));
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ class GridFieldConfigurablePaginatorTest extends SapphireTest
|
||||
public function testGetPageSizesAsList()
|
||||
{
|
||||
$paginator = new GridFieldConfigurablePaginator(10, array(10, 20, 30));
|
||||
$this->assertDOSEquals(array(
|
||||
$this->assertListEquals(array(
|
||||
array('Size' => '10', 'Selected' => true),
|
||||
array('Size' => '20', 'Selected' => false),
|
||||
array('Size' => '30', 'Selected' => false),
|
||||
|
Loading…
Reference in New Issue
Block a user