Skip to content

Commit

Permalink
Fix bug on dataset creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ianlamb77 committed Dec 6, 2017
1 parent d94b326 commit cd9f15a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/AppBundle/EventListener/DatasetEditListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ public function recordEdit($dataset, $em, $uow, $entityAlreadyExists = false)
} elseif ($previousValue == true && $newValue != true) {
// this means we are unarchiving it
$edit->setEditType("unarchived");
} elseif (!$entityAlreadyExists) {
// if we're setting the 'archived' value on initial dataset entry
$edit->setEditType("created");
}
// if not archiving, check if this is an update to existing dataset
// if 'archived' isn't being set in this call, we're almost certainly updating an existing entry
} elseif ($entityAlreadyExists) {
$edit->setEditType("updated");
// if not, must be a brand new one
} else {
$edit->setEditType("created");
}
}

// record any notes on this edit
if (array_key_exists('archival_notes', $changeset)) {
Expand Down

0 comments on commit cd9f15a

Please sign in to comment.