Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Importing data by DOI
Sometimes several url go in biblio_url field. When you save, it is impossible and the message is : biblio_url cannot be longer than 255 characters but is currently 262 characters long.
It seems that the mapping between "resource", which contains urls in the crossref xml, and biblio_url, cannot be modified by the UI admin : it is written in the php parser.
Only one "resource" should go in the biblio_url, to avoid this bug.
Comment | File | Size | Author |
---|---|---|---|
#4 | biblio.crossref.client.php_.txt | 1.79 KB | Toki |
#2 | biblio-2832502-2-separate-multiple-resources.patch | 1.92 KB | Alan D. |
Comments
Comment #2
Alan D. CreditAttribution: Alan D. commentedTwo issues, one is the the URLs get concatenated and the second is that the limit of 255 was exceeded and a PDO exception occurred.
So I added a separator option and also a limit check. if you cut off any of the 4 variables they become meaningless (DOI, ISSN, ISBN, URL), so all are excluded if they are too long.
I used a semi-colon (;) to separate URLs / resources, commas otherwise, albeit unlikely that these (DOI, ISSN, ISBN) would ever have multiple values...
And I've blindly used this biblio_url, so made sense to provide an option to only accept one URL :) No interface, but users can run this code once.
variable_set('biblio_crossref_allow_multiple_resources', 0);
Or update their settings.php file
$conf['biblio_crossref_allow_multiple_resources'] = 0;
Comment #4
TokiStill having this problem here, when importing reference with DOI, the URL is concatenated (e.g. https://linkinghub.elsevier.com/retrieve/pii/S0269749117320572https://ap...) and obviously the link is broken. When it is longer than 255, the import fails.
I have just tried to patch the biblio.crossref.client.php file and I got :
I have attached the rej file, if needed (but if I am right, everything is rejected)
Adding the conf line in settings.php (and clear caches) did not help either, unfortunately.
I am afraid this is still a major issue, my clients can not import references through DOI (if limit exceeded) and, if the import is successful, they get a long and broken link in the URL field.
Does someone have any solution here?
Comment #5
TokiAfter many tests, I have managed to make it work by adding lines manually in biblio.crossref.client.php, notably those about biblio_url (indeed, DOI, ISBN and ISSN are unique originally). The line $conf in settings.php was needed also. Finally, with both updates, the DOI import has worked and the biblio_url displays only one valid URL. Thanks for the code.