X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/662b757f97c456d1a8f93f1f37ae188b945da42e..464f44a:/SL/Controller/PaymentTerm.pm diff --git a/SL/Controller/PaymentTerm.pm b/SL/Controller/PaymentTerm.pm index 92cff0cff..da5850df4 100644 --- a/SL/Controller/PaymentTerm.pm +++ b/SL/Controller/PaymentTerm.pm @@ -13,7 +13,8 @@ use Rose::Object::MakeMethods::Generic scalar => [ qw(payment_term languages) ], ); -__PACKAGE__->run_before('load_payment_term', only => [ qw( edit update destroy move_up move_down) ]); +__PACKAGE__->run_before('check_auth'); +__PACKAGE__->run_before('load_payment_term', only => [ qw( edit update destroy) ]); __PACKAGE__->run_before('load_languages', only => [ qw(new list edit create update) ]); # @@ -24,7 +25,7 @@ sub action_list { my ($self) = @_; $self->render('payment_term/list', - title => $::locale->text('Payment terms'), + title => $::locale->text('Payment terms'), PAYMENT_TERMS => SL::DB::Manager::PaymentTerm->get_all_sorted); } @@ -67,14 +68,17 @@ sub action_destroy { sub action_reorder { my ($self) = @_; - my @ids = @{ $::form->{payment_term_id} || [] }; - my $result = SL::DB::PaymentTerm->new->db->do_transaction(sub { - foreach my $idx (0 .. scalar(@ids) - 1) { - SL::DB::PaymentTerm->new(id => $ids[$idx])->load->update_attributes(sortkey => $idx + 1); - } - }); + SL::DB::PaymentTerm->reorder_list(@{ $::form->{payment_term_id} || [] }); - $self->render(type => 'js', inline => '1;'); + $self->render(\'', { type => 'json' }); +} + +# +# filters +# + +sub check_auth { + $::auth->assert('config'); } #