[Vtigercrm-developers] Apply filters on Popup contents?

Alan Lord alanslists at gmail.com
Mon Oct 6 13:38:30 GMT 2014


On 06/10/14 14:17, Alan Lord wrote:
>> On 06/10/14 10:56, Alan Lord wrote:
>>
>> But I am not sure where I should be doing this... Override Edit.js
>> perhaps?
>
> This seems to be somewhat better.
>
> I create an Edit.js for my vtlib module and in the getPopUpParams()
> function I can add the search_key and value which is good.
>
> What this doesn't fix is the paging model in the Popup...
>
> The total count and page number box do not seem to be aware of the
> search params. Once I execute any kind of search function in the Popup
> the restricted list that was based on search_key and search_value params
> are no longer honoured. Even though they remain in the URL.
>
> Perhaps these two params should also be added to the PopupSearch.tpl
> template as hidden <input> tags by default, seeing as they are being set
> in the Vtiger Popup.php model?
>
>> $viewer->assign('SEARCH_KEY', $searchKey);
>> $viewer->assign('SEARCH_VALUE', $searchValue);
>
> Shame they are not read correctly. The Popup.js and the template use
> search_key and search_value for the box and picklist so I think what I'm
> going to have to do is override the Popup.js and set the picklist/search
> text box on load...

So I reckon a couple of minor tweaks to the PopupSearch.tpl and it would 
all make sense:

Add a test for SEARCH_VALUE and populate the search box
><input class="span2" type="text" placeholder="{vtranslate('LBL_TYPE_SEARCH')}" {if $SEARCH_VALUE} value="{$SEARCH_VALUE}" {/if} id="searchvalue"/>  

Add a test for SEARCH_KEY and select the right fieldname in the Select:

><option value="{$fieldName}" {if $fieldName eq $defaultSearchField} selected {/if}{if $fieldName eq $SEARCH_KEY} selected {/if}>{vtranslate($fieldObject->get('label'),$MODULE)}</option>

If these tests were in the template, it would make no difference to 
existing operations, but would allow us to write our own Edit.js for our 
custom modules and with which we can set the search params to limit the 
results displayed in an obvious manner.

What do you think guys?

Cheers

Al




More information about the vtigercrm-developers mailing list