Fixed bug on double saving two-parts form

yunoshev

Yunoshev Victor
Hi there!
SQL error occures on saving two groups form because of double saving form's data.
Bug exists in Fabrik 3.9.2 & 3.10.
How to resolve:
File components\com_fabrik\models\list.php, goto the end of the function updateObject (line # ~7963). Change code:
PHP:
        $db->setQuery(sprintf($fmtSql, implode(",", $tmp), $where));
        $db->execute();
to:
PHP:
       if (isset($tmp) && count($tmp) && isset($where)) {
          $db->setQuery(sprintf($fmtSql, implode(",", $tmp), $where));
          $db->execute();
       }
[php]
 
Last edited:
Which error?
What do you mean with "two-parts form"? Forms with 2 groups are saved without issue.
Are you running the original Fabrik?
 
Which error?
What do you mean with "two-parts form"? Forms with 2 groups are saved without issue.
Are you running the original Fabrik?
Sure, original Fabrik and forms with 2 groups, but in the 2nd group I turned off saving to DB.
That's all.
Try it yourslef and you'll see the error: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1"
 
I can't replicate. No error if all elements of a group are set to "save to DB"=no, no "double saving".

Did you try to apply such settings (i.e. unpublish, not save to DB, remove write access etc.) to FK and PK elements of joined lists or repeat groups (which are joined tables, too)?
 
@troester
Hi,
No, I have published elements from the joined tables, because I need them to do some tricks.
But I need to boost saving process and that's why I turned off saving the elements from joined tables.
Did you've get me?
 

Attachments

  • mzu_procurements_fabrik_form.png
    mzu_procurements_fabrik_form.png
    198.1 KB · Views: 42
You must not set PK or FK elements to not to save to DB. I don't know if it will break something elsewhere.
If you don't want the repeat group to be saved simply set it to "Show as read only"
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top