$where clause problem with list1 and read [message #1543] |
Wed, 13 August 2008 06:24 |
bonzo_bcn
Messages: 152 Registered: June 2008
|
Senior Member |
|
|
In one of my classes I have this proc:
function _cm_initialise ($where, $selection){
if ($GLOBALS['mode'] == 'search' || $GLOBALS['mode'] == 'list') {
require_once 'classes/entidad.class.inc';
$entidad = new entidad;
$entidad->sql_select = 'entidad_id';
$entidad_id = $entidad->getData("entidad_id='" .$_SESSION['role_id'] ."'");
if ($entidad->numrows == 1){
if (empty($where)){
$where = "participante_id IN (SELECT participante_id FROM part_ent_xref WHERE entidad_id=" .$entidad_id[0]['entidad_id'] . ")";
}else{
$where .= "AND participante_id IN (SELECT participante_id FROM part_ent_xref WHERE entidad_id=" .$entidad_id[0]['entidad_id'] . ")";
}
}
}
return $where;
}
The problem I have with it, is that when I hit the read button of a list1 transacation, even though nothing is selected it opens all the records instead of showing the message 'Nothing has been selected yet.'
[Updated on: Wed, 13 August 2008 07:05] Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: $where clause problem with list1 and read [message #1554 is a reply to message #1553] |
Thu, 14 August 2008 10:02 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
This should not be happening. The ENQUIRE1 task should terminate with an error if the $where string does not contain values for the primary key. That is what line 64 in std.enquire1.inc means when it says
// check that primary key is complete
$dbobject->checkPrimaryKey = true; You will have to step through with your debugger to see what is being passed in the $where string and what is happening to it.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
|