Regression causing data on related tables to be dropped on save
|Target version:||Release 2.7.0|
|Google Code Legacy ID:||Tested version:|
Some recent commit has caused a regression that is impacting multiple entities, and causing some data to be dropped on save. So far confirmed examples include:
- event dates added to new or edited descriptions
- Note data (any custom rad note type; general notes, etc)
- actor-actor relationships
This was first found via Vagrant testing on 2021-05-25 when testing in Vagrant. The behavior has been confirmed by a forum user on 05-27, here:
To reproduce, create a new description, add a date of creation and a general note, and save.
First theory was the recent large community PR (here ) might have broken it. However, my VM did not include the commits from the PR when first reproduced - see my attached tig output
Next theory was that the STRICT_TRANS_TABLES sql_mode might be causing it. I checked and this was enabled in the vagrant box (so we can find more incompatibilities, per issue # ). However, when I changed sql modes, restarted MySQL, cleared the application cache/PHP-FPM, and reindexed, I was still unable to add event dates to descriptions. It's possible that this is still the culprit somehow but I did double-check that my setting changes were in effect.
There are no relevant error messages I can see in the webserver logs.
The forum user also added:
I enabled general_log in MySQL so I could trace the SQL being generated by attempts to change those values, to see if the INSERT/UPDATE queries were being generated, but failing silently on the DB side. As far as I can tell, no SQL call is being made for the activities that fail.
#1 Updated by Steve Breker 5 months ago
Replicated in latest 18.104.22.168 Vagrant VM.
- created new VM
- pulled all latest commits into atom qa/2.x
- did a tools:purge --demo
- set default template to RAD
- created new description with event date
- dates not recorded on description
- set default template to ISADG
- created new description with event date and note
- dates and notes not saved with description.
#4 Updated by David Juhasz 2 months ago
I think this regression is due to enabling CSRF form validation (https://github.com/artefactual/atom/commit/8e6f28d9d6952945b8f0c373f3e65fe578793da7). I've found that the archival description dates use a sub-form for each row of dates, and the CSRF token is not being properly passed to the sub-forms during form validation. I'm guessing that the other data that is being dropped on form save are also using sub-forms.
#5 Updated by David Juhasz 2 months ago
I've created a dev commit that fixes the form submit for date data: https://github.com/artefactual/atom/commit/dc92d7cff398f85ac22b27870e7f0fee2b1e2ae4
I'll keep working on the other data that are being dropped.