Skip to content

Commit

Permalink
Fix "not keeping old RELS" (#107)
Browse files Browse the repository at this point in the history
There was plenty wrong here when telling IMI to keep existing RELS-EXT relationships in place:
1.- We were forcing a new RELST-EXT datastream to be created in the batch object by adding the CMODEL
2.- We were opening the door to IMI's getDatastreamsforUpdate to take new RELS EXT in consideration. This unsets any existing RESL datastreams and also only adds CMODEL to the other Update modes.
  • Loading branch information
DiegoPino authored Feb 17, 2020
1 parent 4050c8e commit 4c48f58
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions includes/islandora_multi_batch.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1276,25 +1276,25 @@ class IslandoraMultiBatchObject extends IslandoraBatchObject {
$existing_object = islandora_object_load($this->id);
$relsext_mode = isset($this->preprocessorParameters['object_maping']['relsext_row']['relsext_mode']) ? $this->preprocessorParameters['object_maping']['relsext_row']['relsext_mode'] : 'NEW';
if ($existing_object) {
// just in case i really want to allow Object transmutation?
$this->addContentModelRelationships();

// Copy existing member relationships over;
if ($relsext_mode == 'NEW') {
$this->addContentModelRelationships();
// Sets new member relationships over
$this->setValidRelationshipsforUpdate($existing_object);
// sets scratch inheritance (new ones only)
$this->inheritXacmlPoliciesForUpdate($existing_object);
}
if ($relsext_mode == 'MERGE') {

$this->addContentModelRelationships();
$this->setValidRelationshipsforUpdate($existing_object);
// sets scratch inheritance (new ones only)
$this->inheritXacmlPoliciesForUpdate($existing_object);
$this->copyFedoraRelsUnique($existing_object);
$this->copyOtherRelsUnique($existing_object);
}
if ($relsext_mode == 'JOIN') {

$this->addContentModelRelationships();
$this->setValidRelationshipsforUpdate($existing_object);
// sets scratch inheritance (new ones only)
$this->inheritXacmlPoliciesForUpdate($existing_object);
Expand All @@ -1303,7 +1303,9 @@ class IslandoraMultiBatchObject extends IslandoraBatchObject {
}

if ($relsext_mode == 'OLD') {
// Do nothing.
// We don´t want any RELS DS to be processed.
unset($this['RELS-EXT']);
unset($this['RELS-INT']);
}
}
}
Expand Down

0 comments on commit 4c48f58

Please sign in to comment.