calling ADD2 from LIST1 with $where set. [message #1164] |
Tue, 06 November 2007 17:41 |
alrobertson
Messages: 9 Registered: October 2007 Location: Vancouver
|
Junior Member |
|
|
I realize this is not the usual way to use ADD2 so you may just want to tell me to use a different pattern.
What I was trying to do was:
1. Display a list (LIST1) of all the parts that could be built in house ($where specified parts that are built in house).
2. Make a selection and then call ADD2 to create a record of the part I wanted to build.
ADD2 accepts the $selection if it is returning from a popup or if $where is empty but since I am returning from a LIST1 with $where set, ADD2 ignores the $selection in favour of the $where.
In my case the $where did not have any fields that existed in the ADD2 table. I used this fact to get around it by changing std.add2.inc to wait until after $dbobject was set and then added:
if (!empty($selection) AND !isset($return_from)) {
$where2 = filterWhere($where, $dbobject->fieldspec, $dbobject->tablename);
if (empty($where2)) {
// only use $selection if $where is empty
$where = $selection;
} // if
$selection = null;
} // if
|
|
|
|