• Fabrik4.5.1 for Joomla5.2.4

    Fabrik4.5.1 is out. This update is needed for J!5.2.4

    See Announcements

Fixed Issue with CSV export of list with joined list with a databasejoin element

ghicar

Member
When doing a CSV export of a list with a repeatable join with "Merge rows" or "merge rows and reduce data" and the joined table has a databasejoin element with "render as" set to checkbox with multiple selections allowed.
Then the export stalls with the dialog window left open saying
Code:
Loading...
0 / records.
saving to

You can close the dialog and continue browsing but no export.
If you remove the databasejoin element from the list of exported elements it works
If you change the list join to display "Each row separately" it works

Browser JS console says:
Code:
POST https://mydomain.com/administrator/index.php?Itemid=0& 500 (Internal Server Error)
Uncaught TypeError: Cannot read properties of undefined (reading 'err')
    at Object.onComplete (list.js:2:8247)
    at Object.<anonymous> (mootools-core.js:2:18402)
    at Array.forEach (<anonymous>)
    at Function.forEach (mootools-core.js:2:2763)
    at Array.each (mootools-core.js:2:4674)
    at Object.fireEvent (mootools-core.js:2:18363)
    at s.extend.$owner (mootools-core.js:2:17330)
    at Object.onFailure (mootools-core.js:2:73432)
    at s.extend.$owner (mootools-core.js:2:17330)
    at Object.failure (mootools-core.js:2:73393)

I wasn't sure what the CVS export would look like, and I expect this is an unsupported setup for CSV exports. I think I saw a report where someone had something similar to this and worked around it by adding a calc element that collapsed the databasejoin element to a delimited list of values and exported that instead (but cannot find the report now).

I have seen options where you can customise the CSV export but not tried that yet and expect if I did the failure would occur before it gets to the customisations I apply.

This happens for both front end and backend(admin) CSV exports.

Joomla 5.1.4
Fabrik 4.3.1
PHP 8.2.24
 
I assume your dbjoin element is not set to show in list view (otherwise it would fail already there)?

Try in plugins\fabrik_element\databasejoin\databasejoin.php
replace line 2154
with
Code:
//Multiselect dbjoins
            if (is_array($label)) {
                $parts = [];
                foreach($label as $p) {
                    $parts[] = Text::_($p);
                }
                $label = implode(',',$parts);
                $data[$k] = $label;
            }
            else
                $data[$k] = Text::_($label);
 
Hi troester, wow that was incredibly quick. Yes you are right, I do not display the databasejoin element in the list view. I can confirm that your code fix solves the issue with the CSV export not completing in this setup.

Many thanks for this.

I have however, just found another problem with databasejoin element, which I shall raise separately as I doubt it is related to this.
 
Just seen Fabrik 4.5 is out, and it has a fix for CSV exports but it does not have this fix which has to be re-applied. Could this fix be considered for forthcoming release please.
 

Members online

No members online now.
Back
Top