Fixed issue where DBInt was not being allowed

This commit is contained in:
UndefinedOffset 2018-03-01 10:36:02 -04:00
parent 8200c934a0
commit 093364a150
2 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,8 @@
# Change Log
## [1.0.1](https://github.com/UndefinedOffset/SortableGridField/tree/1.0.1) (2018-03-01)
[Full Changelog](https://github.com/UndefinedOffset/SortableGridField/compare/2.0.2...1.0.1)
## [1.0.0](https://github.com/UndefinedOffset/SortableGridField/tree/1.0.0) (2017-10-27)
[Full Changelog](https://github.com/UndefinedOffset/SortableGridField/compare/0.6.10...1.0.0)
@ -303,7 +306,3 @@
- German Translation [\#9](https://github.com/UndefinedOffset/SortableGridField/pull/9) ([PatrickElsing](https://github.com/PatrickElsing))
- Update lang/en.yml [\#8](https://github.com/UndefinedOffset/SortableGridField/pull/8) ([PatrickElsing](https://github.com/PatrickElsing))
- Renamed the Items array that is sent in post [\#7](https://github.com/UndefinedOffset/SortableGridField/pull/7) ([sheadawson](https://github.com/sheadawson))
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

View File

@ -189,11 +189,11 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP
if (!$many_many) {
$sng=singleton($gridField->getModelClass());
$fieldType=$sng->db($this->sortColumn);
if(!$fieldType || !(strtolower($fieldType) == 'int' || is_subclass_of($fieldType, 'Int'))) {
if(!$fieldType || !(strtolower($fieldType) == 'dbint' || is_subclass_of($fieldType, 'DBInt'))) {
if(is_array($fieldType)) {
user_error('Sort column '.$this->sortColumn.' could not be found in '.$gridField->getModelClass().'\'s ancestry', E_USER_ERROR);
}else {
user_error('Sort column '.$this->sortColumn.' must be an Int, column is of type '.$fieldType, E_USER_ERROR);
user_error('Sort column '.$this->sortColumn.' must be an instance of DBInt, column is of type '.$fieldType, E_USER_ERROR);
}
exit;
@ -212,7 +212,7 @@ class GridFieldSortableRows implements GridField_HTMLProvider, GridField_ActionP
list($parentClass, $componentClass, $parentField, $componentField, $table) = $owner->many_many((!empty($this->custom_relation_name) ? $this->custom_relation_name:$gridField->getName()));
$extraFields=$owner->many_many_extraFields((!empty($this->custom_relation_name) ? $this->custom_relation_name:$gridField->getName()));
if(!$extraFields || !array_key_exists($this->sortColumn, $extraFields) || !($extraFields[$this->sortColumn]=='Int' || is_subclass_of('Int', $extraFields[$this->sortColumn]))) {
if(!$extraFields || !array_key_exists($this->sortColumn, $extraFields) || !(strtolower($extraFields[$this->sortColumn])=='dbint' || is_subclass_of('DBInt', $extraFields[$this->sortColumn]))) {
user_error('Sort column '.$this->sortColumn.' must be an Int, column is of type '.$extraFields[$this->sortColumn], E_USER_ERROR);
exit;
}