You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When the orcidAuthorize handler method is run, the public API is called to fetch information about the authenticated ORCID user, including any employment information.
The affiliation field on the OJS registration form is supposed to be filled with the following information from an associative array returned from the /employments ORCID endpoint $employmentJson['employment-summary'][0]['organization']['name'], but the key of employment-summary is not included.
See PHP generated warning:
PHP Warning: Undefined array key "employment-summary" in [path-to-ojs]/plugins/generic/orcidProfile/OrcidProfileHandler.php on line 166
To confirm:
Is this happening all the time or only when certain information is missing?
Did the response returned from the /employments endpoint change and does the corresponding OJS code need to be updated?
Additional context
Observed in OJS 3.4, but likely an issue in previous versions.
The text was updated successfully, but these errors were encountered:
I had the same problem but I think I solved it.
I'm using the orcidProfile 3.3.0 with OJS 3.3.0.10.
I have already checked on the most updated github versions of the plugin and the bug persists.
I found two problems:
the response variable is not re-assigned and therefore it keeps the Json array of the person and not that of the employment
the decode of the Json array of the employment does not take into account the correct structure of the array,
the current code expects:
['employment-summary'][0]['organization']['name']
but the structure of the array that is returned is the following:
['affiliation-group'][0]['summaries'][0]['employment-summary']['organization']['name']
My solution (version 3.3.0)
problem 1
file:
/orcidProfile/pages/OrcidHandler.inc.php
line 117 is: $httpClient->request(
but it must be: $response = $httpClient->request(
(since the variable is not reassigned, it retains the previously loaded Json array)
problem 2
file /orcidProfile/pages/OrcidHandler.inc.php
line 140 is: opener.document.getElementById("affiliation").value = ' . json_encode(@$employmentJson['employment-summary'][0]['organization']['name']) . ';
but it must be: opener.document.getElementById("affiliation").value = ' . json_encode(@$employmentJson['affiliation-group'][0]['summaries'][0]['employment-summary']['organization']['name']) . ';
(to extract data from the working architecture)
I made these two corrections and it works for me, if needed I can do the pull-request.
I found the same problems on version 3.4.0 but the file involved is:
/orcidProfile/OrcidProfileHandler.php
line 148 and line 173
Thanks @Nostrabramus for confirming this! I've confirmed and addressed this in the big refactor the ORCID plugin just went through (on the main branch), but will get this changed ported back to OJS 3.3 and 3.4.
Describe the bug
When the
orcidAuthorize
handler method is run, the public API is called to fetch information about the authenticated ORCID user, including any employment information.The affiliation field on the OJS registration form is supposed to be filled with the following information from an associative array returned from the
/employments
ORCID endpoint$employmentJson['employment-summary'][0]['organization']['name']
, but the key ofemployment-summary
is not included.See PHP generated warning:
To confirm:
/employments
endpoint change and does the corresponding OJS code need to be updated?Additional context
Observed in OJS 3.4, but likely an issue in previous versions.
The text was updated successfully, but these errors were encountered: