X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FCustomerVendorTurnover.pm;h=5a59f1fbdb6bb63e3859fdd7eee636acb130df87;hb=f5341298db5dbe7e14d0f97525f4f6226e5940c0;hp=5356a73a071c324ecac6d979150ef145439e9fb3;hpb=2ef19c818a05b2baa2552ae5b4edbcc16bcfc986;p=kivitendo-erp.git diff --git a/SL/Controller/CustomerVendorTurnover.pm b/SL/Controller/CustomerVendorTurnover.pm index 5356a73a0..5a59f1fbd 100644 --- a/SL/Controller/CustomerVendorTurnover.pm +++ b/SL/Controller/CustomerVendorTurnover.pm @@ -9,6 +9,7 @@ use SL::DB::EmailJournal; use SL::DB::Letter; use SL::DB; +__PACKAGE__->run_before('check_auth'); sub action_list_turnover { my ($self) = @_; @@ -26,6 +27,7 @@ sub action_list_turnover { amount => { lt => \'paid'}, ], ], + sort_by => 'transdate DESC', with_objects => [ 'dunnings' ], ); } else { @@ -37,12 +39,11 @@ sub action_list_turnover { amount => { lt => \'paid'}, ], ], - sort_by => 'invnumber DESC', + sort_by => 'transdate DESC', ); } my $open_items; if (@{$open_invoices}) { - return $self->render(\'', { type => 'json' }) unless scalar @{$open_invoices}; $open_items = $self->_list_open_items($open_invoices); } my $open_orders = $self->_get_open_orders; @@ -95,7 +96,7 @@ sub action_count_open_items_by_month { my $cv = $::form->{id}; - my $query = <{db} eq 'customer' ) { $invoices = SL::DB::Manager::Invoice->get_all( query => [ customer_id => $cv, ], - sort_by => 'invnumber DESC', + sort_by => 'transdate DESC', ); } else { $invoices = SL::DB::Manager::PurchaseInvoice->get_all( query => [ vendor_id => $cv, ], - sort_by => 'invnumber DESC', + sort_by => 'transdate DESC', ); } $self->render('customer_vendor_turnover/invoices_statistic', { layout => 0 }, invoices => $invoices); @@ -205,7 +206,7 @@ sub action_get_orders { customer_id => $cv, quotation => ($type eq 'quotation' ? 'T' : 'F') ], - sort_by => ( $type eq 'order' ? 'ordnumber DESC' : 'quonumber DESC'), + sort_by => 'transdate DESC', ); } else { $orders = SL::DB::Manager::Order->get_all( @@ -213,7 +214,7 @@ sub action_get_orders { vendor_id => $cv, quotation => ($type eq 'quotation' ? 'T' : 'F') ], - sort_by => ( $type eq 'order' ? 'ordnumber DESC' : 'quonumber DESC'), + sort_by => 'transdate DESC', ); } if ( $type eq 'order') { @@ -236,7 +237,7 @@ sub _get_open_orders { customer_id => $cv, closed => 'F', ], - sort_by => 'ordnumber DESC', + sort_by => 'transdate DESC', ); } else { $open_orders = SL::DB::Manager::Order->get_all( @@ -244,7 +245,7 @@ sub _get_open_orders { vendor_id => $cv, closed => 'F', ], - sort_by => 'ordnumber DESC', + sort_by => 'transdate DESC', ); } @@ -440,6 +441,10 @@ sub action_get_letters { $self->render('customer_vendor_turnover/letter_statistic', { layout => 0 }, letters => $letters); } +sub check_auth { + $::auth->assert('show_extra_record_tab_customer | show_extra_record_tab_vendor'); +} + 1; __END__ @@ -456,8 +461,6 @@ Gets all kinds of records like orders, request orders, quotations, invoices, ema wich belong to customer/vendor and displays them in an extra tab "Records". -=back - =head1 URL ACTIONS =over 4 @@ -522,4 +525,4 @@ None yet. :) W. Hahn Ewh@futureworldsearch.netE -=back +=cut