This topic is locked

Multiline lookups

12/4/2006 9:00:09 PM
PHPRunner General questions
D
doingbiz author

I have a table 'users' with

user name John Smith with login johnsmith

user name Bill Jones with login billjones

and a table 'scenario' where more than one users are assigned using a multiline lookup table.

Users are stored in a single field in the scenario table using the login.
If one user is assigned, shows on view page as name (Bill Jones or John Smith).

If 2 users are assigned, shows on view page as billjones,johnsmith (as stored in scenario table).
Security is set so a user can only see their records.
If Bill Jones logs in he only sees the record where 1 user was assigned, and not the record where 2 were assigned.
What am I missing here?

J
Jane 12/5/2006

Hi,
it's impossible to assign more then one users for one record (using multiline lookups) in the PHPRunner.
You can add this feature editing generated include/commonfunctions.php file manually.

Find following line in the SecuritySQL function:

$ret=GetFullFieldName(GetTableOwnerID())."=".make_db_value(GetTableOwnerID(),$ownerid);



and replace it with this one:

$ret=GetFullFieldName(GetTableOwnerID())." like '%".prepare_for_db(GetTableOwnerID(),$ownerid)."%'";



Then locate CheckSecurity function, find these lines:

if(!((string)$_SESSION["OwnerID"]===(string)$strValue))

return false;



and replace with this one:

if(strpos($strValue,$_SESSION["OwnerID"])===false)

return false;


Please note that this method works incorrect for the usernames like these:

john**smith, john*sonmith, jakesmith* etc.