From cd4f13bf8c3f6d06fd9b0fa6b0e42b90d14273f4 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 17 Jan 2018 17:36:55 +0000 Subject: [PATCH] Fixed transaction ID edit --- lib/Pear/LocalLoop/Controller/Admin/Categories.pm | 2 ++ templates/admin/categories/read.html.ep | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Admin/Categories.pm b/lib/Pear/LocalLoop/Controller/Admin/Categories.pm index c4aceeb..00d2e46 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Categories.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Categories.pm @@ -57,6 +57,7 @@ sub read { sub update { my $c = shift; my $validation = $c->validation; + $validation->required('id'); $validation->required('category', 'trim')->like(qr/^[\w]*$/); my $id = $c->param('id'); @@ -67,6 +68,7 @@ sub update { $c->redirect_to( '/admin/categories/' . $id ); } elsif ( my $category = $c->result_set->find($id) ) { $category->update({ + id => $validation->param('id'), name => $validation->param('category'), }); $c->flash( success => 'Category Updated' ); diff --git a/templates/admin/categories/read.html.ep b/templates/admin/categories/read.html.ep index 3bf7ed3..f409807 100644 --- a/templates/admin/categories/read.html.ep +++ b/templates/admin/categories/read.html.ep @@ -18,8 +18,8 @@
- -

Do not change the ID unless absolutely necessary.

+ +

Do not change the ID unless absolutely necessary. This will result in an error reading as it can no longer find it from the same ID.