choosing "new" with an item selected in list2 [message #1126] |
Tue, 09 October 2007 11:05 |
interop
Messages: 45 Registered: October 2006
|
Member |
|
|
I am running into a problem when the user has an entry in a list2 selected and then they choose "new". This selected entry overwrites the parent selection and causes problems in the add2 screen. What's the best way to solve this? I see in x_person_addr::_cm_getInitialData() where it looks like you correct this problem.
radicore 1.29.0
mysql 5
php 5
linux os
|
|
|
Re: choosing "new" with an item selected in list2 [message #1127 is a reply to message #1126] |
Wed, 10 October 2007 04:39 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Here is a better fix - update the childForm() function inside 'include.session.inc' from this:
if (isset($post['select'])) {
// convert selection into SQL where format
$pkey_array = $dbobject->getPkeyArray(null, $task_array);
$selection = selection2where($pkey_array, $post['select']);
} elseif (count($object_array) == 1 AND $pattern_id != 'LIST1') {
to this:
if (isset($post['select'])) {
if ($pattern_id == 'LIST2' AND $task_array['pattern_id'] == 'ADD2') {
// for LIST2->ADD2 any selection must be ignored
$selection = null;
} else {
// convert selection into SQL where format
$pkey_array = $dbobject->getPkeyArray(null, $task_array);
$selection = selection2where($pkey_array, $post['select']);
} // if
} elseif (count($object_array) == 1 AND $pattern_id != 'LIST1') {
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|
Re: choosing "new" with an item selected in list2 [message #1129 is a reply to message #1128] |
Wed, 10 October 2007 10:35 |
AJM
Messages: 2367 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
Upon reflection I have decided to remove that change from the childform() fuction and modify file 'std.add2.inc' so that it reads as follows:
if (!empty($selection) AND !isset($return_from)) {
if (empty($where)) {
// only use $selection if $where is empty
$where = $selection;
} // if
$selection = null;
} // if
This means that regardless of the calling form, $selection will only be used if $where is empty. I think this should cover all eventualities.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|