[Vtigercrm-developers] Fwd: Re: BUG -> in vtiger 6.1 SVN 14176 (hardcoded callback in listview search and sort_by)

Vic Cekvenich vic.cvc at gmx.com
Sun Aug 17 22:06:04 GMT 2014



-------- Original Message --------
Subject: 	Re: [Vtigercrm-developers] BUG -> in vtiger 6.1 SVN 14176 
(hardcoded callback in listview search and sort_by)
Date: 	Wed, 06 Aug 2014 12:37:52 +0200
From: 	Holbok István <holbok at gmail.com>
Reply-To: 	holbok at gmail.com, vtigercrm-developers at lists.vtigercrm.com
To: 	Rishab K <rishab.k at vtiger.com>, 
vtigercrm-developers at lists.vtigercrm.com



Hi Rishab,

It was exactly done before my letter.
And today morning I went through again all the steps.

And it works, except by clicking search or sort on the header of the 
listview table.

At the normal list view vtiger uses the overrided Function 
getListSearchTemplateName() from the 
/modules/CustomModule/uitypes/MyCustomPicklist.php
It is easy to control turning on the debug function and putting a 
$log->debug('I am here :-) '); row to the function overrided Function 
getListSearchTemplateName().

When I am going to the listview the call of overrided Function 
getListSearchTemplateName() happened and it return the necessary 
'uitypes/MyMultiSelectFieldSearchView.tpl' string, and it parsed well.

When I am clicking to*a header field to sort by record_id*, the call of 
overrided Function getListSearchTemplateName() happened again and it 
return the necessary 'uitypes/MyMultiSelectFieldSearchView.tpl' string 
as well, but in this case the *string parsed wrong* and vtiger looks for 
the template in the Vtiger directory instead of the CustomModule layout 
directory.
It is also checked. Copying the template from the CustomModule layout 
directory to the Vtiger layout directory the error message did not appear.

So there should be a directory parse bug inside somewhere.

regards:
Istvan



