mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
FIX: update methode now saves has_ fields
This commit is contained in:
parent
63f51b4f8b
commit
861d4128dc
@ -334,17 +334,19 @@ class GridFieldBulkImageUpload_Request extends RequestHandler {
|
||||
* @return string
|
||||
*/
|
||||
public function update(SS_HTTPRequest $request)
|
||||
{
|
||||
$data = $this->getParsedPostData($request->requestVars());
|
||||
|
||||
$recordClass = $this->gridField->list->dataClass;
|
||||
$record = DataObject::get_by_id($recordClass, $data['ID']);
|
||||
{
|
||||
$data = $this->getParsedPostData($request->requestVars());
|
||||
$record = DataObject::get_by_id($this->gridField->list->dataClass, $data['ID']);
|
||||
|
||||
foreach($data as $field => $value)
|
||||
{
|
||||
$record->setField($field, $value);
|
||||
}
|
||||
|
||||
{
|
||||
if ( $record->hasMethod($field) ) {
|
||||
$list = $record->$field();
|
||||
$list->setByIDList( $value );
|
||||
}else{
|
||||
$record->setCastedField($field, $value);
|
||||
}
|
||||
}
|
||||
$record->write();
|
||||
|
||||
return '{done:1,recordID:'.$data['ID'].'}';
|
||||
|
Loading…
Reference in New Issue
Block a user