mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
Merged in PR #56 from pitchandtone, which had actually partly been merged via a separate but very similar PR
This commit is contained in:
commit
4855ac5ec0
@ -201,12 +201,15 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
* Handles requests to reorder a set of IDs in a specific order.
|
||||
*/
|
||||
public function handleReorder($grid, $request) {
|
||||
if(!singleton($grid->getModelClass())->canEdit()) {
|
||||
$list = $grid->getList();
|
||||
$modelClass = $grid->getModelClass();
|
||||
if ($list instanceof ManyManyList && !singleton($modelClass)->canView()) {
|
||||
$this->httpError(403);
|
||||
} else if(!($list instanceof ManyManyList) && !singleton($modelClass)->canEdit()) {
|
||||
$this->httpError(403);
|
||||
}
|
||||
|
||||
$ids = $request->postVar('order');
|
||||
$list = $grid->getList();
|
||||
$field = $this->getSortField();
|
||||
|
||||
if(!is_array($ids)) {
|
||||
@ -353,7 +356,7 @@ class GridFieldOrderableRows extends RequestHandler implements
|
||||
$extra = $list->getExtraFields();
|
||||
$key = $list->getLocalKey();
|
||||
$foreignKey = $list->getForeignKey();
|
||||
$foreignID = $list->getForeignID();
|
||||
$foreignID = (int) $list->getForeignID();
|
||||
|
||||
if($extra && array_key_exists($this->getSortField(), $extra)) {
|
||||
return sprintf(
|
||||
|
Loading…
Reference in New Issue
Block a user