diff --git a/addressbook/index.php b/addressbook/index.php index 50b3cd8561..c96f970605 100755 --- a/addressbook/index.php +++ b/addressbook/index.php @@ -28,16 +28,27 @@ else $ordermethod = "order by lastname,firstname,email asc"; - if ($filter != "private") - $filtermethod = " or access='public' " . $phpgw->groups->sql_search(); + if (! $filter) { + $filter = "none"; + } + + if ($filter != "private") { + if ($filter != "none") { + $filtermethod = " access like '%,$filter,%' "; + } else { + $filtermethod = " (owner='" . $phpgw->session->loginid ."' OR access='public' " + . $phpgw->groups->sql_search() . " ) "; + } + } else { + $filtermethod = " owner='" . $phpgw->session->loginid . "' "; + } if ($query) { - $phpgw->db->query("select count(*) from addressbook where ( owner='" - . $phpgw->session->loginid - . "' $filtermethod ) AND (lastname like '%$query%' OR firstname like " - . "'%$query%' OR email like '%$query%' OR street like '%$query%' OR " - . "city like '%$query%' OR state like '%$query%' OR zip like '%$query%'" - . " OR notes like '%$query%' OR company like '%$query%')"); + $phpgw->db->query("select count(*) from addressbook where $filtermethod AND (lastname " + . "like '%$query%' OR firstname like '%$query%' OR email like '%$query%" + . "' OR street like '%$query%' OR city like '%$query%' OR state like '" + . "%$query%' OR zip like '%$query%' OR notes like '%$query%' OR company" + . " like '%$query%')"); $phpgw->db->next_record(); @@ -46,8 +57,7 @@ else echo "
" . lang_common("your search returned x matchs",$phpgw->db->f(0)); } else { - $phpgw->db->query("select count(*) from addressbook where owner='" - . $phpgw->session->loginid . "' $filtermethod"); + $phpgw->db->query("select count(*) from addressbook where $filtermethod"); } $phpgw->db->next_record(); @@ -96,15 +106,14 @@ db->query("SELECT * FROM addressbook WHERE (owner='" . $phpgw->session->loginid - . "' $filtermethod ) AND (lastname like '%$query%' OR " - . "firstname like '%$query%' OR email like '%$query%' OR " + $phpgw->db->query("SELECT * FROM addressbook WHERE $filtermethod AND (lastname like '" + . "%$query%' OR firstname like '%$query%' OR email like '%$query%' OR " . "street like '%$query%' OR city like '%$query%' OR state " . "like '%$query%' OR zip like '%$query%' OR notes like " . "'%$query%') $ordermethod limit $limit"); } else { - $phpgw->db->query("SELECT * FROM addressbook WHERE owner='" . $phpgw->session->loginid - . "' $filtermethod $ordermethod limit $limit"); + $phpgw->db->query("SELECT * FROM addressbook WHERE $filtermethod $ordermethod limit " + . $limit); } while ($phpgw->db->next_record()) { diff --git a/doc/CHANGELOG b/doc/CHANGELOG index ab2a8a883c..7adef12fb9 100755 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -18,6 +18,9 @@ need to edit it to add themes - Fixed a problem with the default sorting order messing up the next matchs while viewing a message + - Added feature to check for new releases of phpGW + - Added feature to filter out entrys only within a certain group. + This is for the todo list and addressbook. [08152000] - Fixed a problem with the calendar not showing the months in the users langague preference.