Skip to content

Commit

Permalink
Merge pull request #89 from silexkr/#79-no-list
Browse files Browse the repository at this point in the history
#79 no list
  • Loading branch information
rumidier committed Oct 25, 2012
2 parents 0e9d70e + a46d3f2 commit 2ce2746
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/Silex/Donnenwa/Web/Controller/Deposit.pm
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ sub approval :Local CaptureArgs(1) {
my ( $self, $c, $id ) = @_;
my @target_ids = split ',', $id;

return $c->res->redirect($c->uri_for("/deposit")) unless @target_ids;

my $target_charges
= $self->charge_api->search({ id => { -in => \@target_ids } } );
my $approval = $target_charges->update_all({ status => '4' });
Expand Down Expand Up @@ -136,6 +138,8 @@ sub cancel :Local :CaptureArgs(1) {
my ( $self, $c, $id ) = @_;
my @target_ids = split ',', $id;

return $c->res->redirect($c->uri_for("/deposit")) unless @target_ids;

my $refuse = $self->charge_api->search({ id => { -in
=> \@target_ids } })->update_all({ status => '1' });

Expand All @@ -152,10 +156,11 @@ sub cancel :Local :CaptureArgs(1) {
sub export :Local CaptureArgs(1) {
my ( $self, $c, $id ) = @_;
my @target_ids = split ',', $id;
my @charges;

# set header
push @charges, ['제목', '청구자', '금액', '영수증날짜'];
return $c->res->redirect($c->uri_for("/deposit")) unless @target_ids;

my @charges;
push @charges, ['제목', '청구자', '금액', '영수증날짜']; # set header

foreach my $charge ($self->charge_api->search({ id => { -in => \@target_ids } })->all) {
push @charges, [ $charge->title, $charge->user->user_name, $charge->amount, $charge->usage_date ];
Expand Down
6 changes: 6 additions & 0 deletions lib/Silex/Donnenwa/Web/Controller/List.pm
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ sub delete :Local :CaptureArgs(1) {
my ( $self, $c, $id ) = @_;
my @target_ids = split ',', $id;

return $c->res->redirect($c->uri_for('/list')) unless @target_ids;

my $charge = $self->api->search({ id => { -in => \@target_ids } })->delete_all;

if ($charge) {
Expand All @@ -148,6 +150,8 @@ sub approval :Local :CaptureArgs(1) {
my ( $self, $c, $id ) = @_;
my @target_ids = split ',', $id;

return $c->res->redirect($c->uri_for('/list')) unless @target_ids;

my $approval = $self->api->search({ id => { -in
=> \@target_ids } })->update_all({ status => '2' });

Expand All @@ -166,6 +170,8 @@ sub refuse :Local :CaptureArgs(1) {
my ( $self, $c, $id ) = @_;
my @target_ids = split ',', $id;

return $c->res->redirect($c->uri_for('/list')) unless @target_ids;

my $refuse = $self->api->search({ id => { -in
=> \@target_ids } })->update_all({ status => '3' });

Expand Down

0 comments on commit 2ce2746

Please sign in to comment.