diff --git a/CollectionClass.inc b/CollectionClass.inc index 4ac57178..6c5fd8f5 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -519,6 +519,7 @@ class CollectionClass { $show_batch_tab = FALSE; $policy = CollectionPolicy::loadFromCollection($this->pid, TRUE); + if(!empty($policy)){ $content_models = $policy->getContentModels(); } @@ -528,7 +529,7 @@ class CollectionClass { if (!$show_ingest_tab) { $view_selected = TRUE; } - if(!$collection_items){ + if (!$collection_items) { $view_selected = FALSE; $add_selected = TRUE; } @@ -540,7 +541,6 @@ class CollectionClass { '#title' => 'View', '#selected' => $view_selected, '#content' => $collection_items, - ); $tabset['add_tab'] = array( '#type' => 'tabpage', @@ -616,7 +616,7 @@ class CollectionClass { $collectionName = $collection; - + if (!$pageNumber) { $pageNumber = 1; } diff --git a/CollectionPolicy.inc b/CollectionPolicy.inc index be9e7a92..5a3daf21 100644 --- a/CollectionPolicy.inc +++ b/CollectionPolicy.inc @@ -360,13 +360,14 @@ class CollectionPolicy extends XMLDatastream { * @param string $dsid * @return string $nextPid */ - public function getNextPid($dsid) { + public function getNextPid($dsid, $content_model = null) { $ret = FALSE; + if (self::valid_dsid($dsid) && $this->validate()) { $content_models = $this->xml->getElementsByTagName('content_models')->item(0)->getElementsByTagName('content_model'); $namespace = FALSE; for ($i = 0; $namespace === FALSE && $i < $content_models->length; $i++) { - if (strtolower($content_models->item($i)->getAttribute('dsid')) == strtolower($dsid)) { + if (strtolower($content_models->item($i)->getAttribute('dsid')) == strtolower($dsid) && (strtolower($content_models->item($i)->getAttribute('pid') == $content_model) || $content_model == null)) { $namespace = $content_models->item($i)->getAttribute('namespace'); } }