In Radicore v1.94, setup a Delete 1 task that involves _cm_getForeignData() to obtain data from other related objects and display to the user before deletion.
Upon pressing the submit button in such Delete 1 task, if the deletion turns out unsuccessful due to validation conditions, error messages from the object's $this->errors will be displayed with the submit button removed. That is all working and fine, but you will notice that the data displayed now is quite different from what was shown on the screen just before the submit button was pressed. It appears that all the pieces of information that were gathered by _cm_getForeignData have now disappeared from the screen.
Upon closer look we see in std.delete1.inc that the getExtraData call (which eventually invokes _cm_getForeignData) is conditional on $errors being empty:
...
$scrolling[$dbobject->getClassName()]['where'] = $where;
// if ($_SERVER['REQUEST_METHOD'] == 'GET') {
if (empty($errors)) {
// get any extra data and merge with $fieldarray
$fieldarray = $dbobject->getExtraData($fieldarray);
if ($dbobject->errors) {
$errors = $dbobject->getErrors();
} // if
} // if
if (empty($errors)) {
...
Hence, resulting in incomplete data being displayed upon deletion error. So, I would like to suggest to get rid of the condition and change this code to:
...
$scrolling[$dbobject->getClassName()]['where'] = $where;
// if ($_SERVER['REQUEST_METHOD'] == 'GET') {
// get any extra data and merge with $fieldarray
$fieldarray = $dbobject->getExtraData($fieldarray);
if ($dbobject->errors) {
$errors = $dbobject->getErrors();
} // if
if (empty($errors)) {
...
[Updated on: Tue, 07 June 2016 21:10]
Report message to a moderator