My Vtiger Tools could provide one opportunity, you could use to limit the available records for individual reference fields by condition.
For example provide a field, which only allows to select records, contain to a special industry or have enabled one checkbox.
You must install 2 free modules before: Our Vtiger Tools and our Event Handler module. The first provide the function and the last one the interfaces you need.
If you do NOT install these modules, you cannot open your vtiger anymore!
To do this, you need to modify some core files to insert the Events for the Interface:
File: modules/Vtiger/models/Module.php
Search:
$result = $db->pquery($this->getSearchRecordsQuery($searchValue, $parentId, $parentModule), array());
Replace with:
/**SWPATCHER-DBE8F2A592DE74A2F7F3B970A1D1F963-START-419e9f180bcb9992797f0d63e5108d02**/ /** Don't remove the Start and Finish Markup! **/ $result = EventHandler_Module_Model::do_filter( array( 'vtiger.filter.searchrecords.query', ), false, $this->getName(), $searchValue, $parentId, $parentModule ); if($result === false) { $result = $db->pquery($this->getSearchRecordsQuery($searchValue, $parentId, $parentModule), array()); } /**SWPATCHER-DBE8F2A592DE74A2F7F3B970A1D1F963-FINISH**/
File: modules/Vtiger/models/Record.php
Search:
$query = 'SELECT label, crmid, setype, createdtime FROM vtiger_crmentity WHERE label LIKE ? AND vtiger_crmentity.deleted = 0'; $params = array("%$searchKey%"); if($module !== false) { $query .= ' AND setype = ?'; $params[] = $module; } //Remove the ordering for now to improve the speed //$query .= ' ORDER BY createdtime DESC'; $result = $db->pquery($query, $params);
Replace with: (Replace all 11 lines)
/**SWPATCHER-DBE8F2A592DE74A2F7F3B970A1D1F963-START-419e9f180bcb9992797f0d63e5108d02**/ /** Don't remove the Start and Finish Markup! **/ $result = EventHandler_Module_Model::do_filter( array( 'vtiger.filter.searchrecords.query', ), false, $module, $searchKey ); if($result === false) { $query = 'SELECT label, crmid, setype, createdtime FROM vtiger_crmentity WHERE label LIKE ? AND vtiger_crmentity.deleted = 0'; $params = array("%$searchKey%"); if($module !== false) { $query .= ' AND setype = ?'; $params[] = $module; } //Remove the ordering for now to improve the speed //$query .= ' ORDER BY createdtime DESC'; $result = $db->pquery($query, $params); } /**SWPATCHER-DBE8F2A592DE74A2F7F3B970A1D1F963-FINISH**/
File: layouts/vlayout/modules/Vtiger/resources/Edit.js
Search:
params.search_module = searchModule;
Insert after:
/** * START swarnat Modification */ if(typeof SWVtigerTools === 'object' && typeof SWVtigerTools.filter === 'function') { params = SWVtigerTools.filter('BasicSearchParams', params, element); } /** * END swarnat Modification */
Now you could configure ans use the Limit Reference Selection group in Vtiger Tools configuration.