Revision efc07572
Von Tamino Steinert vor 12 Tagen hinzugefügt
SL/Controller/Reclamation.pm | ||
---|---|---|
6 | 6 |
use SL::Helper::Flash qw(flash_later); |
7 | 7 |
use SL::HTML::Util; |
8 | 8 |
use SL::Presenter::Tag qw(select_tag hidden_tag div_tag); |
9 |
use SL::Presenter::ReclamationFilter qw(filter);
|
|
9 |
use SL::Presenter::Filter::Reclamation;
|
|
10 | 10 |
use SL::Locale::String qw(t8); |
11 | 11 |
use SL::SessionFile::Random; |
12 | 12 |
use SL::PriceSource; |
... | ... | |
217 | 217 |
my ($self) = @_; |
218 | 218 |
|
219 | 219 |
$self->_setup_search_action_bar; |
220 |
$self->prepare_report; |
|
220 |
my $report = $self->prepare_report;
|
|
221 | 221 |
$self->report_generator_list_objects( |
222 |
report => $self->{report},
|
|
222 |
report => $report,
|
|
223 | 223 |
objects => $self->models->get, |
224 | 224 |
options => { |
225 | 225 |
action_bar_additional_submit_values => { |
... | ... | |
1186 | 1186 |
closed => t8('Closed'), |
1187 | 1187 |
}, |
1188 | 1188 |
query => [ |
1189 |
SL::DB::Manager::Reclamation->type_filter($self->type),
|
|
1189 |
(record_type => $self->type),
|
|
1190 | 1190 |
(salesman_id => SL::DB::Manager::Employee->current->id) x ($self->reclamation->is_sales && !$::auth->assert('sales_all_edit', 1)), |
1191 | 1191 |
(employee_id => SL::DB::Manager::Employee->current->id) x ($self->reclamation->is_sales && !$::auth->assert('sales_all_edit', 1)), |
1192 | 1192 |
(employee_id => SL::DB::Manager::Employee->current->id) x (!$self->reclamation->is_sales && !$::auth->assert('purchase_all_edit', 1)), |
... | ... | |
1672 | 1672 |
my ($self) = @_; |
1673 | 1673 |
|
1674 | 1674 |
my $report = SL::ReportGenerator->new(\%::myconfig, $::form); |
1675 |
$report->{title} = t8('Sales Reclamations'); |
|
1676 |
if ($self->type eq PURCHASE_RECLAMATION_TYPE()){ |
|
1677 |
$report->{title} = t8('Purchase Reclamations'); |
|
1678 |
} |
|
1679 | 1675 |
|
1680 | 1676 |
$self->models->disable_plugin('paginated') if $report->{options}{output_format} =~ /^(pdf|csv)$/i; |
1681 | 1677 |
$self->models->add_additional_url_params(type => $self->type); |
... | ... | |
1683 | 1679 |
|
1684 | 1680 |
my $callback = $self->models->get_callback; |
1685 | 1681 |
|
1686 |
$self->{report} = $report; |
|
1687 |
|
|
1688 | 1682 |
# TODO: shipto_id is not linked to custom_shipto |
1689 | 1683 |
my @columns_order = qw( |
1690 | 1684 |
id |
... | ... | |
1892 | 1886 |
unless ($::form->{active_in_report}) { |
1893 | 1887 |
$::form->{active_in_report}->{$_} = 1 foreach @default_columns; |
1894 | 1888 |
} |
1889 |
|
|
1895 | 1890 |
$self->models->add_additional_url_params( |
1896 |
active_in_report => $::form->{active_in_report}); |
|
1897 |
map { $column_defs{$_}->{visible} = $::form->{active_in_report}->{"$_"} } |
|
1898 |
keys %column_defs; |
|
1891 |
active_in_report => $::form->{active_in_report} |
|
1892 |
); |
|
1893 |
|
|
1894 |
$column_defs{$_}->{visible} = $::form->{active_in_report}->{"$_"} || 0 |
|
1895 |
foreach keys %column_defs; |
|
1899 | 1896 |
|
1900 | 1897 |
## add cvars TODO: Add own cvars |
1901 | 1898 |
#my %cvar_column_defs = map { |
... | ... | |
1915 | 1912 |
# make all sortable |
1916 | 1913 |
my @sortable = keys %column_defs; |
1917 | 1914 |
|
1918 |
my $filter_html = SL::Presenter::ReclamationFilter::filter(
|
|
1915 |
my $filter_html = SL::Presenter::Filter::Reclamation::filter(
|
|
1919 | 1916 |
$::form->{filter}, $self->type, active_in_report => $::form->{active_in_report} |
1920 | 1917 |
); |
1921 | 1918 |
|
... | ... | |
1940 | 1937 |
$report->set_columns(%column_defs); |
1941 | 1938 |
$report->set_column_order(@columns_order); |
1942 | 1939 |
#$report->set_export_options(qw(list filter), @cvar_column_form_names); TODO: for cvars |
1943 |
$report->set_export_options(qw(list filter active_in_report));
|
|
1940 |
$report->set_export_options('list', qw(filter active_in_report));
|
|
1944 | 1941 |
$report->set_options_from_form; |
1945 | 1942 |
$self->models->set_report_generator_sort_options(report => $report, sortable_columns => \@sortable); |
1943 |
|
|
1944 |
return $report; |
|
1946 | 1945 |
} |
1947 | 1946 |
|
1948 | 1947 |
sub _setup_edit_action_bar { |
... | ... | |
2139 | 2138 |
$bar->add( |
2140 | 2139 |
action => [ |
2141 | 2140 |
t8('Update'), |
2142 |
submit => [ '#search_form', { action => 'Reclamation/list', type => $self->type } ],
|
|
2141 |
submit => [ '#filter_form', { action => 'Reclamation/list', type => $self->type } ],
|
|
2143 | 2142 |
accesskey => 'enter', |
2144 | 2143 |
], |
2145 | 2144 |
link => [ |
Auch abrufbar als: Unified diff
S:Presenter:Filter: Separaten Presenter für komplexe Berichtsfilter