From ad30cf9cd9a3cf0ac3c59b3c9490cfbf0849e8a3 Mon Sep 17 00:00:00 2001 From: Finn Date: Tue, 16 Jan 2018 14:47:17 +0000 Subject: [PATCH] fixed reading transactions and category deletion --- lib/Pear/LocalLoop/Controller/Admin/Categories.pm | 1 + lib/Pear/LocalLoop/Controller/Admin/Transactions.pm | 1 + templates/admin/transactions/read.html.ep | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Pear/LocalLoop/Controller/Admin/Categories.pm b/lib/Pear/LocalLoop/Controller/Admin/Categories.pm index e0f1eb0..c4aceeb 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Categories.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Categories.pm @@ -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 { diff --git a/lib/Pear/LocalLoop/Controller/Admin/Transactions.pm b/lib/Pear/LocalLoop/Controller/Admin/Transactions.pm index 428fdf9..d1e5c0a 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Transactions.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Transactions.pm @@ -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' ); diff --git a/templates/admin/transactions/read.html.ep b/templates/admin/transactions/read.html.ep index 0b180ae..98b45e4 100644 --- a/templates/admin/transactions/read.html.ep +++ b/templates/admin/transactions/read.html.ep @@ -36,7 +36,7 @@
- +