[Vtigercrm-developers] Help on Related List
Christophe Humbert
chrissc.humbert at gmail.com
Thu Apr 23 09:51:17 GMT 2015
Hello Richard,
ok My code is working. Thanks for your help
I have put parent record in the beginning to avoid looping this one as this
does not change:)
And I don't count comments and updates :)
and I was tryng to put in place your proposal of a performance switch and I
thought about reusing the one existing but or whatever reason I am not able
to get able the preference performance boolean value
Here the full code
{*<!--
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License
Version 1.0
* ("License"); You may not use this file except in compliance with the
License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
-->*}
{strip}
{assign var="MODULE_NAME" value=$MODULE_MODEL->get('name')}
{assign var="ParentRecordMd" value=
Vtiger_Record_Model::getInstanceById($RECORD->getId(),
$MODULE_MODEL->get('name'))}
{assign var="PrefPerfBool"
value=PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false)}
</div>
</form>
</div>
<div class="related span2 marginLeftZero">
<div class="">
<ul class="nav nav-stacked nav-pills">
{foreach item=RELATED_LINK
from=$DETAILVIEW_LINKS['DETAILVIEWTAB']}
<li class="{if
$RELATED_LINK->getLabel()==$SELECTED_TAB_LABEL}active{/if}"
data-url="{$RELATED_LINK->getUrl()}&tab_label={$RELATED_LINK->getLabel()}"
data-label-key="{$RELATED_LINK->getLabel()}"
data-link-key="{$RELATED_LINK->get('linkKey')}" >
<a href="javascript:void(0);"
class="textOverflowEllipsis" style="width:auto"
title="{vtranslate($RELATED_LINK->getLabel(),{$MODULE_NAME})}"><strong>{vtranslate($RELATED_LINK->getLabel(),{$MODULE_NAME})}</strong></a>
</li>
{/foreach}
{foreach item=RELATED_LINK
from=$DETAILVIEW_LINKS['DETAILVIEWRELATED']}
<li class="{if
$RELATED_LINK->getLabel()==$SELECTED_TAB_LABEL}active{/if}"
data-url="{$RELATED_LINK->getUrl()}&tab_label={$RELATED_LINK->getLabel()}"
data-label-key="{$RELATED_LINK->getLabel()}" >
{* Assuming most of the related link label
would be module name - we perform dual translation *}
{assign var="DETAILVIEWRELATEDLINKLBL" value=
vtranslate($RELATED_LINK->getLabel(),
$RELATED_LINK->getRelatedModuleName())}
{assign var="RelationListVw" value=
Vtiger_RelationListView_Model::getInstance($ParentRecordMd,
$RELATED_LINK->getRelatedModuleName(), $RELATED_LINK->getLabel())}
{assign var="TotalCountRr"
value=$RelationListVw->getRelatedEntriesCount()}
<a href="javascript:void(0);"
class="textOverflowEllipsis" style="width:auto"
title="{$DETAILVIEWRELATEDLINKLBL}"><strong>{$DETAILVIEWRELATEDLINKLBL}({$TotalCountRr})</strong></a>
</li>
{/foreach}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/strip}
Christophe Humbert
*IT Program Manager*
*CoProcess S.A*
+352 691 391 974
+33 6 50 09 48 88
Skype: chris.e.humbert
On Wed, Apr 22, 2015 at 11:18 PM, Richard Hills - Technologywise <
richard at tw.co.nz> wrote:
> Good work Christophe
>
> The only thing missing:
> variables when used need to be prefixed with $, so you can use:
>
> {assign var="ParentRecordMd" value=
> Vtiger_Record_Model::getInstanceById($RECORD->getId(),
> $MODULE_MODEL->get('name'))}
> {assign var="RelationListVw" value=
> Vtiger_RelationListView_Model::getInstance(*$Par**entRecordMd*,
> $RELATED_LINK->getRelatedModuleName(), $RELATED_LINK->getLabel())}
> {assign var="TotalCountRr" value=*$RelationListVw*
> ->getRelatedEntriesCount()}
>
> (I don't know why, but mine wouldn't parse correctly with the single {}
> containing semi colons..)
>
> And finally you can show the count somewhere with {$TotalCountRr}
>
>
>
> On 23/04/15 08:12, Christophe Humbert wrote:
>
> Hello Richard and All
>
> I have never developed in PHP so please excuse my newbee question but I
> think I am onto something
> in the file you mentionned after the line mentionned below i.e line 36 I
> have added some code
> {* Assuming most of the related link label would be module name - we
> perform dual translation *}
> {assign var="DETAILVIEWRELATEDLINKLBL" value=
> vtranslate($RELATED_LINK->getLabel(),
> $RELATED_LINK->getRelatedModuleName());
> assign var="ParentRecordMd" value=
> Vtiger_Record_Model::getInstanceById($RECORD->getId(),
> $MODULE_MODEL->get('name'));
> assign var="RelationListVw" value=
> Vtiger_RelationListView_Model::getInstance(ParentRecordMd,
> $RELATED_LINK->getRelatedModuleName(), $RELATED_LINK->getLabel());
> assign var="TotalCountRr" value= RelationListVw->getRelatedEntriesCount();}
>
> But it does not work
> I know that $Record->getId() is working as well as $MODULE... and
> $RELATED_LINK...
>
> Any further tip would be appreciated
>
> Christophe Humbert
>
>
>
> On Mon, Apr 20, 2015 at 12:37 AM, Richard Hills - Technologywise <
> richard at tw.co.nz> wrote:
>
>> layout: layouts/vlayout/modules/Vtiger/DetailViewPostProcess.tpl
>> then you can likely adjust getDetailViewRelatedLinks() inside of
>> ./modules/Vtiger/models/DetailView.php to find the count and pass it
>> through to the template.
>>
>> Should be relatively easy to do and you could even chuck in a config
>> switch and submit it to the project.
>>
>> This was just a two minute look after seeing the question here, I may be
>> missing some better way to do it, but this is at least one way you should
>> be able to achieve what you want.
>>
>> Good luck
>>
>>
>>
>> On 19/04/15 21:59, Simone Travaglini wrote:
>>
>> +1
>>
>> 2015-04-19 10:46 GMT+02:00 Christophe Humbert <chrissc.humbert at gmail.com>
>> :
>>
>>> Anyone...a tip to guide me in the right direction?
>>>
>>> Thanks a lot
>>>
>>>
>>>
>>>
>>>
>>> On Fri, Apr 17, 2015 at 10:57 AM, Christophe Humbert <
>>> chrissc.humbert at gmail.com> wrote:
>>>
>>>> Hello Alan
>>>>
>>>> Yes it is present on on-demand version and for me it should not be too
>>>> complicated...once you know where to look at..
>>>>
>>>> and it is clearly a nice plus..
>>>>
>>>>
>>>> On Fri, Apr 17, 2015 at 10:42 AM, Alan Lord <alanslists at gmail.com>
>>>> wrote:
>>>>
>>>>> On 17/04/15 09:34, Christophe Humbert wrote:
>>>>>
>>>>>> Hello
>>>>>>
>>>>>> On community Edition, I would like to add in the right panel where you
>>>>>> have all related modules the number of records for each modules....
>>>>>>
>>>>>
>>>>> I have been asking for that for *years*...
>>>>>
>>>>> The developers seemed a bit reticent about doing it for performance
>>>>> reasons but I noted (I think) that it is possible in the On Demand version.
>>>>>
>>>>> Al
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> http://www.vtiger.com/
>>>>>
>>>>
>>>>
>>>
>>> _______________________________________________
>>> http://www.vtiger.com/
>>>
>>
>>
>>
>> --
>> Simone Travaglini
>> 328 5499846
>> Linkedin: Simone Travaglini
>>
>>
>> Rispetta l'ambiente: non stampare questa mail se non ti è veramente
>> necessario!
>>
>>
>> _______________________________________________http://www.vtiger.com/
>>
>>
>> --
>> Richard Hills
>> TechnologyWise Ltd, Tauranga, NZrichard at tw.co.nzwww.technologywise.co.nz
>> ph: +64 (0)7 571 1060
>> fax: +64 (0)7 571 1061
>>
>>
>> _______________________________________________
>> http://www.vtiger.com/
>>
>
>
>
> _______________________________________________http://www.vtiger.com/
>
>
> --
> Richard Hills
> TechnologyWise Ltd, Tauranga, NZrichard at tw.co.nzwww.technologywise.co.nz
> ph: +64 (0)7 571 1060
> fax: +64 (0)7 571 1061
>
>
> _______________________________________________
> http://www.vtiger.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20150423/908992af/attachment-0001.html>
More information about the vtigercrm-developers
mailing list