Skip to content

Commit

Permalink
more delete issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Duggan committed Aug 13, 2015
1 parent e5e976e commit 7f22083
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/Tuba/Book.pm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ sub update {
$map->save(audit_user => $c->audit_user, audit_note => $c->audit_note) or return $c->update_error($map->error);
}
}
$book->delete;
$book->delete(audit_user => $c->audit_user, audit_note => $c->audit_note);
return $c->redirect_to( $report->uri($c, { tab => 'show' } ) );
}
$c->SUPER::update(@_);
Expand Down
2 changes: 1 addition & 1 deletion lib/Tuba/Instrument.pm
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ sub update_rel {
platform_identifier => $platform_id,
instrument_identifier => $instrument->identifier)->load(
speculative => 1) or return $c->redirect_without_error("Could not find $platform_id");
$map->delete or return $c->update_error($map->error);
$map->delete(audit_user => $c->audit_user, audit_note => $c->audit_note) or return $c->update_error($map->error);
$c->flash(info => "Deleted $platform_id");
}
return $c->SUPER::update_rel(@_);
Expand Down
2 changes: 1 addition & 1 deletion lib/Tuba/Lexicon.pm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sub update_rel {
logger->info("deleting $lexicon $context $term");
my $ex = Exterm->new(lexicon => $lexicon, term => $term, context => $context);
$ex->load(speculative => 1) or next;
$ex->delete or return $c->update_error($ex->error);
$ex->delete(audit_user => $c->audit_user, audit_note => $c->audit_note) or return $c->update_error($ex->error);
}
}
return $c->redirect_without_error('update_rel_form');
Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/Organization.pm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ sub update_rel {
organization_relationship_identifier => $type
);
$map->load(speculative => 1) or return $c->update_error("relationship not found");
$map->delete(audit_user => $c->audit_user) or return $c->update_error($map->error);
$map->delete(audit_user => $c->audit_user), audit_note => $c->audit_note or return $c->update_error($map->error);
$c->stash(info => "Saved changes.");
}

Expand Down Expand Up @@ -181,7 +181,7 @@ sub merge {
{ organization_identifier => $other->identifier},
{ organization_identifier => $org->identifier })
or die $dbs->errstr;
$org->delete(audit_user => $c->audit_user);
$org->delete(audit_user => $c->audit_user, audit_note => $c->audit_note);
$dbs->commit or die $dbs->error;
};
if ($@) { return $c->update_error($@) }
Expand Down
4 changes: 2 additions & 2 deletions lib/Tuba/Platform.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ sub update_rel {
if (my $del = $json->{del}) {
$del->{platform_identifier} = $platform->identifier;
my $obj = InstrumentInstance->new( %$del );
$obj->delete;
$obj->delete(audit_user => $c->audit_user, audit_note => $c->audit_note);
}
}
if (my $instrument_id = $c->param('delete_map_instruments')) {
my $map = Tuba::DB::Object::InstrumentInstance->new(
platform_identifier => $platform->identifier,
instrument_identifier => $instrument_id)->load(
speculative => 1) or return $c->redirect_without_error("Could not find $instrument_id");
$map->delete or return $c->update_error($map->error);
$map->delete(audit_user => $c->audit_user, audit_note => $c->audit_note) or return $c->update_error($map->error);
$c->flash(info => "Deleted $instrument_id");
}
$c->SUPER::update_rel(@_);
Expand Down
6 changes: 3 additions & 3 deletions lib/Tuba/Reference.pm
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ sub post_update {
my $s = PublicationReferenceMap->new(reference_identifier => $reference->identifier, publication_id => $pub_id);
next unless $s->publication->publication_type_identifier eq $cat;
$s->load(speculative => 1) or next;
$s->delete or do { $reference->error($s->error); return 0; };
$s->delete(audit_user => $c->audit_user, audit_note => $c->audit_note) or do { $reference->error($s->error); return 0; };
}
return 1;
}
Expand Down Expand Up @@ -258,7 +258,7 @@ sub update_rel {
};
my $sub = PublicationReferenceMap->new(reference_identifier => $reference->identifier, publication_id => $pub->id);
$sub->load(speculative => 1) or return $c->redirect_with_error(update_rel_form => "$pub not found");
$sub->delete or return $c->reply->exception($sub->error);
$sub->delete(audit_user => $c->audit_user, audit_note => $c->audit_note) or return $c->reply->exception($sub->error);
}

return $c->render(json => { status => 'ok'});
Expand Down Expand Up @@ -295,7 +295,7 @@ sub update_rel {
if (my $which = $c->param('delete_publication')) {
my $sub = PublicationReferenceMap->new(reference_identifier => $reference->identifier, publication_id => $which);
$sub->load(speculative => 1) or return $c->redirect_with_error(update_rel_form => "$sub not found");
$sub->delete(audit_user => $c->audit_user) or return $c->redirect_with_error(update_rel_form => $sub->error);
$sub->delete(audit_user => $c->audit_user, audit_note => $c->audit_note) or return $c->redirect_with_error(update_rel_form => $sub->error);
$c->stash(message => "saved changes");
}
$c->redirect_without_error('update_rel_form');
Expand Down
2 changes: 1 addition & 1 deletion lib/Tuba/Table.pm
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ sub update_rel {
my $array = Array->new(identifier => $id);
$array->load;
if (!@{ $array->tables }) {
$array->delete;
$array->delete(audit_user => $c->audit_user, audit_note => $c->audit_note);
$c->flash(message => 'Deleted array');
} else {
$c->flash(message => 'Deleted array for this table');
Expand Down

0 comments on commit 7f22083

Please sign in to comment.