Skip to content

Commit

Permalink
pkp#229 OrcidProfilePlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
withanage committed Feb 12, 2023
1 parent ef9e751 commit e6fe39b
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions OrcidProfilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -62,6 +61,7 @@
use PKP\plugins\Hook;
use PKP\plugins\PluginRegistry;
use PKP\submission\PKPSubmission;
use Sokil\IsoCodes\IsoCodesFactory;


class OrcidProfilePlugin extends GenericPlugin
Expand Down Expand Up @@ -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', [
Expand All @@ -251,13 +248,12 @@ function addOrcidFormFields($hookName, $form): bool
[
'value' => true,
'label' => __('plugins.generic.orcidProfile.author.deleteORCID'),

'showWhen' => 'orcid'
]
]
]));



return Hook::CONTINUE;
}

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e6fe39b

Please sign in to comment.