[OJS3.3.0-6] DOI plugin is not generating DOI from %x custom pattern (URL path)

Because back in 2.4.8 we used this field of issue and paper as “Custom DOI field” where patten was %x for the DOI plugin and crossref to deposit.

Also this field by default will affect the final URL of the published issue & paper.

Our format before was: xxx.1.1

In current OJS we are not allow to input this value.

So I changed these files:
\lib\pkp\schemas\context.json
“urlPath”: {
“type”: “string”,
“validation”: [
“regex:/^[a-zA-Z0-9]+([\-_.][a-zA-Z0-9]+)*$/”
],
“apiSummary”: true
}

\controllers\grid\issues\form\IssueForm.inc.php

$this->addCheck(new FormValidatorRegExp($this, ‘urlPath’, ‘optional’, ‘validator.alpha_dash’, ‘/^[a-zA-Z0-9]+([\-_.][a-zA-Z0-9]+)*$/’));

\controllers\grid\issues\form\IssueGalleyForm.inc.php
$this->addCheck(new FormValidatorRegExp($this, ‘urlPath’, ‘optional’, ‘validator.alpha_dash’, ‘/^[a-zA-Z0-9]+([\-_.][a-zA-Z0-9]+)*$/’));

With above 3 changes i am now able to put xxxx.1.1 into the url Path field in either create issue panel and edit issue panel. I was happy.

Then i want to make submmison workflow#publication panel - Issue tab to be the same to add url path for articles.
I changed:

\controllers\grid\articleGalleys\form\ArticleGalleyForm.inc.php
$this->addCheck(new FormValidatorRegExp($this, ‘urlPath’, ‘optional’, ‘validator.alpha_dash’, ‘/^[a-zA-Z0-9]+([\-_.][a-zA-Z0-9]+)*$/’));

Update:
Found the last reg expression in:

\lib\pkp\schemas\publication.json

	"urlPath": {
		"type": "string",
		"description": "An optional path to use in the URL instead of the ID.",
		"validation": [
			"nullable",
			"regex:/^[a-zA-Z0-9]+([\\-_.][a-zA-Z0-9]+)*$/"
		]

So with above changes all field can input dots now.

My question is: DOI plugin is not generating new DOI using the url path field value:

Use the pattern entered below to generate DOI suffixes. Use %j for journal initials, %v for the volume number, %i for the issue number, %Y for the year, %a for the OJS article ID, %g for the OJS galley ID, %f for the OJS file ID, %p for the page number and %x for "Custom Identifier".

%x 

Current warning is:  You can not generate a DOI because one or more parts of the DOI pattern are missing data. You may need to assign the publication to an issue, set a publisher ID or enter page numbers.

So i assume %x does not read from URL path slot anymore. Which field does it read from now?

Also crossref plugin seems does not support register by whole issue, why is that?

Thanks

Stanley

Update:
Found the last reg expression in:

\lib\pkp\schemas\publication.json

	"urlPath": {
		"type": "string",
		"description": "An optional path to use in the URL instead of the ID.",
		"validation": [
			"nullable",
			"regex:/^[a-zA-Z0-9]+([\\-_.][a-zA-Z0-9]+)*$/"
		]

Now all field can be input with dots.

But i still can not figure it out where does doi plugin read the %x pattern.

Update:

Trying to change

/classes/plugins/PubIdPlugin.inc.php

		case 'pattern':
			$suffixPatternsFieldNames = $this->getSuffixPatternsFieldNames();
			$pubIdSuffix = $this->getSetting($contextId, $suffixPatternsFieldNames[$pubObjectType]);

			// %j - journal initials, remove special characters and uncapitalize
			$pubIdSuffix = PKPString::regexp_replace('/%j/', PKPString::regexp_replace('/[^A-Za-z0-9]/', '', PKPString::strtolower($context->getAcronym($context->getPrimaryLocale()))), $pubIdSuffix);

			// %x - custom identifier
			if ($pubObject->getStoredPubId('publisher-id')) {
				$pubIdSuffix = PKPString::regexp_replace('/%x/', $pubObject->getStoredPubId('publisher-id'), $pubIdSuffix);
			
			}

			// %u - url Path
			if ($pubObject->getStoredPubId('urlPath')) {
				$pubIdSuffix = PKPString::regexp_replace('/%u/', $pubObject->getStoredPubId('url-path'), $pubIdSuffix);
			
			}

			if ($issue) {
				// %v - volume number
				$pubIdSuffix = PKPString::regexp_replace('/%v/', $issue->getVolume(), $pubIdSuffix);
				// %i - issue number
				$pubIdSuffix = PKPString::regexp_replace('/%i/', $issue->getNumber(), $pubIdSuffix);
				// %Y - year
				$pubIdSuffix = PKPString::regexp_replace('/%Y/', $issue->getYear(), $pubIdSuffix);
			}

			if ($submission) {
				// %a - article id
				$pubIdSuffix = PKPString::regexp_replace('/%a/', $submission->getId(), $pubIdSuffix);
				// %p - page number
				if ($submission->getPages()) {
					$pubIdSuffix = PKPString::regexp_replace('/%p/', $submission->getPages(), $pubIdSuffix);
				}

			}

			if ($representation) {
				// %g - galley id
				$pubIdSuffix = PKPString::regexp_replace('/%g/', $representation->getId(), $pubIdSuffix);
			}

			if ($submissionFile) {
				// %f - file id
				$pubIdSuffix = PKPString::regexp_replace('/%f/', $submissionFile->getId(), $pubIdSuffix);
			}

			break;

But by change here does not effect the site at all. I assume there must be somewhere elses holding the old pattern settings.

Trying to bring up “url_path” field to replace current non-working “public_id”

Can anyone help please?

Hi @mapress888,

Somehow I do not understand what is the exact problem :frowning: Could you please try to explain it, e.g. all the necessary steps that I should make so that I can reproduce the problem in my local installation? What exactly you can not do in the last release?

Thanks and best!
Bozana

Sorry about my English.

So back in 2.4.8 doi plugin can use %x pattern to generate DOI of article/issue from the self input field (like in 3.3 to choose the individual doi option.) but besides of that it also rewrite the article url . so one colume changes two things - doi and url.

What i want to acheve now is extracly that. i want to use the custom url field in 3.3 as %x pattern in doi plugin.

@mapress888, I will take a look and come back to you… Thanks!

Hi @mapress888,

It seems now there is the Publisher ID (used for DOIs) and Path URL (used for the URLs) – they are now separated. The Publisher ID has to be enabled under Settings > Workflow > Submission > Metadata > Publisher ID. Path URL form field is per default there for all the objects (issue, submission, galley).
Thus, you would need to enter both and they both would be the same.
Does that solve it for you?

Best,
Bozana

Thanks for your Reply.

That is how we did now. - instead, fill 1 column we now fill 2.