Several issues with getRelatedRecordsCount client API
I was looking at how performance could be improved on large systems when, for example, a new comment is posted in Summary view.
One thing I noticed is that once the comment has been submitted there is a call to reload all the Related record count values in the tabs.
This is where things get a bit broken...
In Vtiger_RelatedList_Js
is the method: updateRelatedRecordsCount(relationId)
. Note the single relationId parameter.
This then calls a locally instantiated instance of Vtiger_Detail_Js
with getRelatedRecordsCount(recordId, moduleName, relationId)
. Note the three arguments.
In Vtiger_Detail_Js
however, the getRelatedRecordsCount
method only accepts 2 arguments (not the relationId).
Back in Vtiger_RelatedList_Js
the updateRelatedRecordsCount
method is called several times but in each case it is called with three arguments, e.g.:
thisInstance.updateRelatedRecordsCount(selectedTabElement.data('relation-id'),[1],true);
yet it only actually accepts one argument.
What I was hoping to do would be to pass the relationId to the Vtiger_RelatedRecordsAjax_Action
and modify it so it only had to update the single tab count which had changed. This might reduce the load on the system somewhat - but the code is in such a mess I am not sure where to begin...
In Vtiger_Detail_Js
is the saveComment()
method. This calls relatedController.updateRelatedRecordsCount(jQuery(tabElement).data('relation-id'),[1],true);
. (relatedController being an instance of Vtiger_RelatedList_Js
). Note how it is calling updateRelatedRecordsCount
with three arguments. But as we already know, it only accepts one and then, that method actually calls the getRelatedRecordsCount()
method back in the originating object (the instance of Vtiger_detail_Js
)!!!