2014.08.06. 11:10 keltezéssel, Rishab K írta:
> I meant in your case Override the Function 
> *getListSearchTemplateName()* of /layouts/vlayout/uitypes/Base.php in
> your
>
> */modules/CustomModule/uitypes/
> *
> *
> *
> *or add *
> *
> *
> *
> public function getListSearchTemplateName() {
>         return 'uitypes/MyMultiSelectFieldSearchView.tpl
> ';
> *
> *    }*
>
> In your MyCustomPicklist.php under
>
> */modules/CustomModule/uitypes/*
>
>
> On Wed, Aug 6, 2014 at 1:06 PM, Holbok István <holbok at gmail.com 
> <mailto:holbok at gmail.com>> wrote:
>
>     Dear Rishab,
>
>     Thank you very much for the support.
>     May my English was not enough good to explain my findings.
>
>     I am using overrided *ListViewContents.tpl* under
>     /layouts/vlayout/modules/CustomModule/ and the template works well.
>     I have just included a line before the red below:
>
>
>     {*include
>     file=vtemplate_path($FIELD_UI_TYPE_MODEL->getListSearchTemplateName(),$MODULE_NAME*)
>                         FIELD_MODEL= $LISTVIEW_HEADER
>     SEARCH_INFO=$SEARCH_DETAILS[$LISTVIEW_HEADER->getName()]
>     USER_MODEL=$CURRENT_USER_MODEL}
>
>     {$FIELD_UI_TYPE_MODEL->getListSearchTemplateName()} to write out
>     to the screen the template names used in different column.
>
>     In the custom multipicklist column was listed the right template
>     name: *uitypes/MyMultiSelectFieldSearchView.tpl*
>     And this template name is defined by the
>     .../modules/CustomModule/uitypes/MyMultipicklist.php with
>     overriding the Function *getListSearchTemplateName()* for that
>     uitype only.
>
>     The template name is OK, vtiger find in any case the *right
>     template name*, but in sort and search vtiger looking for this
>     right name in the wrong directory.
>
>     I did the suggested ovveride in the
>     modules/Vtiger/uitypes/Base.php ->
>     modules/CustomModule/uitypes/Base.php
>
>     BUT when clicking to the listview header to sort the columns e.g.
>     by Record Label the too same error appeared.
>
>     The vtiger looking for the right template name in the incorrect
>     directory.
>     The right directory will be:
>     *.../layouts/vlayout/modules/CustomModule/uitypes/*
>
>     vtiger looking for the right template name in the
>     *.../layouts/vlayout/modules/Vtiger/uitypes/*
>
>     So overriding the Function *getListSearchTemplateName()* in the
>     modules/Vtiger/uitypes/Base.php is not a right solution.
>     Even the Function *getListSearchTemplateName()* in the
>     modules/Vtiger/uitypes/Multipicklist.php is already overrided in
>     it works - generates the right name.
>
>     My opinion is that the .../modules/Vtiger/models/ListView.php
>     fails inside the function getListViewHeaders() or in function
>     getListViewEntries($pagingModel).
>     query_generator or listview_controller
>
>     Do the these entities manipulate the templates somewhere?
>
>
>     Regards:
>     *István*
>
>
>
>     2014.08.06. 8:30 keltezéssel, Rishab K írta:
>>
>>         It indicates the sort_by and search javascript functions on
>>         the listview screen use a hardcoded path to the templates and
>>         did not use the callback to the CustomModule directory.
>>         Unable to load template file
>>         '*modules/Vtiger/uitypes/MyMultiSelectFieldSearchView.tpl*'
>>         in '*modules/****CustomModule**/ListViewContents.tpl*'
>>
>>
>>     Istavan,
>>
>>     The template name of ListViewSearch and Sort is not hard coded.
>>
>>     In ListViewContents.tpl under /layouts/vlayout/modules/Vtiger/
>>     around line 80,81
>>
>>     {*include
>>     file=vtemplate_path($FIELD_UI_TYPE_MODEL->getListSearchTemplateName(),$MODULE_NAME*)
>>                         FIELD_MODEL= $LISTVIEW_HEADER
>>     SEARCH_INFO=$SEARCH_DETAILS[$LISTVIEW_HEADER->getName()]
>>     USER_MODEL=$CURRENT_USER_MODEL}
>>
>>     The above line marked in red loads the Template file for the
>>     respective FieldUitype.
>>
>>     So in your case Override the Function
>>     *getListSearchTemplateName() *of /layouts/vlayout/uitypes/Base.php
>>     to serve your purpose.
>>     Please review.
>>
>>     Regards,
>>     Rishab
>>
>>
>>     On Mon, Aug 4, 2014 at 10:08 PM, Holbok István <holbok at gmail.com
>>     <mailto:holbok at gmail.com>> wrote:
>>
>>         Dear vtiger Team,
>>
>>         As per Rishab's suggestion of 07/22 I have created a custom
>>         UIType (special multiselect picklist) for my custom module.
>>
>>         I have created:
>>         *.../layouts/vlayout/modules/CustomModule/uitypes/MyMultiSelectFieldSearchView.tpl*
>>         and
>>         *.../layouts/vlayout/modules/CustomModule/uitypes/MyMultiPicklist.tpl*
>>         and did the necessary modification for my purposes.
>>
>>         I have also created the necessary service files:
>>         *.../modules/***CustomModule*/uitypes/MyMultipicklist.php* and
>>         *.../modules/****CustomModule**/models/Field.php* to serve
>>         the template with data.
>>
>>         The class *CustomModule**_Field_Model* extends
>>         *Vtiger_Field_Model* and class
>>         *CustomModule**_MyMultipicklist_UIType* extends
>>         *Vtiger_Base_UIType* .
>>
>>         With rewriting the display related methods in the above
>>         mentioned 2 classes the custom UIType field started work in
>>         my custom module.
>>         The listview, the detailvew and the editview also showed the
>>         necessary field data in the necessary display format.
>>
>>         The listview loaded the template from the file
>>         ".../layouts/vlayout/modules/CustomModule/uitypes/MyMultiSelectFieldSearchView.tpl"
>>         and the detailview and editview loaded the template from the
>>         ".../layouts/vlayout/modules/CustomModule/uitypes/MyMultiPicklist.tpl".
>>
>>         *But clicking* to the header of the listview to get sort by
>>         some field or search by some field (does not matter what was
>>         the search field) I have received a template error:
>>
>>         Unable to load template file
>>         '*modules/Vtiger/uitypes/MyMultiSelectFieldSearchView.tpl*'
>>         in '*modules/****CustomModule**/ListViewContents.tpl*'
>>
>>         Copying file
>>         '.../layouts/vlayout/modules/CustomModule/uitypes/MyMultiSelectFieldSearchView.tpl'
>>         to the directory
>>         '.../modules/Vtiger/uitypes/MyMultiSelectFieldSearchView.tpl'
>>         the template error resolved.
>>
>>         It indicates the sort_by and search javascript functions on
>>         the listview screen use a hardcoded path to the templates and
>>         did not use the callback to the CustomModule directory.
>>
>>
>>         -- 
>>         üdvözlettel:
>>
>>         *Holbok István*
>>
>>         +3670-342-0900
>>         *e-mail:* holbok at gmail.com <mailto:holbok at gmail.com>
>>         *SkyPe:* holboki
>>
>>
>>         _______________________________________________
>>         http://www.vtiger.com/
>>
>>
>
>
>


-------------- next part --------------
_______________________________________________
http://www.vtiger.com/


More information about the vtigercrm-developers mailing list