X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/8893354909b940b99cb05e85e1964bfc5e805baa..047a0b577ec117c9061d40728803c70ff8191962:/SL/Controller/Warehouse.pm diff --git a/SL/Controller/Warehouse.pm b/SL/Controller/Warehouse.pm new file mode 100644 index 000000000..a7b059c89 --- /dev/null +++ b/SL/Controller/Warehouse.pm @@ -0,0 +1,36 @@ +package SL::Controller::Warehouse; + +use strict; + +use parent qw(SL::Controller::Base); + +use SL::DB::Warehouse; + +__PACKAGE__->run_before('check_auth'); + +# +# actions +# + +sub action_reorder { + my ($self) = @_; + + my @ids = @{ $::form->{warehouse_id} || [] }; + my $result = SL::DB::Warehouse->new->db->do_transaction(sub { + foreach my $idx (0 .. scalar(@ids) - 1) { + SL::DB::Warehouse->new(id => $ids[$idx])->load->update_attributes(sortkey => $idx + 1); + } + }); + + $self->render(type => 'js', inline => '1;'); +} + +# +# filters +# + +sub check_auth { + $::auth->assert('config'); +} + +1;