vtiger Forum Index vtiger
The Honest Open Source CRM
 

Advanced Search 4.2.x
Click here to go to the original topic

 
       vtiger Forum Index -> Code Contributions - 4.x
Previous topic :: Next topic  
Author Message
ales



Joined: 13 Jun 2006
Posts: 18
Location: Slovenia

Posted: Wed Aug 02, 2006 8:49 am    Post subject: Advanced Search 4.2.x  

Advanced Search more beautiful way. Two rows of field and if last just one still add shaded row.

This is copy/paste from my code

1. In file under ../vtiger42x/include/CustomFieldUtil.php replace function CustomFieldSearch() with:
..
function CustomFieldSearch( $customfieldarray, $fldModule, $tableName, $colidName, $app_strings, $theme, $fieldlabel, $column )
{
global $adb;

//Custom Field Addition
$dbquery = "select * from field where tablename='".$fldModule."' order by fieldlabel";
$result = $adb->query($dbquery);
if($adb->num_rows($result) != 0)
{
$noofrows = $adb->num_rows($result);

$custfld = '<table width="100%" border="0" cellspacing="1" cellpadding="0">';
$custfld .= '<tr><th align="left" class="formSecHeader" colspan="4">'.$app_strings['LBL_CUSTOM_INFORMATION'].'</th></tr>';
//set line counter to null
$l = 0;
for( $i=0; $i<$noofrows; $i++ )
{
$id = $customfieldarray[$i];
$colName = $column[$i];
$setName = $fieldlabel[$i];
$uitype[$i] = $adb->query_result( $result, $i, 'uitype' );

//set next line counter
$l = $l +1;
//if more than x rows than set to first
if( $l == 3 ) $l = 1;

//check if at start of table row
if( $l == 1 ) {
$custfld .= '<tr>';
}

//checkbox custom field
if( $uitype[$i] == 56 ) {
$custfld .= '<td width="20%" class="dataLabel">'.$colName.':</td>';
if( $customfieldarray[$i] == 'on' ) {
$custfld .='<td width="30%"><input name="'.$setName.'" type="checkbox" checked></td>';
}else{
$custfld .='<td width="30%"><input name="'.$setName.'" type="checkbox"></td>';
}
//date custom field
}else if( $uitype[$i] == 5 ) {
$custfld .= getOutputHtmlForDateField($setName, $colName, $customfieldarray[$i],$maxlength);
//custom field
}else{
$custfld .= '<td width="20%" class="dataLabel">'.$colName.':</td>';
$custfld .= '<td width="30%"><input name="'.$setName.'" type="text" tabindex="'.$i.'" size="25" maxlength="25" value="'.$customfieldarray[$i].'"></td>';
}

//check if at the end of table row
if( $l == 2 ) {
$custfld .= '</tr>';
}
}

//if just one row added
if( $l == 1 ) {
$custfld .= '<td width="20%" class="dataLabel"></td></tr>';
}

$custfld .= '</table>';
return $custfld;
}
}
..


THAT'S IT

There will be patch available soon...

By Ales
Back to top  
mhagelstrom



Joined: 08 Feb 2006
Posts: 13
Location: Buenos Aires

Posted: Mon Oct 23, 2006 10:05 pm    Post subject: Advanced Search 4.2.x  

Thank you Ales for this contribution. This is something that I have been looking for a while and as I donīt know how code not even a line of php, this is great.
What I would like to have in Vtiger 4.2.4 (we have it on production actualy) is a contact advanced search similar to the one of the Vtiger 5.x.
i mean to be able to pick the fields from a list, write what we are searching and to have the possibility to search using AND / OR other fields.
Do you think that this can be done or do you know if somebody already did it?

Thanks in advance.

Martin
Back to top  
 
       vtiger Forum Index -> Code Contributions - 4.x
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.15 © 2001, 2002 phpBB Group