mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUGFIX Fixed PHP notice potential error in MemberTableField->addtogroup()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@68935 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
63f5421296
commit
e0611be469
@ -54,7 +54,7 @@ class MemberTableField extends ComplexTableField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function __construct($controller, $name, $group, $members = null, $hidePassword = true, $pageLimit = 10) {
|
function __construct($controller, $name, $group, $members = null, $hidePassword = true, $pageLimit = 10) {
|
||||||
|
|
||||||
if($group) {
|
if($group) {
|
||||||
if(is_object($group)) {
|
if(is_object($group)) {
|
||||||
$this->group = $group;
|
$this->group = $group;
|
||||||
@ -191,9 +191,10 @@ class MemberTableField extends ComplexTableField {
|
|||||||
function addtogroup() {
|
function addtogroup() {
|
||||||
$data = $_REQUEST;
|
$data = $_REQUEST;
|
||||||
unset($data['ID']);
|
unset($data['ID']);
|
||||||
|
$ctfID = isset($data['ctf']) ? $data['ctf']['ID'] : null;
|
||||||
|
|
||||||
if(!is_numeric($data['ctf']['ID'])) {
|
if(!is_numeric($ctfID)) {
|
||||||
FormResponse::status_messsage(_t('MemberTableField.ADDINGFIELD', 'Adding failed'), 'bad');
|
FormResponse::status_messsage(_t('MemberTableField.ADDINGFIELD', 'Adding failed'), 'bad');
|
||||||
}
|
}
|
||||||
|
|
||||||
$className = Object::getCustomClass($this->stat('data_class'));
|
$className = Object::getCustomClass($this->stat('data_class'));
|
||||||
@ -202,13 +203,10 @@ class MemberTableField extends ComplexTableField {
|
|||||||
$record->update($data);
|
$record->update($data);
|
||||||
|
|
||||||
$valid = $record->validate();
|
$valid = $record->validate();
|
||||||
|
|
||||||
if($valid->valid()) {
|
if($valid->valid()) {
|
||||||
$record->write();
|
$record->write();
|
||||||
|
$record->Groups()->add($ctfID);
|
||||||
// To Avoid duplication in the Group_Members table if the ComponentSet.php is not modified just uncomment le line below
|
|
||||||
|
|
||||||
//if( ! $record->inGroup( $data['ctf']['ID'] ) )
|
|
||||||
$record->Groups()->add( $data['ctf']['ID'] );
|
|
||||||
|
|
||||||
$this->sourceItems();
|
$this->sourceItems();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user