vt71: ModTracker Updates layout/code broken. No paging.
A customer wrote to me the other day regarding the Updates tab in one of their custom modules called "Contracts":
In our current system, the earliest update shown is January 5, 2018 (attachment 1). However, going back to v6, we see that there are notes going back two years prior to that (attachment 2). Is v7 truncating the information or did it not all transfer over correctly? It's important for us to have all of the updates in the Contract going back to the beginning of the Contract.
So I did some digging. The initial query to the modtracker_basic table includes a limit clause which is the same as the Maximum Entries in List View in the configuration editor (in this case 50). But there was no indication to the user when viewing the Updates screen that there is any further data to see when you get to the bottom...
Prepared sql query being executed : SELECT * FROM vtiger_modtracker_basic WHERE crmid = ? AND module = ? ORDER BY changedon DESC LIMIT 0, 50
So as a quick test, I removed the LIMIT clause from the ModTracker RecordModel code and refreshed the page. It displayed all the entries, going right back to the initial record Creation event, and then the screen showed a "More" button... When I clicked on that I got another page of the same data.
I'm not quite sure where the error lies with this one? The more button would be great, if there was more to see, but it only shows up when there isn't anymore to see ;-)
I found a normal module with more than 50 updates in modtracker (Leads) and looked at that one. I get the same problem. The more button doesn't show up even though there are loads more records below the first 50.
I think the issue might be here:
http://code.vtiger.com/vtiger/vtigercrm/blob/master/modules/Vtiger/views/Detail.php#L405
This says to me, if 1 (the current page) equals a number (result of COUNT(*) from modtracker_basic for this record) divided by 50 (our page limit) then you have reached the last page?
I can't see that working very often somehow...