Form "Show related data links" results in PHP Fatal error

jcc

Member
Joomla! 2.5.6
Fabrik - github Fabrik-fabrik-3.0.5-1051-g7298767

I have a List on Account with a number of related data lists/forms; only 1 of these is set to link to a related list (Audit History). The link shows up correctly in the on the Account List. If I change set the Account form "Show related data links", when I try to bring up a record in the Account Form, I get a blank browser and an exception in the httpd error_log:

PHP Fatal error: Call to a member function getFullName() on a non-object in .../components/com_fabrik/models/list.php on line 1150, referer: ...

Line 1150 is the last line in this code:

Code:
        public function getRecordCounts(&$element, $pks = array())
        {
                if (!isset($this->recordCounts))
                {
                        $this->recordCounts = array();
                }
                $k = $element->element_id;
                if (array_key_exists($k, $this->recordCounts))
                {
                        return $this->recordCounts[$k];
                }
                $listModel = JModel::getInstance('List', 'FabrikFEModel');
                $listModel->setId($element->list_id);
                $db = $listModel->getDb();
                $elementModel = $listModel->getFormModel()->getElement($element->element_id, true);
                $key = $elementModel->getFullName(false, false, false);

Not sure how to fix this...
 
I took a look at my related data links, and whilst I spotted a bug in the popup window html, the page loads ok for me.

Can you check that the element in your related data table is published?
 
The element is published. I also verified all of the other related table's elements are also published. Not sure what else to look at...
 
OK, this one turned out to be because one of the join elements that pointed to the list was in a group which had been trashed, but (for whatever reason) the elements in that group had not been trashed.

So in getJoinsToThisKey(), we were picking up the elements that belonged to the trashed group, so the formModel wouldn't load, yada yada.

I'm about to commit a fix in getJoinsToThisKey() which works on jcc's site, so we don't select elements which belong to unpublished groups.

-- hugh
 
As I understand it - and Hugh will have the actual answer - we have some elements that are not trashed, but are in groups that are trashed. This has caused a preliminary investigative query into the join elements to trip over a published element that was in a trashed group.

FYI - updated to latest github (Fabrik-fabrik-3.0.6-1-g11ad6f1) as part of this...
 
NOTE that this has raised another issue, where the related links at on that form are a little borked. They have no labels, and it's showing ALL related links, not just the ones selected in the List's "Related Data" options.

I haven't confirmed this locally yet. I'll try and vector some more time tomorrow with JCC, and take a deeper look at that.

-- hugh
 
PS - we might want to add checking for form and list being published in that same getJoinsTothisKey() query. i didn't do it, as it wasn't relevant to the bug I was fixing, and I didn't want to add any potential snafus without thinking it through.

Also, we should really work out how those elements were still published, when the group they are in was trashed. We should at least be unpublishing, if not trashing, elements that are part of a group being trashed.

-- hugh
 
The attached image shows the aforementioned borked releated data links.

I have emptied the trash on lists, forms, groups, elements. The attached image is post-house cleaning.

I have, at this point, upgraded to github Fabrik-fabrik-3.0.6.1-8-g526c8bf.

Also, at some point in time between last night and this evening, we seem to have lost the related data links in the list (second image - Audit History column).
 

Attachments

  • borked-related-data-links.JPG
    borked-related-data-links.JPG
    30.2 KB · Views: 271
  • account no related data in list.JPG
    account no related data in list.JPG
    15.8 KB · Views: 283
Things are getting weird where related data links and counts are concerned...at least on my website.

In addition to the previous issues, the related data count as displayed in a different List is artificially inflated.

List link says 4 rows, opened window shows 2 rows (database also only has 2 rows) - see attached picture.

It may possibly be related to some performance issues that I have noticed from some queries. For example, the query that generated the '4' for the List link is something like:
Code:
select ...
from property as property  inner join property_audit as property_audit on property.property_id = property_audit.property_id
inner join property as property_1 on property_audit.property_id = property_1.property_id
The second join of property seems to be the databasejoin element in property_audit on property_id back to property...the one that makes it 'related data' in the property List.
 

Attachments

  • reflexive joins.JPG
    reflexive joins.JPG
    60.4 KB · Views: 276
I've asked hugh if he can look again, he's offline at the moment though

In the meantime if you could send me the login/ftp details that would be fantastic so I can look as well
 
hi i think the issues have been resolved on your site. I've committed the changes to github as well.

We're not quiet sure what happened with the list related data link, I was debugging for a while then noticed that neither yes/no option was selected, which should not occur. I reselected 'yes' and the link re-appeared. Best to keep an eye on that though to see if it happens again. I wonder if copying a join element or similar might cause the selected options here to be changed.
 
Thanks Rob! I've verified that the count in the View link matches the number of rows in the List window when the view link is clicked. Also the underlying database matches.

When you say 'keep an eye on that', you mean the related data yes/no selections?

These items do get copied (parent/child) when we create multiple lists on the same table. This table has a few duplicates for different reasons, though we've been trying to get rid of all of the links because we've had problems with them performing as expected in the past.
 
Reproduce?

I was trying to reorder the related data links in the list by dragging the one I wanted first up above the first one (look at the difference between the first and second image.) When I saved the list and looked at it on the front-end, all of the related data links went away (column headings still there, just no links.) Edited the list again in the back-end, flipped the related data from yes to no to yes for each and saved. Looking at the list on the front-end, the related data links are back and working.

Should I be able to reorder these links using this (or any other) method?

Hope this helps.
 

Attachments

  • related data1.JPG
    related data1.JPG
    47.7 KB · Views: 416
  • related data2.JPG
    related data2.JPG
    40.1 KB · Views: 407
I don't think we currently support ordering of those links. I have a feeling at the moment they will get ordered by the ID of the form / list they belong to, although i'd have to look at the query we use to build the list of linked forms / lists to be sure. And I'm so deep in to last minute panic trying to get ready to leave for Europe in 36 hours ... ::sigh:: ...

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top