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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

St_B created an issue. See original summary.

Alan D.’s picture

Two 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;

Status: Needs review » Needs work

The last submitted patch, 2: biblio-2832502-2-separate-multiple-resources.patch, failed testing. View results

Toki’s picture

Still 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 :

File to patch: biblio.crossref.client.php
patching file biblio.crossref.client.php
Hunk #1 FAILED at 279.
Hunk #2 FAILED at 311.
2 out of 2 hunks FAILED -- saving rejects to file biblio.crossref.client.php.rej

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?

Toki’s picture

After 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.