Thank you very much Prasad !<br><br>We will have to try it and see how it works for us.<br><br clear="all">David V.<br>
<br><br><div class="gmail_quote">On Fri, Jun 11, 2010 at 3:29 AM, Prasad <span dir="ltr"><<a href="mailto:prasad@vtiger.com">prasad@vtiger.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi David,<br><br>Popup.php is the entry point for the showing records for selection in vtiger CRM. <br><br>There exists a hook in it to customize the query:<br><span><span style="font-family: courier new,monospace;">// vtlib customization: To override module specific popup query for a given field</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">$override_query = false;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">if(method_exists($focus, '<span style="background-color: rgb(255, 255, 153);">getQueryByModuleField</span>')) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">         $override_query = $focus->getQueryByModuleField(vtlib_purify($_REQUEST['srcmodule']),<br> vtlib_purify($_REQUEST['forfield']), vtlib_purify($_REQUEST['forrecord']));</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">         if($override_query) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                 $query = $override_query;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">// END<br>
<br></span></span><span>See if it helps.</span><div><div></div><div class="h5"><span><br></span><span style="font-family: monospace;"><br></span>Regards,<br>Prasad<br>vtiger Team <br><br><div><span class="gmail_quote">On 6/11/10, <b class="gmail_sendername">David V.</b> <<a href="http://davidv.net" target="_blank">davidv.net</a>@<a href="http://gmail.com" target="_blank">gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Prasad,<br><br>Thank you for your reply. But if I correctly understant what you are saying the function 'custom_related_list' I would create would filter the records shown in the related list.<br><br>The list that displays in more information tab (the related list) is NOT the one I want to filter.<br>
<br>I want to filter the content of the popup that shows when I click a button to select a record to add to that related list.<br><br>I want to make it easier for my users to find the record they want. And I want to make it impossible for them to select an unappropriate record.<br>
<span>
<br clear="all">David V.</span><div><span><br>
<br><br><div class="gmail_quote">On Fri, Jun 11, 2010 at 1:28 AM, Prasad <span dir="ltr"><<a href="mailto:prasad@vtiger.com" target="_blank">prasad@vtiger.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi David,<br><br><span><span style="font-family: courier new,monospace;">function setRelatedList($moduleInstance, $label='', $actions=false, $function_name='get_related_list')</span><br></span><span style="font-family: monospace;"><br>
</span>In case you need to filter the records, I would suggest you to create a function 'custom_related_list' in your module and<br>register it by passing the last argument to setRelatedList.<br><br>get_related_list function is made available through data/CRMEntity.php<br>
<br>Regards,<br>Prasad<br>vtiger Team<br><br><div><div><div></div><div><span class="gmail_quote">On 6/11/10, <b class="gmail_sendername">David V.</b> <<a href="http://davidv.net" target="_blank">davidv.net</a>@<a href="http://gmail.com" target="_blank">gmail.com</a>> wrote:</span></div>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>
The setRelatedList API is extremely important for us who need to adapt Vtiger to specials requirements.<br><br>One question I still have is : is it possible to pre-filter the records in the windows that pops-up when I click Add on a related list ?<br>
<br>Exemple : I have a module Payslip. I want it to be related to the module Account so I can select Accounts to add to the More information tab of a specific Payslip.<br><br>I use the setRelatedList API as described in VtigerCRM_5.1.0_Vtlib.pdf and it works perfectly.<br>
<br>Now suppose that I want to show only a subset of the Accounts when I click on the Add button in the related list. For example I want to display only accounts from a specific city.<br><br>Is there already a way to do that ?<br>
<br>If not, would it be possible to add an other argument to the setRelatedList API ?<br><br>Vtiger_Module->setRelatedList(<TARGET MODULE>[, <HEADER LABEL>, <ALLOWED ACTIONS>, <CALLBACK FUNCTION NAME>, <FILTER FUNCTION NAME>]);<br>
<br><FILTER FUNCTION NAME><br>Optional (default = everything)<br>The function should be defined in the <SOURCE MODULE> class.<br>This should filter the records in the <TARGET MODULE> popup before displaying.<br>
<span>
<br><br clear="all">David V.<br>
</span><br></div></div>_______________________________________________<br>
Join vtiger community at <a href="http://forums.vtiger.com" target="_blank">http://forums.vtiger.com</a><br></blockquote></div><br>
<br>_______________________________________________<br>
Join vtiger community at <a href="http://forums.vtiger.com" target="_blank">http://forums.vtiger.com</a><br></blockquote></div><br>
</span></div><br>_______________________________________________<br>
Join vtiger community at <a href="http://forums.vtiger.com" target="_blank">http://forums.vtiger.com</a><br></blockquote></div><br>
</div></div><br>_______________________________________________<br>
Join vtiger community at <a href="http://forums.vtiger.com" target="_blank">http://forums.vtiger.com</a><br></blockquote></div><br>