CSV import - publication status value not imported
|Assignee:||Dan Gillean||% Done:|
|Target version:||Release 2.1.0|
|Google Code Legacy ID:||Tested version:|
As Dan mentioned in #6035, in both 1.3.1 and 2.x, if publicationStatus is populated in the CSV file, an error is returned like:
Publication status: 'Published' is invalid. Using default.
The same error is returned if "Published" is changed to "published". (Similarly for draft/Draft)
The issue boils down to the case of the publication status, in particular around line 453 of lib/task/import/csvImportTask.class.php
$pubStatusTermId = array_search(
Changing ucwords to strtolower seems to resolve the error. So does changing "draft" to "Draft" and "published" to "Published" in term_i18n.
I didn't dig into the code for the UI import, but the same error occurs there as well as with the command line.
It turns out there is a mix of cases for publication status, depending on the language. In English, both are lowercase, which led to this error (published != Published). In fact in French and Italian, one term is lowercase and the other is uppercase. So making the database values consistent is probably the best fix.
#3 Updated by Dan Gillean about 8 years ago
- Status changed from New to QA/Review
It seems that this may have gotten fixed along the way, as part of other work? Requires further testing to verify. Imports using RAD CSV template will accept both "published" and "Published" now. We should test "draft" vs "Draft" in an AtoM instance where the default pub status is set to "published", and we should verify that the behavior is the same with the ISAD CSV template.
#4 Updated by Tim Hutchinson about 8 years ago
I think this may work on fresh installs but not sites upgraded from 1.x.
On our current test site (probably about a month out of date), I still got the warnings, and there are still inconsistent cases in term_i18n.
But looking at data/fixtures/taxonomyTerms.yml, the case is correct (Draft, Published etc. all title case). On a fresh install, it's correct in the database (I didn't test an import but there's no reason it's shouldn't work). This hasn't changed since the initial commit, which is why I'm thinking something needs to be added to the upgrade task - I'm not sure how changes to fixtures would normally be handled.
#5 Updated by Dan Gillean almost 8 years ago
- Status changed from QA/Review to Feedback
- Target version changed from Release 2.0.2 to Release 2.1.0
Please see Tim's comments above - any way we can make sure this gets added to the upgrade task(s) for 2.1 release, so we don't constantly have this problem being reported by users who have a previous install?
#9 Updated by Jesús García Crespo over 7 years ago
- Status changed from Feedback to In progress
- Assignee changed from Mike Gale to Jesús García Crespo
I'm just going to change the code so the search is case insensitive.
#11 Updated by Dan Gillean over 7 years ago
- Status changed from QA/Review to Verified
Tested a CSV import that included:
...as various publicationStatus values. All imported properly, without warnings, and with the correct publication status. I'm not going to test installing a 1.x instance and upgrading it and seeing if the issue is resolved, but since the import works, and since it no longer matters how the terms are cased for the match, I think this should solve the issue.