AtoM sometimes creates the same terms on the fly repeatedly during import
|Assignee:||Dan Gillean||% Done:|
|Target version:||Release 2.2.0|
|Google Code Legacy ID:||Tested version:||2.2|
1. Create a test CSV with a 'descriptionStatus' column
2. Fill in a few test rows, all using a new, identical custom descriptionStatus such as "Disclosure"
3. Attempt a CLI import with csv:import
For each row in the import, it will display the same notice: "Term Disclosure not found in description status taxonomy, creating it..."
- Every row that uses this description status creates a new, duplicate term for "Disclosure", and doesn't reuse the existing term that was previously created!
After the custom description status is created once, subsequent rows should attach to the existing, newly created term instead of duplicating it in a new one.
An example of the offending code is here: https://github.com/artefactual/atom/blob/dev/issue-5466-asa-timeouts/lib/task/import/csvImportTask.class.php#L479-L494
The issue is $self->status['descriptionStatusTypes'] is only ever loaded at the beginning of the import, so it will not include the newly created term in it for subsequent rows to look up. We'll need to re-load the terms into that variable after each time we create a new term.
Note we use similar code for a few other taxonomies too throughout the code, so we'll need to create a fix that applies to those too.