• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Copy record (via form copy) will "unlink" all joined data from original record

Status
Not open for further replies.

troester

Well-Known Member
Staff member
Setup:
List with join(s) (user defined regular ones: ON list.id = joined-list.fk, repeated or Fabrik defined repeated group)
Copy button in form enabled
After copying the "main" record is copied but all joined records are moved to the new record (not copied, FK/parent_id overridden with the new record id), so missing in the original record.
 
OK.

Now I think about it, I remember discussing this one with Rob a ways back. We were trying to work out what the desired behavior should be.

Is it to copy all the related rows?

Or not touch them, and just create a copy of the primary row, with no related data?

If it's a one-to-one join, with the FK on the parent table, should we still copy the related row, or keep pointing to the same row the original pointed to?

It's a very non-trivial issue, with (IMHO) no one answer (whatever we do would be wrong for some cases), which could only be addressed by adding one or more options to the copy operation. So the trick is to identify ALL possible cases, and work out what the options need to be.

Thoughts?

-- hugh
 
Although I'm pretty sure none of the options we discussed were to do what is currently happening be default, lol! Although it certainly one of the possibilities that some folk might want as an option.

-- hugh
 
At least DON'T touch the original record including it's joined ones, this is really a bug.

I would say copy all joined records. I would expect to get a new record with exactly the information which is displayed before saving. The user doesn't know about joins etc.
He has the possibility to delete or modify repeated group entries before "Save as copy".

So for me the remaining question is "what to do with hidden joined groups?"

But for a simple solution it is also possible to copy only the main record if it's documented clearly.
Then it would be up to the developper who adds the copy button to set e.g. an outro message "copy will copy info from groupXY only".
 
OK, so what about the situation with (say) a one-to-one join from "orders.customer_id" to "customers.id". And the 'orders' table also has a repeat join to a 'products' table, via the standard auto-created 'orders_products_repeat' table (or whatever we call it).

If you select "copy joined data" as your option on the Copy settings, great, you copy and update the 'orders_products_repeat' rows ... but you also wind up with a duplicate customer record.

BTW, when I talk about options/settings, I mean on the backend, not something the end user would see.

Really, the only way I see of doing this is to have YAFO on the list join setup, for "Duplicate on Copy". It has to be a per join setting, not an overall setting for the Copy plugin / button.

-- hugh
 
Beside of additional options etc
I think at least
  • you must not change the original data, i.e. don't change the parentID of the joined/repeated records
  • in form setup then the "Copy button" should be "Copy button, some warning"
 
I've got a first cut at a fix for this going locally, which just copies joined data, except where "FK is on Parent" (i.e "wrong way" joins, as per my previous post about customer records).

Seems to work OK, but I need to do some more testing. I may create a branch for you to test, although I need to clean up some other stuff I'm working on in my local copy first.

Once I'm sure m changes so far are working, I'll look at adding option(s) on the backend for the various cases we've discussed. I'm just not sure whether to do this on a per-group basis (with the option on the group settings), or a single "multiple choice" option under the join settings in the List .. "On Copy:" "Copy all joined data / Copy only Repeated Data / Don't copy join data / whatever".

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top