vtiger Forum Index vtiger
The Honest Open Source CRM
 

New Code - Hide fields & Get rid of annonying Nulls
Click here to go to the original topic

 
       vtiger Forum Index -> Feature Requests - 5.0.3
Previous topic :: Next topic  
Author Message
BrianLaughlin



Joined: 13 Dec 2005
Posts: 801

Posted: Wed Mar 26, 2008 5:37 pm    Post subject: New Code - Hide fields & Get rid of annonying Nulls  

Alright, sorry to post code here, but I really don't know trac well enough and we're always 1 version behind that this seemed to make sense.

The first part of the code is to allow you to hide custom fields. Let's say you want to have sensitive data in your filter or view, but you don't want a user to see it. The following code will help with that.

/modules/CustomView/CustomView.php
Line 193

$display_type = " vtiger_field.displaytype in (1,2,3,100)"; // cw added 100 to allow filed to show up in custom view columns, but not on detail/edit view

This line is what allows up to have hidden custom fields. The display type needs to be changed in the vtiger_field table to 100, allowing the field to be used in CustomView advanced filter without showing up on the DetailView. This is how all of our trigger fields are done.


===============================================
This section of code will deal with that annoying nulls that mess up your view and filters. When you import data and have a customer field that is blank you can not use that in an advanced filter. This code segment fixes that.



/modules/CustomView/CustomView.php
Line 991
// cw added to account for NULL in MySQL
// $value = $tablename.".".$fieldname.$this->getAdvComparator($comparator,$value,$datatype);
$value = 'IFNULL('.$tablename.".".$fieldname.',"")'.$this->getAdvComparator($comparator,$value,$datatype);

IFNULL(fieldname,"") is equivalent to adding OR fieldname is NULL to the SQL statement. This line allows vtiger to correctly compare when there is NULL values. The NULLs in our database come from our imports. It is always better to handle the possibility of NULL rather try to prevent it.

Code Credit to Colin Wright
Back to top  
 
       vtiger Forum Index -> Feature Requests - 5.0.3
Page 1 of 1


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