X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FPaymentTerm.pm;h=b504bb7ad0897e5518c9cdfe53c881936ec45cc2;hb=06837707dbfdc495214e21817e7b9d7d696ba549;hp=92cff0cff2f3be963b07fb21fa4c049c422213b9;hpb=662b757f97c456d1a8f93f1f37ae188b945da42e;p=kivitendo-erp.git diff --git a/SL/Controller/PaymentTerm.pm b/SL/Controller/PaymentTerm.pm index 92cff0cff..b504bb7ad 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) ]); # @@ -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'); } #