From 13d2df7f4f2ba37281a575bcd7aabb23604c3d8a Mon Sep 17 00:00:00 2001 From: Johanna Date: Mon, 24 Jul 2017 16:27:47 -0300 Subject: [PATCH] Fix the check for loaded MODS datastream. --- includes/utilities.inc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/includes/utilities.inc b/includes/utilities.inc index 48e78b7..deeaeba 100644 --- a/includes/utilities.inc +++ b/includes/utilities.inc @@ -178,9 +178,8 @@ function islandora_newspaper_group_issues(array $issues) { function islandora_newspaper_get_date_issued_from_mods(AbstractDatastream $datastream) { $out = FALSE; $dom = new DOMDocument(); - $dom->loadXML($datastream->content); - $xpath = new DomXPath($dom); - if ($dom) { + if ($dom->loadXML($datastream->content)) { + $xpath = new DomXPath($dom); $xpath->registerNamespace('ns', 'http://www.loc.gov/mods/v3'); // Assumes the canonical date issued exists in the first mods document under // origin info and is not specified as a point, additional logic could be @@ -310,9 +309,8 @@ EOQ; function islandora_newspaper_set_mods_date_issued(AbstractDatastream $datastream, DateTime $date) { $out = FALSE; $dom = new DOMDocument(); - $dom->loadXML($datastream->content); - $xpath = new DomXPath($dom); - if ($dom) { + if ($dom->loadXML($datastream->content)) { + $xpath = new DomXPath($dom); $xpath->registerNamespace('ns', 'http://www.loc.gov/mods/v3'); // Assumes the canonical date issued exists in the first mods document under // origin info and is not specified as a point, additional logic could be