mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merged [47007]: Fix to prevent GenericDataAdmin setting a status on a new record and thus overwritting a data field named 'Status'. Includes a fix for onclick on Ajax buttons if event is not passed.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@60167 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
4b5ab8a997
commit
438b6b5f85
@ -475,10 +475,10 @@ HTML;
|
||||
|
||||
if(substr($id, 0, 3) != 'new') {
|
||||
$generic = DataObject::get_one($className, "`$className`.ID = $id");
|
||||
$generic->Status = "Saved (Update)";
|
||||
$generic->__Status = "Saved (Update)";
|
||||
} else {
|
||||
$generic = new $className();
|
||||
$generic->Status = "Saved (New)";
|
||||
$generic->__Status = "Saved (New)";
|
||||
}
|
||||
|
||||
$form->saveInto($generic, true);
|
||||
@ -497,7 +497,7 @@ HTML;
|
||||
}
|
||||
$this->getActionUpdateJS($generic);
|
||||
FormResponse::status_message(_t('GenericDataAdmin.SAVED', 'Saved'), 'good');
|
||||
FormResponse::update_status($generic->Status);
|
||||
FormResponse::update_status($generic->__Status);
|
||||
|
||||
if (method_exists($this, "saveAfterCall")) {
|
||||
$this->saveAfterCall($generic, $urlParams, $form);
|
||||
@ -536,6 +536,9 @@ HTML;
|
||||
$obj = new $baseClass();
|
||||
$form->saveInto($obj);
|
||||
$obj->write();
|
||||
|
||||
// This appears to be a typo. There is no 'urlParms'.
|
||||
// $this->urlParms['ID'] = $obj->ID;
|
||||
|
||||
$editForm = $this->getEditForm($obj->ID);
|
||||
|
||||
|
@ -274,6 +274,7 @@ function prepareAjaxActions(actions, formName, tabName) {
|
||||
button.ownerForm = $(formName);
|
||||
|
||||
button.onclick = function(e) {
|
||||
if(!e) e = window.event;
|
||||
// tries to call a custom method of the format "action_<youraction>_right"
|
||||
if(window[this.name + '_' + tabName]) {
|
||||
window[this.name + '_' + tabName](e);
|
||||
|
Loading…
Reference in New Issue
Block a user