Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » choosing "new" with an item selected in list2
choosing "new" with an item selected in list2 [message #1126] Tue, 09 October 2007 11:05 Go to next message
interop is currently offline  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 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
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') {


Re: choosing "new" with an item selected in list2 [message #1128 is a reply to message #1127] Wed, 10 October 2007 10:21 Go to previous messageGo to next message
interop is currently offline  interop
Messages: 45
Registered: October 2006
Member
thanks.

I found the same problem with list3, multi2, multi3 and added the following:
OR ($pattern_id == 'MULTI3' AND $task_array['pattern_id'] == 'ADD2')
OR ($pattern_id == 'MULTI2' AND $task_array['pattern_id'] == 'ADD2')
OR ($pattern_id == 'LIST3' AND $task_array['pattern_id'] == 'ADD2')

I'm not able to test it with any other patterns
Re: choosing "new" with an item selected in list2 [message #1129 is a reply to message #1128] Wed, 10 October 2007 10:35 Go to previous message
AJM is currently offline  AJM
Messages: 2347
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.


Previous Topic: multi3
Next Topic: selection remaining
Goto Forum:
  


Current Time: Thu Mar 28 19:01:27 EDT 2024

Total time taken to generate the page: 0.00927 seconds