2009-04-10 Evi Vanoost <vanooste@rcbi.rochester.edu>

* include/functions_db.php: get_group_agents fixed search
	
	* operation/agentes/estado_agente.php: Small style changes and bugfixes

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1607 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2009-04-10 14:03:24 +00:00
parent 2b083b7904
commit d1bf374dac
3 changed files with 18 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2009-04-10 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions_db.php: get_group_agents fixed search
* operation/agentes/estado_agente.php: Small style changes and bugfixes
2009-04-09 Evi Vanoost <vanooste@rcbi.rochester.edu> 2009-04-09 Evi Vanoost <vanooste@rcbi.rochester.edu>
* include/functions_reporting.php: Added get_agent_module_info which gives * include/functions_reporting.php: Added get_agent_module_info which gives

View File

@ -336,25 +336,25 @@ function get_group_agents ($id_group = 0, $search = false, $case = "lower") {
return array (); return array ();
} }
$search = sprintf ('WHERE id_grupo IN (%s)', implode (",", $id_group)); $search_sql = sprintf ('WHERE id_grupo IN (%s)', implode (",", $id_group));
if ($search === true) { if ($search === true) {
//No added search. Show both disabled and non-disabled //No added search. Show both disabled and non-disabled
} elseif (is_array ($search)) { } elseif (is_array ($search)) {
if (isset ($search["disabled"])) { if (isset ($search["disabled"])) {
$search .= ' AND disabled = '.($search["disabled"] ? 1 : 0); //Bool, no cleanup necessary $search_sql .= ' AND disabled = '.($search["disabled"] ? 1 : 0); //Bool, no cleanup necessary
} else { } else {
$search .= ' AND disabled = 0'; $search_sql .= ' AND disabled = 0';
} }
if (isset ($search["string"])) { if (isset ($search["string"])) {
$string = safe_input ($search["string"]); $string = safe_input ($search["string"]);
$search .= ' (nombre LIKE "'.$string.'" OR comentarios LIKE "'.$string.'" OR direccion LIKE "'.$string.'"'; $search_sql .= ' AND (nombre LIKE "'.$string.'" OR comentarios LIKE "'.$string.'" OR direccion LIKE "'.$string.'")';
} }
} else { } else {
$search .= ' AND disabled = 0'; $search_sql .= ' AND disabled = 0';
} }
$sql = sprintf ("SELECT id_agente, nombre FROM tagente %s ORDER BY nombre", $search); $sql = sprintf ("SELECT id_agente, nombre FROM tagente %s ORDER BY nombre", $search_sql);
$result = get_db_all_rows_sql ($sql); $result = get_db_all_rows_sql ($sql);
if ($result === false) if ($result === false)

View File

@ -63,26 +63,23 @@ if (isset($_POST["ag_group"])){
echo '<form method="post" action="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60">'; echo '<form method="post" action="index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60">';
} }
echo '<table cellpadding="4" cellspacing="4" class="databox">'; echo '<table cellpadding="4" cellspacing="4" class="databox" width="95%">';
echo '<tr><td valign="top">'.__('Group').'</td>'; echo '<tr><td style="white-space:nowrap;">'.__('Group').': ';
echo '<td valign="top">';
$groups = get_user_groups (); $groups = get_user_groups ();
print_select ($groups, 'ag_group', $ag_group, 'this.form.submit()', '', ''); print_select ($groups, 'ag_group', $ag_group, 'this.form.submit()', '', '');
echo '</td><td valign="top">'; echo '</td><td style="white-space:nowrap;">';
echo __('Free text for search').' (*)'; echo __('Free text for search').' (*): ';
echo '</td><td valign="top">';
print_input_text ("search", $search, '', 15); print_input_text ("search", $search, '', 15);
echo '</td><td valign="top">'; echo '</td><td style="white-space:nowrap;">';
print_submit_button (__('Search'), "srcbutton", '', array ("class" => "sub")); print_submit_button (__('Search'), "srcbutton", '', array ("class" => "sub"));
echo "</td></tr></table></form>"; echo '</td><td style="width:40%;">&nbsp;</td></tr></table></form>';
if ($search != ""){ if ($search != ""){
$search_sql = array ("string" => '%'.$search.'%'); $search_sql = array ("string" => '%'.$search.'%');