Fixed transaction ID edit
This commit is contained in:
parent
06e4345927
commit
25f9d818f8
2 changed files with 4 additions and 2 deletions
|
@ -57,6 +57,7 @@ sub read {
|
||||||
sub update {
|
sub update {
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
my $validation = $c->validation;
|
my $validation = $c->validation;
|
||||||
|
$validation->required('id');
|
||||||
$validation->required('category', 'trim')->like(qr/^[\w]*$/);
|
$validation->required('category', 'trim')->like(qr/^[\w]*$/);
|
||||||
|
|
||||||
my $id = $c->param('id');
|
my $id = $c->param('id');
|
||||||
|
@ -67,6 +68,7 @@ sub update {
|
||||||
$c->redirect_to( '/admin/categories/' . $id );
|
$c->redirect_to( '/admin/categories/' . $id );
|
||||||
} elsif ( my $category = $c->result_set->find($id) ) {
|
} elsif ( my $category = $c->result_set->find($id) ) {
|
||||||
$category->update({
|
$category->update({
|
||||||
|
id => $validation->param('id'),
|
||||||
name => $validation->param('category'),
|
name => $validation->param('category'),
|
||||||
});
|
});
|
||||||
$c->flash( success => 'Category Updated' );
|
$c->flash( success => 'Category Updated' );
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="category-id">Token ID</label>
|
<label for="category-id">Token ID</label>
|
||||||
<input id="category-id" type="text" class="form-control" placeholder="Token ID" name="category" value="<%= $category->id %>">
|
<input id="category-id" type="text" class="form-control" placeholder="Token ID" name="id" value="<%= $category->id %>">
|
||||||
<p class="help-block">Do not change the ID unless <strong>absolutely</strong> necessary.</p>
|
<p class="help-block">Do not change the ID unless <strong>absolutely</strong> necessary. This will result in an error reading as it can no longer find it from the same ID.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button class="btn btn-primary form-control" type="submit">Update</button>
|
<button class="btn btn-primary form-control" type="submit">Update</button>
|
||||||
|
|
Reference in a new issue