[Vtigercrm-commits] [vtiger-commits] r7803 - in /vtigercrm/trunk/include/utils: ListViewUtils.php SearchUtils.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Tue Jul 4 12:12:56 EDT 2006
Author: saraj
Date: Tue Jul 4 10:12:51 2006
New Revision: 7803
Log:
Alphabetic search modified. Fixes #1429
Modified:
vtigercrm/trunk/include/utils/ListViewUtils.php
vtigercrm/trunk/include/utils/SearchUtils.php
Modified: vtigercrm/trunk/include/utils/ListViewUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/ListViewUtils.php (original)
+++ vtigercrm/trunk/include/utils/ListViewUtils.php Tue Jul 4 10:12:51 2006
@@ -2247,7 +2247,7 @@
for($var='A',$i =1;$i<=26;$i++,$var++)
// Mike Crowe Mod --------------------------------------------------------added groupid to url
- $list .= '<td class="searchAlph" id="alpha_'.$i.'" align="center" onClick=\'alphabetic("'.$module.'","gname='.$groupid.'&query='.$query.'&search_field='.$fieldname.'&searchtype=BasicSearch&search_text='.$var.$flag.$popuptypevalue.$returnvalue.$append_url.'","alpha_'.$i.'")\'>'.$var.'</td>';
+ $list .= '<td class="searchAlph" id="alpha_'.$i.'" align="center" onClick=\'alphabetic("'.$module.'","gname='.$groupid.'&query='.$query.'&search_field='.$fieldname.'&searchtype=BasicSearch&type=alpbt&search_text='.$var.$flag.$popuptypevalue.$returnvalue.$append_url.'","alpha_'.$i.'")\'>'.$var.'</td>';
$log->debug("Exiting AlphabeticalSearch method ...");
return $list;
Modified: vtigercrm/trunk/include/utils/SearchUtils.php
==============================================================================
--- vtigercrm/trunk/include/utils/SearchUtils.php (original)
+++ vtigercrm/trunk/include/utils/SearchUtils.php Tue Jul 4 10:12:51 2006
@@ -363,6 +363,10 @@
$replace = array('','','=');
$where= str_replace($search,$replace,$where);
}
+ if($_REQUEST['type'] == 'alpbt')
+ {
+ $where = str_replace_once("%", "", $where);
+ }
$log->debug("Exiting BasicSearch method ...");
return $where;
}
@@ -643,4 +647,22 @@
}
return $where."#@@#".$url_string;
}
+
+/**This function is used to replace only the first occurence of a given string
+Param $needle - string to be replaced
+Param $replace - string to be replaced with
+Param $replace - given string
+Return type is string
+*/
+function str_replace_once($needle, $replace, $haystack)
+{
+ // Looks for the first occurence of $needle in $haystack
+ // and replaces it with $replace.
+ $pos = strpos($haystack, $needle);
+ if ($pos === false) {
+ // Nothing found
+ return $haystack;
+ }
+ return substr_replace($haystack, $replace, $pos, strlen($needle));
+}
?>
More information about the vtigercrm-commits
mailing list