[Vtigercrm-developers] setRelatedList API - Feature Request : Filter target module

David V. davidv.net at gmail.com
Fri Jun 11 05:57:04 PDT 2010


Thank you very much Prasad !

We will have to try it and see how it works for us.

David V.


On Fri, Jun 11, 2010 at 3:29 AM, Prasad <prasad at vtiger.com> wrote:

> Hi David,
>
> Popup.php is the entry point for the showing records for selection in
> vtiger CRM.
>
> There exists a hook in it to customize the query:
> // vtlib customization: To override module specific popup query for a given
> field
> $override_query = false;
> if(method_exists($focus, 'getQueryByModuleField')) {
>      $override_query =
> $focus->getQueryByModuleField(vtlib_purify($_REQUEST['srcmodule']),
>            vtlib_purify($_REQUEST['forfield']),
> vtlib_purify($_REQUEST['forrecord']));
>      if($override_query) {
>          $query = $override_query;
>      }
> }
> // END
>
> See if it helps.
>
>
> Regards,
> Prasad
> vtiger Team
>
> On 6/11/10, David V. <davidv.net at gmail.com> wrote:
>>
>> Prasad,
>>
>> 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.
>>
>> The list that displays in more information tab (the related list) is NOT
>> the one I want to filter.
>>
>> 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.
>>
>> 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.
>>
>> David V.
>>
>>
>>
>> On Fri, Jun 11, 2010 at 1:28 AM, Prasad <prasad at vtiger.com> wrote:
>>
>>> Hi David,
>>>
>>> function setRelatedList($moduleInstance, $label='', $actions=false,
>>> $function_name='get_related_list')
>>>
>>> In case you need to filter the records, I would suggest you to create a
>>> function 'custom_related_list' in your module and
>>> register it by passing the last argument to setRelatedList.
>>>
>>> get_related_list function is made available through data/CRMEntity.php
>>>
>>> Regards,
>>> Prasad
>>> vtiger Team
>>>
>>> On 6/11/10, David V. <davidv.net at gmail.com> wrote:
>>>
>>>> The setRelatedList API is extremely important for us who need to adapt
>>>> Vtiger to specials requirements.
>>>>
>>>> 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 ?
>>>>
>>>> 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.
>>>>
>>>> I use the setRelatedList API as described in VtigerCRM_5.1.0_Vtlib.pdf
>>>> and it works perfectly.
>>>>
>>>> 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.
>>>>
>>>> Is there already a way to do that ?
>>>>
>>>> If not, would it be possible to add an other argument to the
>>>> setRelatedList API ?
>>>>
>>>> Vtiger_Module->setRelatedList(<TARGET MODULE>[, <HEADER LABEL>, <ALLOWED
>>>> ACTIONS>, <CALLBACK FUNCTION NAME>, <FILTER FUNCTION NAME>]);
>>>>
>>>> <FILTER FUNCTION NAME>
>>>> Optional (default = everything)
>>>> The function should be defined in the <SOURCE MODULE> class.
>>>> This should filter the records in the <TARGET MODULE> popup before
>>>> displaying.
>>>>
>>>>
>>>> David V.
>>>>
>>>> _______________________________________________
>>>> Join vtiger community at http://forums.vtiger.com
>>>>
>>>
>>>
>>> _______________________________________________
>>> Join vtiger community at http://forums.vtiger.com
>>>
>>
>>
>> _______________________________________________
>> Join vtiger community at http://forums.vtiger.com
>>
>
>
> _______________________________________________
> Join vtiger community at http://forums.vtiger.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20100611/ce3260ed/attachment-0002.html 


More information about the vtigercrm-developers mailing list