We are moving to Git Issues for bug tracking in future releases. During transition, content will be in both tools. If you'd like to file a new bug, please create an issue.

Bug 7026

Summary: CrossRef plugin uses incorrect publication date for articles
Product: OJS Reporter: James MacGregor <jmacgreg>
Component: Submissions and PublishingAssignee: James MacGregor <jmacgreg>
Status: RESOLVED FIXED    
Severity: normal CC: abadan, afadel97, alec, bretschneider, giovani, pkp-support
Priority: P3    
Version: 2.4.x   
Hardware: All   
OS: All   
Version Reported In: Also Affects:
Attachments: Patch against OJS pre-2.3.7
Patch against ojs-stable-2_4

Description James MacGregor 2012-01-16 17:58:30 PST
The CrossRef plugin appears to use issue->getDatePublished() rather than $article->getDatePublished() for the journal_article... year/month/day nodes.
Comment 1 James MacGregor 2012-01-16 18:00:21 PST
Created attachment 3695 [details]
Patch against OJS pre-2.3.7

I believe the following simple patch fixes the problem, but since this change affects metadata representation I'd prefer if someone (Alec?) could vet and confirm before I commit.
Comment 2 Alec Smecher 2012-01-17 05:00:08 PST
James, that looks fine to me as long as it's been smoke-tested for typos. Go for it.
Comment 3 James MacGregor 2012-01-17 09:35:02 PST
CrossRef uses incorrect publication date for articles
https://github.com/pkp/ojs/commit/e5f419bcbf1f53b1ca4e8ea7ff9605545cf2162e
Comment 4 James MacGregor 2012-01-17 09:35:02 PST
CrossRef plugin uses incorrect publication date for articles
https://github.com/pkp/ojs/commit/a1f15f136acf94125e130871b74339555d7eff6c
Comment 5 James MacGregor 2012-01-17 09:56:55 PST
Thanks, Alec! I tested against a devel and production server, and all looks good.
Comment 6 kreissaege 2012-04-02 02:17:02 PDT
(In reply to comment #5)
> Thanks, Alec! I tested against a devel and production server, and all looks
> good.

Hello,

I'm afraid, that this patch is not correct. For crossref-data the article publication-date is mandatory but with this fix only a article-publication-date is inserted into Crossref-Export File, if this value is set.
There need`s a else condition with
$publicationDateNode =& CrossRefExportDom::generatePublisherDateDom($doc, $issue->getDatePublished());

Best regards
Katrin
Comment 7 Alec Smecher 2012-04-02 08:54:30 PDT
Katrin, are you encountering situations where an article is published (i.e. is available on the public website) but this date is not set?
Comment 8 James MacGregor 2012-04-19 22:07:12 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > Thanks, Alec! I tested against a devel and production server, and all looks
> > good.
> 
> Hello,
> 
> I'm afraid, that this patch is not correct. For crossref-data the article
> publication-date is mandatory but with this fix only a article-publication-date
> is inserted into Crossref-Export File, if this value is set.
> There need`s a else condition with
> $publicationDateNode =& CrossRefExportDom::generatePublisherDateDom($doc,
> $issue->getDatePublished());
> 
> Best regards
> Katrin

Reopening to investigate further -- we've had another report of this being an issue at http://pkp.sfu.ca/support/forum/viewtopic.php?f=2&t=8492&p=33112#p33112.
Comment 9 Alec Smecher 2012-08-31 18:09:59 PDT
Deferring.
Comment 10 Giovani Pieri 2013-09-27 12:22:57 PDT
Hello,

Alec, regarding your question to Katrin whether there were situations where an article is published (i.e. is available on the public website) but its date is not set: we stumbled upon this exact situation in at least 2 different journals. The published_date column in published_articles was NULL in some cases. Thus, the xml exported by OJS was rejected by Crossref because of missing publish date.

We found 2 behaviors that might be causing this issue (note: we did not investigate them thoroughly):
- Articles submitted through quick submit plug-in:
   - datePublished field is not required. Looking at the source code, I believe that if not specified it is set to null.

- In the upgrade process, the 2.3.5_update.xml file runs the following sql for mysql:
		UPDATE published_articles pa, articles a SET pa.date_published = NULL WHERE a.article_id = pa.article_id AND UNIX_TIMESTAMP(pa.date_published) - UNIX_TIMESTAMP(a.date_submitted) < 300 AND UNIX_TIMESTAMP(pa.date_published) - UNIX_TIMESTAMP(a.date_submitted) >= 0
	Thus, setting date_published to NULL.


Regards
Giovani
Comment 11 James MacGregor 2014-01-29 21:56:15 PST
Created attachment 3985 [details]
Patch against ojs-stable-2_4

Hi folks, 

The following patch changes the plugin behaviour to fall back to the issue->getDatePublished() function (tested and working on one ojs-stable-2_4 install). But I'm not sure if it's the best fix for the overall problem, that is that in some cases there are articles without published dates. Alec, any thoughts on this?
Comment 12 Alec Smecher 2014-02-11 15:38:11 PST
James, I think that attachment is consistent with the careful balancing act we figured out for Google Scholar. Please go ahead and commit.
Comment 13 James MacGregor 2014-02-28 15:53:02 PST
Crossref to use published issue date if article date does not exist
https://github.com/pkp/ojs/commit/b6655f607cc73b1d97bbf47279969510311a60e3
Comment 14 James MacGregor 2014-02-28 16:23:02 PST
Crossref to use published issue date if article date does not exist
https://github.com/pkp/ojs/commit/9ae77db636aade14ec60ec970c94e53f57b974d2
Comment 15 James MacGregor 2014-03-12 14:52:03 PDT
Further fix for CrossRef's published issue date issue
https://github.com/pkp/ojs/commit/fa6e3fa750f4d2111e2146f83eab59cb8ea61a4f
Comment 16 James MacGregor 2014-03-12 15:00:03 PDT
Further fix for CrossRef's published issue date issue
https://github.com/pkp/ojs/commit/206cf60b766723a91d14245781225724ad30251a
Comment 17 Giovani Pieri 2014-03-14 15:08:19 PDT
Hi James,

Regarding commits 206cf and fa6e3:

After applying these commits, I exported an XML and it was rejected by Crossref. 

The output of xmllint on this xml was:

xmllint --noout -schema crossref4.3.0.xsd crossref.xml

	> crossref.xml:60: element pages: Schemas validity error : Element '{http://www.crossref.org/schema/4.3.0}pages': This element is not expected. Expected is ( {http://www.crossref.org/schema/4.3.0}publication_date ).
	> crossref.xml:117: element pages: Schemas validity error : Element '{http://www.crossref.org/schema/4.3.0}pages': This element is not expected. Expected is ( {http://www.crossref.org/schema/4.3.0}publication_date ).
	> crossref.xml:170: element pages: Schemas validity error : Element '{http://www.crossref.org/schema/4.3.0}pages': This element is not expected. Expected is ( {http://www.crossref.org/schema/4.3.0}publication_date ).
	> crossref.xml:211: element pages: Schemas validity error : Element '{http://www.crossref.org/schema/4.3.0}pages': This element is not expected. Expected is ( {http://www.crossref.org/schema/4.3.0}publication_date ).
	> crossref.xml:268: element pages: Schemas validity error : Element '{http://www.crossref.org/schema/4.3.0}pages': This element is not expected. Expected is ( {http://www.crossref.org/schema/4.3.0}publication_date ).
	> crossref.xml:325: element pages: Schemas validity error : Element '{http://www.crossref.org/schema/4.3.0}pages': This element is not expected. Expected is ( {http://www.crossref.org/schema/4.3.0}publication_date ).
	> crossref.xml fails to validate

It seems that "publication_date" in "articles" is never generated regardless of the 
content of $article->getDatePublished() because XMLCustomWriter::appendChild($journalArticleNode, $publicationDateNode) was deleted. Right?

And, one question: why was the fall back to the issue->getDatePublished() function removed in these two commits? Any particular reason?


Best regards
Giovani
Comment 18 James MacGregor 2014-03-24 20:50:03 PDT
Further fix for CrossRef's published issue date issue
https://github.com/pkp/ojs/commit/1072749a13fbfc010b14d942218666ad588326e0
Comment 19 James MacGregor 2014-03-24 20:52:25 PDT
Hi Giovanni, 

Thanks for the additional comment -- not sure how I managed to bork this twice in a row, but there you have it. I just tested the fix you'll see here shortly with a production/test corpus, and the publication date issue now seems to be sorted. Can you test and let me know? 

NB: I'm going to be adding some additional items to the CrossRef export plugin over the next week, as part of our OJS 2.4.4 release. If you are interested in testing, please drop me a line at jmacgreg@gmail.com, and I can send you the relevant commits. Any attention you can spare here would be most welcome. 

Cheers, 
James
Comment 20 James MacGregor 2014-03-24 20:54:02 PDT
Further fix for CrossRef's published issue date issue
https://github.com/pkp/ojs/commit/a65ea054e5164949cecba0bb32cf4aac4cd5cccf
Comment 21 Giovani Pieri 2014-03-27 05:57:04 PDT
Hi James

(In reply to James MacGregor from comment #19)
> Thanks for the additional comment -- not sure how I managed to bork this
> twice in a row, but there you have it. I just tested the fix you'll see here
> shortly with a production/test corpus, and the publication date issue now
> seems to be sorted. Can you test and let me know? 

Sure. Works for me now. 


Thanks
Giovani
Comment 22 James MacGregor 2014-04-09 22:07:03 PDT
re-re-fixing CrossRef published date issue
https://github.com/pkp/ojs/commit/d487b5dd7e4323ade8588f1c73af020939a1bffb
Comment 23 James MacGregor 2014-04-09 22:13:03 PDT
re-re-fixing CrossRef published date issue
https://github.com/pkp/ojs/commit/d7746114611b43d195536b413765e6f0b55825ed