Added filter by group

This commit is contained in:
jengo 2000-08-19 05:39:30 +00:00
parent d981215fa1
commit a863826b21
2 changed files with 27 additions and 15 deletions

View File

@ -28,16 +28,27 @@
else else
$ordermethod = "order by lastname,firstname,email asc"; $ordermethod = "order by lastname,firstname,email asc";
if ($filter != "private") if (! $filter) {
$filtermethod = " or access='public' " . $phpgw->groups->sql_search(); $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) { if ($query) {
$phpgw->db->query("select count(*) from addressbook where ( owner='" $phpgw->db->query("select count(*) from addressbook where $filtermethod AND (lastname "
. $phpgw->session->loginid . "like '%$query%' OR firstname like '%$query%' OR email like '%$query%"
. "' $filtermethod ) AND (lastname like '%$query%' OR firstname like " . "' OR street like '%$query%' OR city like '%$query%' OR state like '"
. "'%$query%' OR email like '%$query%' OR street like '%$query%' OR " . "%$query%' OR zip like '%$query%' OR notes like '%$query%' OR company"
. "city like '%$query%' OR state like '%$query%' OR zip like '%$query%'" . " like '%$query%')");
. " OR notes like '%$query%' OR company like '%$query%')");
$phpgw->db->next_record(); $phpgw->db->next_record();
@ -46,8 +57,7 @@
else else
echo "<br>" . lang_common("your search returned x matchs",$phpgw->db->f(0)); echo "<br>" . lang_common("your search returned x matchs",$phpgw->db->f(0));
} else { } else {
$phpgw->db->query("select count(*) from addressbook where owner='" $phpgw->db->query("select count(*) from addressbook where $filtermethod");
. $phpgw->session->loginid . "' $filtermethod");
} }
$phpgw->db->next_record(); $phpgw->db->next_record();
@ -96,15 +106,14 @@
<?php <?php
if ($query) { if ($query) {
$phpgw->db->query("SELECT * FROM addressbook WHERE (owner='" . $phpgw->session->loginid $phpgw->db->query("SELECT * FROM addressbook WHERE $filtermethod AND (lastname like '"
. "' $filtermethod ) AND (lastname like '%$query%' OR " . "%$query%' OR firstname like '%$query%' OR email like '%$query%' OR "
. "firstname like '%$query%' OR email like '%$query%' OR "
. "street like '%$query%' OR city like '%$query%' OR state " . "street like '%$query%' OR city like '%$query%' OR state "
. "like '%$query%' OR zip like '%$query%' OR notes like " . "like '%$query%' OR zip like '%$query%' OR notes like "
. "'%$query%') $ordermethod limit $limit"); . "'%$query%') $ordermethod limit $limit");
} else { } else {
$phpgw->db->query("SELECT * FROM addressbook WHERE owner='" . $phpgw->session->loginid $phpgw->db->query("SELECT * FROM addressbook WHERE $filtermethod $ordermethod limit "
. "' $filtermethod $ordermethod limit $limit"); . $limit);
} }
while ($phpgw->db->next_record()) { while ($phpgw->db->next_record()) {

View File

@ -18,6 +18,9 @@
need to edit it to add themes need to edit it to add themes
- Fixed a problem with the default sorting order messing up the next matchs - Fixed a problem with the default sorting order messing up the next matchs
while viewing a message 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 [08152000] - Fixed a problem with the calendar not showing the months in the users
langague preference. langague preference.