From e524f1d42189c18ca6cc2952d6d799a8c4ccfbca Mon Sep 17 00:00:00 2001 From: Finn Date: Thu, 18 Jan 2018 14:24:47 +0000 Subject: [PATCH] fixed to admin interface categories & stats --- lib/Pear/LocalLoop/Controller/Admin/Categories.pm | 2 +- lib/Pear/LocalLoop/Controller/Api/Stats.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Admin/Categories.pm b/lib/Pear/LocalLoop/Controller/Admin/Categories.pm index f5ec913..529239c 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Categories.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Categories.pm @@ -19,7 +19,7 @@ sub create { my $c = shift; my $validation = $c->validation; - $validation->required('category', 'trim')->like(qr/^[\w]*$/)->not_in_resultset('name', $c->result_set); + $validation->required('category', 'trim')->not_in_resultset('name', $c->result_set); my $category_name = $validation->param('category'); diff --git a/lib/Pear/LocalLoop/Controller/Api/Stats.pm b/lib/Pear/LocalLoop/Controller/Api/Stats.pm index 8545406..cd348c3 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Stats.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Stats.pm @@ -93,7 +93,7 @@ sub post_customer { my @all_weeks = $week_transaction_rs->all; my $first = $all_weeks[0]->get_column('count') || 0; - my $second = $all_weeks[1]->get_column('count') || 0; + my $second = defined $all_weeks[1] ? $all_weeks[1]->get_column('count') || 0 : 0; my $max = max( map { $_->get_column('count') } @all_weeks ); my $sum = sum( map { $_->get_column('count') } @all_weeks ); my $count = $week_transaction_rs->count;