_reduceDataForXRepeatedJoins() removes join data from repeat group if confirmation plugin is used

Boschung

New Member
I defined a form that uses the confirmation form plugin and a repeating group to represent a 1 to n join between two lists. Pretty basic stuff. I tested the form and added several occurrences of the repeating group. When i hit save, the confirmation plugin shows the details view of all the data that i have entered before, as expected. But if i hit the button "fabrik_redoconfirmation", then i get back to the form view and only the first repeat group shows the values which i have entered. The other repeat groups remain visible but no values are set.
I did some resarch using xdebug and found that the join data is removed in the file joomla/components/com_fabrik/models/form.php in the function _reduceDataForXRepeatedJoins() in a foreach loop that begins in line 4079. I guess the reason for this is that if you hit redo confirmation then _arErrors is not set. Could you please fix this.

I updated Fabrik 3.0.8 from github on my system this morning.
 
I'm not sure if we'll be able to fix this in 3.0, for such a corner case issue. We're really trying to concentrate on getting a solid 3.1 build out for J! 3.x.

-- hugh
 
OK I see. I will try to fix it myself on my installation. I guess i just need to add another condition to fill the usedKeys array that checks if there is the confirmation plugin set for the form.
 
If you can get it working, I'd be happy to test it and apply your fix to the code. Just detail the changes here.

Or, if you are familiar with github, submit a Pull Request for any changes you make.

-- hugh
 
I found that there is a key named 'fabrik_confirmation' in the array $this->_data if the user hits redo confirmation. So I did the following change:

In file: components/com_fabrik/models/form.php in line 4091
I changed the line from:

if (!in_array($value, $usedkeys) || ($value === '' && !empty($this->_arErrors)))

to:

if (!in_array($value, $usedkeys) || ($value === '' && !empty($this->_arErrors)) || ($value === '' && array_key_exists('fabrik_confirmation', $this->_data)))


I did not much resarch on the code and i am not sure if that condition is adequate in all cases. But it works on my site and all the repeat groups are filled correctly now if redo confirmation is hit. Nevertheless i do not use any n to n relations in my model so i am not sure if this change affects cases that use n to n relations.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top