prevent SQL error if for what every reason an invalid org_view was set (eg. just a contact_id, instead of string starting with "org_name")

This commit is contained in:
Ralf Becker 2014-06-03 09:54:53 +00:00
parent 90214935be
commit 7a5b2a59b1

View File

@ -732,7 +732,7 @@ class addressbook_ui extends addressbook_bo
if ($name) $org_name[] = $name; if ($name) $org_name[] = $name;
} }
$org_name = implode(': ',$org_name); $org_name = implode(': ',$org_name);
return array($org => $org_name); return $org_name ? array($org => $org_name) : array();
} }
/** /**
@ -1387,7 +1387,11 @@ window.egw_LAB.wait(function() {
foreach(explode('|||',$query['org_view']) as $part) foreach(explode('|||',$query['org_view']) as $part)
{ {
list($name,$value) = explode(':',$part,2); list($name,$value) = explode(':',$part,2);
$query['col_filter'][$name] = $value; // do NOT set invalid column, as this gives an SQL error ("AND AND" in sql)
if (in_array($name, array('org_name','org_unit','adr_one_location')))
{
$query['col_filter'][$name] = $value;
}
} }
} }
else if($query['actions'] && !$query['actions']['edit']) else if($query['actions'] && !$query['actions']['edit'])