From e6fe39b0a6ec1eef9dee890177f8aefc501261eb Mon Sep 17 00:00:00 2001 From: withanage Date: Sun, 12 Feb 2023 16:28:26 +0100 Subject: [PATCH] https://github.com/pkp/orcidProfile/issues/229 OrcidProfilePlugin --- OrcidProfilePlugin.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/OrcidProfilePlugin.php b/OrcidProfilePlugin.php index 7efb36d3..9c11da7a 100755 --- a/OrcidProfilePlugin.php +++ b/OrcidProfilePlugin.php @@ -46,10 +46,9 @@ use APP\plugins\generic\orcidProfile\OrcidProfileHanlder; use APP\template\TemplateManager; use Carbon\Carbon; +use GuzzleHttp\Exception\ClientException; use Illuminate\Support\Facades\Mail; -use PKP\components\forms\FieldHTML; use PKP\components\forms\FieldOptions; -use PKP\components\forms\FieldShowEnsuringLink; use PKP\components\forms\FieldText; use PKP\components\forms\publication\ContributorForm; use PKP\config\Config; @@ -62,6 +61,7 @@ use PKP\plugins\Hook; use PKP\plugins\PluginRegistry; use PKP\submission\PKPSubmission; +use Sokil\IsoCodes\IsoCodesFactory; class OrcidProfilePlugin extends GenericPlugin @@ -221,17 +221,14 @@ function addOrcidFormFields($hookName, $form): bool $form->removeField('orcid'); - // add Orcid Field to position 6 $form->addField(new FieldText('orcid', [ 'label' => __('user.orcid'), 'optIntoEdit' => true, 'optIntoEditLabel' => __('common.override'), 'isLabelInline' => true, 'size' => 'normal', - 'showWhen' => 'orcid' - - ]),[FIELD_POSITION_AFTER, 'url']); + ]), [FIELD_POSITION_AFTER, 'url']); $form->addField(new FieldOptions('requestOrcidAuthorization', [ @@ -251,13 +248,12 @@ function addOrcidFormFields($hookName, $form): bool [ 'value' => true, 'label' => __('plugins.generic.orcidProfile.author.deleteORCID'), - + 'showWhen' => 'orcid' ] ] ])); - return Hook::CONTINUE; } @@ -895,7 +891,7 @@ public function manage($args, $request) ORCID_API_URL_MEMBER_SANDBOX => 'plugins.generic.orcidProfile.manager.settings.orcidProfileAPIPath.memberSandbox' ]); - $isoCodes = new \Sokil\IsoCodes\IsoCodesFactory(); + $isoCodes = new IsoCodesFactory(); $countries = array(); foreach ($isoCodes->getCountries() as $country) { $countries[$country->getAlpha2()] = $country->getLocalName(); @@ -1083,7 +1079,7 @@ public function sendSubmissionToOrcid($publication, $request) 'json' => $orcidWork, ] ); - } catch (\GuzzleHttp\Exception\ClientException $exception) { + } catch (ClientException $exception) { $reason = $exception->getResponse()->getBody(false); $this->logInfo("Publication fail: ${reason}"); return new JSONMessage(false);