<div dir="ltr">And if anyone can test with a a lot of records on the database to measure the impact in terms of performance it would be great<br><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><br><br></div></div>
<br><div class="gmail_quote">On Thu, Apr 23, 2015 at 11:51 AM, Christophe Humbert <span dir="ltr"><<a href="mailto:chrissc.humbert@gmail.com" target="_blank">chrissc.humbert@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hello Richard,<br><br></div>ok My code is working. Thanks for your help<br></div>I have put parent record in the beginning to avoid looping this one as this does not change:)<br></div><div>And I don't count comments and updates :)<br></div><div><br></div>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<br><br></div>Here the full code<br><div><div><div><br>{*<!--<br>/*********************************************************************************<br>** The contents of this file are subject to the vtiger CRM Public License Version 1.0<br> * ("License"); You may not use this file except in compliance with the License<br> * The Original Code is:  vtiger CRM Open Source<br> * The Initial Developer of the Original Code is vtiger.<br> * Portions created by vtiger are Copyright (C) vtiger.<br> * All Rights Reserved.<br>*<br> ********************************************************************************/<br>-->*}<br>{strip}<br>    {assign var="MODULE_NAME" value=$MODULE_MODEL->get('name')}<span class=""><br>    {assign var="ParentRecordMd" value= Vtiger_Record_Model::getInstanceById($RECORD->getId(), $MODULE_MODEL->get('name'))}<br></span>    {assign var="PrefPerfBool" value=PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false)}<br><br>                    </div><br>                </form><br>            </div><br>            <div class="related span2 marginLeftZero"><br>                <div class=""><br>                    <ul class="nav nav-stacked nav-pills"><br>                        {foreach item=RELATED_LINK from=$DETAILVIEW_LINKS['DETAILVIEWTAB']}<br>                        <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')}" ><br>                            <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><br>                        </li><br>                        {/foreach}<br>                        {foreach item=RELATED_LINK from=$DETAILVIEW_LINKS['DETAILVIEWRELATED']}<br>                        <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()}" ><span class=""><br>                            {* Assuming most of the related link label would be module name - we perform dual translation *}<br>                            {assign var="DETAILVIEWRELATEDLINKLBL" value= vtranslate($RELATED_LINK->getLabel(), $RELATED_LINK->getRelatedModuleName())}<br></span><span class="">                            {assign var="RelationListVw" value= Vtiger_RelationListView_Model::getInstance($ParentRecordMd, $RELATED_LINK->getRelatedModuleName(), $RELATED_LINK->getLabel())}<br>                            {assign var="TotalCountRr" value=$RelationListVw->getRelatedEntriesCount()}<br></span>                            <a href="javascript:void(0);" class="textOverflowEllipsis" style="width:auto" title="{$DETAILVIEWRELATEDLINKLBL}"><strong>{$DETAILVIEWRELATEDLINKLBL}({$TotalCountRr})</strong></a><br>                        </li><br>                        {/foreach}<br>                    </ul><br>                </div><br>            </div><br>        </div><br>    </div><br>    </div><br></div><br></div><br>{/strip}<br></div></div></div></div><div class="gmail_extra"><br clear="all"><div><div>Christophe Humbert<br><i>IT Program Manager</i><br><b>CoProcess S.A</b><br><a href="tel:%2B352%20691%20391%20974" value="+352691391974" target="_blank">+352 691 391 974</a><br><a href="tel:%2B33%206%2050%2009%2048%2088" value="+33650094888" target="_blank">+33 6 50 09 48 88</a><br>Skype: chris.e.humbert<br><br></div></div>
<br><div class="gmail_quote"><div><div class="h5">On Wed, Apr 22, 2015 at 11:18 PM, Richard Hills - Technologywise <span dir="ltr"><<a href="mailto:richard@tw.co.nz" target="_blank">richard@tw.co.nz</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Good work Christophe<br>
    <br>
    The only thing missing:<br>
    variables when used need to be prefixed with $, so you can use: <br>
    <blockquote type="cite">{assign var="ParentRecordMd" value=
      Vtiger_Record_Model::getInstanceById($RECORD->getId(),
      $MODULE_MODEL->get('name'))}<br>
      {assign var="RelationListVw" value=
      Vtiger_RelationListView_Model::getInstance(<b>$Par</b><b>entRecordMd</b>,
      $RELATED_LINK->getRelatedModuleName(),
      $RELATED_LINK->getLabel())}<br>
      {assign var="TotalCountRr" value=<b>$RelationListVw</b>->getRelatedEntriesCount()}<br>
    </blockquote>
    (I don't know why, but mine wouldn't parse correctly with the single
    {} containing semi colons..)<br>
    <br>
    And finally you can show the count somewhere with {$TotalCountRr}<div><div><br>
    <br>
    <br>
    <div>On 23/04/15 08:12, Christophe Humbert
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div>Hello Richard and All<br>
            <br>
          </div>
          I have never developed in PHP so please excuse my newbee
          question but I think I am onto something<br>
        </div>
        in the file you mentionned after the line mentionned below i.e
        line 36 I have added some code<br>
        {* Assuming most of the related link label would be module name
        - we perform dual translation *}<br>
                                    {assign
        var="DETAILVIEWRELATEDLINKLBL" value=
        vtranslate($RELATED_LINK->getLabel(),
        $RELATED_LINK->getRelatedModuleName());<br>
        assign var="ParentRecordMd" value=
        Vtiger_Record_Model::getInstanceById($RECORD->getId(),
        $MODULE_MODEL->get('name'));<br>
        assign var="RelationListVw" value=
        Vtiger_RelationListView_Model::getInstance(ParentRecordMd,
        $RELATED_LINK->getRelatedModuleName(),
        $RELATED_LINK->getLabel());<br>
        assign var="TotalCountRr" value=
        RelationListVw->getRelatedEntriesCount();}<br>
        <div>
          <div>
            <div>
              <div class="gmail_extra"><br>
              </div>
              <div class="gmail_extra">But it does not work<br>
              </div>
              <div class="gmail_extra">I know that $Record->getId()
                is working as well as $MODULE... and $RELATED_LINK...<br>
                <br>
              </div>
              <div class="gmail_extra">Any further tip would be
                appreciated<br>
              </div>
              <div class="gmail_extra"><br clear="all">
                <div>
                  <div>Christophe Humbert<br>
                    <br>
                    <br>
                  </div>
                </div>
                <br>
                <div class="gmail_quote">On Mon, Apr 20, 2015 at 12:37
                  AM, Richard Hills - Technologywise <span dir="ltr"><<a href="mailto:richard@tw.co.nz" target="_blank">richard@tw.co.nz</a>></span>
                  wrote:<br>
                  <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                    <div text="#000000" bgcolor="#FFFFFF"> layout:
                      layouts/vlayout/modules/Vtiger/DetailViewPostProcess.tpl<br>
                      then you can likely adjust
                      getDetailViewRelatedLinks() inside of
                      ./modules/Vtiger/models/DetailView.php to find the
                      count and pass it through to the template.<br>
                      <br>
                      Should be relatively easy to do and you could even
                      chuck in a config switch and submit it to the
                      project.<br>
                      <br>
                      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.<br>
                      <br>
                      Good luck
                      <div>
                        <div><br>
                          <br>
                          <br>
                          <div>On 19/04/15 21:59, Simone Travaglini
                            wrote:<br>
                          </div>
                        </div>
                      </div>
                      <blockquote type="cite">
                        <div>
                          <div>
                            <div dir="ltr">+1</div>
                            <div class="gmail_extra"><br>
                              <div class="gmail_quote">2015-04-19 10:46
                                GMT+02:00 Christophe Humbert <span dir="ltr"><<a href="mailto:chrissc.humbert@gmail.com" target="_blank">chrissc.humbert@gmail.com</a>></span>:<br>
                                <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                                  <div dir="ltr">
                                    <div>Anyone...a tip to guide me in
                                      the right direction?<br>
                                      <br>
                                    </div>
                                    Thanks a lot
                                    <div>
                                      <div><br>
                                        <div class="gmail_extra"><br clear="all">
                                          <div>
                                            <div><br>
                                              <br>
                                            </div>
                                          </div>
                                          <br>
                                          <div class="gmail_quote">On
                                            Fri, Apr 17, 2015 at 10:57
                                            AM, Christophe Humbert <span dir="ltr"><<a href="mailto:chrissc.humbert@gmail.com" target="_blank">chrissc.humbert@gmail.com</a>></span>
                                            wrote:<br>
                                            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                                              <div dir="ltr">
                                                <div>Hello Alan<br>
                                                  <br>
                                                </div>
                                                Yes it is present on
                                                on-demand version and
                                                for me it should not be
                                                too complicated...once
                                                you know where to look
                                                at..<br>
                                                <div class="gmail_extra"><br clear="all">
                                                  <div>
                                                    <div>and it is
                                                      clearly a nice
                                                      plus..<br>
                                                    </div>
                                                    <div><br>
                                                    </div>
                                                  </div>
                                                  <div>
                                                    <div> <br>
                                                      <div class="gmail_quote">On
                                                        Fri, Apr 17,
                                                        2015 at 10:42
                                                        AM, Alan Lord <span dir="ltr"><<a href="mailto:alanslists@gmail.com" target="_blank">alanslists@gmail.com</a>></span>
                                                        wrote:<br>
                                                        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>On

                                                          17/04/15
                                                          09:34,
                                                          Christophe
                                                          Humbert wrote:<br>
                                                          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                                                          Hello<br>
                                                          <br>
                                                          On community
                                                          Edition, I
                                                          would like to
                                                          add in the
                                                          right panel
                                                          where you<br>
                                                          have all
                                                          related
                                                          modules the
                                                          number of
                                                          records for
                                                          each
                                                          modules....<br>
                                                          </blockquote>
                                                          <br>
                                                          </span> I have
                                                          been asking
                                                          for that for
                                                          *years*...<br>
                                                          <br>
                                                          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.<br>
                                                          <br>
                                                          Al<br>
                                                          <br>
                                                          <br>
_______________________________________________<br>
                                                          <a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br>
                                                        </blockquote>
                                                      </div>
                                                      <br>
                                                    </div>
                                                  </div>
                                                </div>
                                              </div>
                                            </blockquote>
                                          </div>
                                          <br>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                  <br>
_______________________________________________<br>
                                  <a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br>
                                </blockquote>
                              </div>
                              <br>
                              <br clear="all">
                              <div><br>
                              </div>
                              -- <br>
                              <div>Simone Travaglini<br>
                                328 <a href="tel:5499846" value="+3525499846" target="_blank">5499846</a><br>
                                Linkedin: Simone Travaglini <br>
                                <br>
                                <br>
                                <span style="color:rgb(51,204,0)">Rispetta
                                  l'ambiente: non stampare questa mail
                                  se non ti è veramente necessario!</span><br>
                              </div>
                            </div>
                            <br>
                            <fieldset></fieldset>
                            <br>
                          </div>
                        </div>
                        <pre>_______________________________________________
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a></pre>
                        <span><font color="#888888"> </font></span></blockquote>
                      <span><font color="#888888"> <br>
                          <pre cols="72">-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
<a href="mailto:richard@tw.co.nz" target="_blank">richard@tw.co.nz</a>
<a href="http://www.technologywise.co.nz" target="_blank">www.technologywise.co.nz</a>
ph: <a href="tel:%2B64%20%280%297%20571%201060" value="+6475711060" target="_blank">+64 (0)7 571 1060</a>
fax: <a href="tel:%2B64%20%280%297%20571%201061" value="+6475711061" target="_blank">+64 (0)7 571 1061</a></pre>
                        </font></span></div>
                    <br>
                    _______________________________________________<br>
                    <a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br>
                  </blockquote>
                </div>
                <br>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a></pre>
    </blockquote>
    <br>
    <pre cols="72">-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
<a href="mailto:richard@tw.co.nz" target="_blank">richard@tw.co.nz</a>
<a href="http://www.technologywise.co.nz" target="_blank">www.technologywise.co.nz</a>
ph: <a href="tel:%2B64%20%280%297%20571%201060" value="+6475711060" target="_blank">+64 (0)7 571 1060</a>
fax: <a href="tel:%2B64%20%280%297%20571%201061" value="+6475711061" target="_blank">+64 (0)7 571 1061</a></pre>
  </div></div></div>

<br></div></div>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br></div>
</blockquote></div><br></div></div>