fixed reading transactions and category deletion

This commit is contained in:
Finn 2018-01-16 14:47:17 +00:00
parent f79ec09782
commit 5ad83795bd
3 changed files with 3 additions and 1 deletions

View file

@ -84,6 +84,7 @@ sub delete {
my $id = $c->param('id');
if ( my $category = $c->result_set->find($id) ) {
$category->transaction_category->delete;
$category->delete;
$c->flash( success => 'Category Deleted' );
} else {

View file

@ -54,6 +54,7 @@ sub delete {
my $id = $c->param('id');
if ( my $transaction = $c->result_set->find($id) ) {
$transaction->category->delete;
$transaction->delete;
$c->flash( success => 'Successfully deleted transaction' );
$c->redirect_to( '/admin/transactions' );

View file

@ -36,7 +36,7 @@
</div>
<div class="form-group">
<label for="text">Category</label>
<input id="category" type="text" class="form-control" placeholder="No Category" name="category" value="<%= $transaction->category->category->name %>" disabled>
<input id="category" type="text" class="form-control" placeholder="Uncategorised" name="category" value="<%= defined $transaction->category ? $transaction->category->category->name : 'Uncategorised' %>" disabled>
</div>
<div class="form-group">
<label for="submitted_at">Submitted At</label>