forked from extern/egroupware
Add ability to select all/none or a specific category
This commit is contained in:
parent
5c4dbe12cc
commit
fb1aa7062b
@ -325,7 +325,7 @@
|
||||
$isstd=0;
|
||||
if ($name && empty($value)) {
|
||||
if ($DEBUG) { echo "<br>DEBUG - filter field '".$name."' is empty (NULL)"; }
|
||||
$check_stock = $this->stock_contact_fields + array('id' => 'id', 'tid' => 'tid', 'lid' => 'lid', 'owner' => 'owner');
|
||||
$check_stock = $this->stock_contact_fields + array('id' => 'id', 'tid' => 'tid', 'lid' => 'lid', 'owner' => 'owner', 'cat_id' => 'cat_id');
|
||||
while (list($fname,$fvalue)=each($check_stock)) {
|
||||
if ($fvalue==$name) {
|
||||
$filterlist .= $name.' is NULL,';
|
||||
|
@ -33,15 +33,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
function cat_option($cat_id) {
|
||||
function cat_option($cat_id='') {
|
||||
global $phpgw_info;
|
||||
// Get global and app-specific category listings
|
||||
// Setup all and none first
|
||||
$cats_link = "<select name=\"cat_id\">";
|
||||
$cats_link .= "<option value =\"all\"";
|
||||
if ($cat_id=="all") {
|
||||
$cats_link .= " selected";
|
||||
}
|
||||
$cats_link .= ">".lang("all");
|
||||
|
||||
$cats_link .= "<option value =\"0\"";
|
||||
if (!$cat_id) {
|
||||
$cats_link .= " selected";
|
||||
}
|
||||
$cats_link .= ">".lang("none");
|
||||
|
||||
// Get global and app-specific category listings
|
||||
$cats = CreateObject('phpgwapi.categories');
|
||||
|
||||
$cats->categories($phpgw_info['user']['account_id'],'phpgw');
|
||||
|
@ -96,12 +96,25 @@
|
||||
// Set filter to display entries where tid is blank,
|
||||
// else they may be accounts, etc.
|
||||
$savefilter = $filter;
|
||||
|
||||
if ($filter == "none") {
|
||||
$filter = 'tid=,cat_id='.$cat_id;
|
||||
if ($cat_id == "all") {
|
||||
$filter = 'tid=';
|
||||
} else {
|
||||
$filter = 'tid=,cat_id='.$cat_id;
|
||||
}
|
||||
} elseif($filter == "private") {
|
||||
$filter = 'owner='.$phpgw_info["user"]["account_id"].',tid=,cat_id='.$cat_id;
|
||||
if ($cat_id == "all") {
|
||||
$filter = 'owner='.$phpgw_info["user"]["account_id"].',tid=';
|
||||
} else {
|
||||
$filter = 'owner='.$phpgw_info["user"]["account_id"].',tid=,cat_id='.$cat_id;
|
||||
}
|
||||
} else {
|
||||
$filter .= ',tid=,cat_id='.$cat_id;
|
||||
if ($cat_id == "all") {
|
||||
$filter .= ',tid=';
|
||||
} else {
|
||||
$filter .= ',tid=,cat_id='.$cat_id;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if prefs were set, if not, create some defaults
|
||||
|
Loading…
Reference in New Issue
Block a user