Revision 13e28674
Von Werner Hahn vor mehr als 7 Jahren hinzugefügt
SL/Controller/ShopOrder.pm | ||
---|---|---|
18 | 18 |
use SL::Controller::Helper::ParseFilter; |
19 | 19 |
use Rose::Object::MakeMethods::Generic |
20 | 20 |
( |
21 |
'scalar --get_set_init' => [ qw(shop_order transferred js) ], |
|
21 |
'scalar --get_set_init' => [ qw(shop_order shops transferred js) ],
|
|
22 | 22 |
); |
23 | 23 |
|
24 | 24 |
__PACKAGE__->run_before('setup'); |
... | ... | |
242 | 242 |
{ title => t8("not transferred"), value => 0 }, ] |
243 | 243 |
} |
244 | 244 |
|
245 |
sub init_shops { |
|
246 |
SL::DB::Shop->shops_dd; |
|
247 |
} |
|
248 |
|
|
245 | 249 |
sub _setup_list_action_bar { |
246 | 250 |
my ($self) = @_; |
247 | 251 |
|
... | ... | |
359 | 363 |
|
360 | 364 |
Transferstatuses for the filter dropdown |
361 | 365 |
|
366 |
=item C<init_shops> |
|
367 |
|
|
368 |
Filter dropdown Shops |
|
369 |
|
|
362 | 370 |
=back |
363 | 371 |
|
364 | 372 |
=head1 TODO |
SL/Controller/ShopPart.pm | ||
---|---|---|
9 | 9 |
use Data::Dumper; |
10 | 10 |
use SL::Locale::String qw(t8); |
11 | 11 |
use SL::DB::ShopPart; |
12 |
use SL::DB::Shop; |
|
12 | 13 |
use SL::DB::File; |
13 | 14 |
use SL::DB::ShopImage; |
14 | 15 |
use SL::DB::Default; |
15 | 16 |
use SL::Helper::Flash; |
17 |
use SL::Controller::Helper::ParseFilter; |
|
16 | 18 |
use MIME::Base64; |
17 | 19 |
|
18 | 20 |
use Rose::Object::MakeMethods::Generic |
19 | 21 |
( |
20 | 22 |
scalar => [ qw(price_sources) ], |
21 |
'scalar --get_set_init' => [ qw(shop_part file shops producers) ],
|
|
23 |
'scalar --get_set_init' => [ qw(shop_part file shops) ], |
|
22 | 24 |
); |
23 | 25 |
|
24 | 26 |
__PACKAGE__->run_before('check_auth'); |
... | ... | |
193 | 195 |
sub action_list_articles { |
194 | 196 |
my ($self) = @_; |
195 | 197 |
|
196 |
my %filter = ($::form->{filter} ? parse_filter($::form->{filter}) : query => [ transferred => 0 ]); |
|
197 |
my $transferred = $::form->{filter}->{transferred_eq_ignore_empty} ne '' ? $::form->{filter}->{transferred_eq_ignore_empty} : ''; |
|
198 |
my %filter = ($::form->{filter} ? parse_filter($::form->{filter}) : query => [ 'shop.obsolete' => 0 ]); |
|
198 | 199 |
my $sort_by = $::form->{sort_by} ? $::form->{sort_by} : 'part.partnumber'; |
199 | 200 |
$sort_by .=$::form->{sort_dir} ? ' DESC' : ' ASC'; |
200 | 201 |
|
201 |
my $articles = SL::DB::Manager::ShopPart->get_all(where => [ 'shop.obsolete' => 0 ],with_objects => [ 'part','shop' ], sort_by => $sort_by );
|
|
202 |
my $articles = SL::DB::Manager::ShopPart->get_all( %filter ,with_objects => [ 'part','shop' ], sort_by => $sort_by );
|
|
202 | 203 |
|
203 | 204 |
foreach my $article (@{ $articles}) { |
204 | 205 |
my $images = SL::DB::Manager::ShopImage->get_all_count( where => [ 'files.object_id' => $article->part->id, ], with_objects => 'file', sort_by => 'position' ); |
... | ... | |
352 | 353 |
} |
353 | 354 |
|
354 | 355 |
sub init_shops { |
355 |
require SL::DB::Shop; |
|
356 |
my @shops_dd = [ { title => t8("all") , value =>'' } ]; |
|
357 |
my $shops = SL::DB::Mangager::Shop->get_all( where => [ obsolete => 0 ] ); |
|
358 |
my @tmp = map { { title => $_->{description}, value => $_->{id} } } @{ $shops } ; |
|
359 |
return @shops_dd; |
|
356 |
SL::DB::Shop->shops_dd; |
|
360 | 357 |
} |
361 | 358 |
|
362 | 359 |
1; |
SL/DB/Shop.pm | ||
---|---|---|
8 | 8 |
use SL::DB::MetaSetup::Shop; |
9 | 9 |
use SL::DB::Manager::Shop; |
10 | 10 |
use SL::DB::Helper::ActsAsList; |
11 |
|
|
12 |
#__PACKAGE__->meta->add_relationships( |
|
13 |
# shop_parts => { |
|
14 |
# type => 'one to many', |
|
15 |
# class => 'SL::DB::ShopPart', |
|
16 |
# column_map => { id => 'shop_id' }, |
|
17 |
# }, |
|
18 |
#); |
|
11 |
use SL::Locale::String qw(t8); |
|
19 | 12 |
|
20 | 13 |
__PACKAGE__->meta->initialize; |
21 | 14 |
|
... | ... | |
28 | 21 |
|
29 | 22 |
return @errors; |
30 | 23 |
} |
24 |
|
|
25 |
sub shops_dd { |
|
26 |
my ( $self ) = @_; |
|
27 |
|
|
28 |
my @shops_dd = [ { title => t8("all") , value =>'' } ]; |
|
29 |
my $shops = SL::DB::Manager::Shop->get_all( where => [ obsolete => 0 ] ); |
|
30 |
my @tmp = map { { title => $_->{description}, value => $_->{id} } } @{ $shops } ; |
|
31 |
push @shops_dd, @tmp; |
|
32 |
return \@shops_dd; |
|
33 |
} |
|
34 |
|
|
31 | 35 |
1; |
36 |
|
|
37 |
__END__ |
|
38 |
|
|
39 |
=pod |
|
40 |
|
|
41 |
=encoding utf-8 |
|
42 |
|
|
43 |
=head1 NAME |
|
44 |
|
|
45 |
SL::DB::Shop - Model for the 'shops' table |
|
46 |
|
|
47 |
=head1 SYNOPSIS |
|
48 |
|
|
49 |
This is a standard Rose::DB::Object based model and can be used as one. |
|
50 |
|
|
51 |
=head1 METHODS |
|
52 |
|
|
53 |
=over 4 |
|
54 |
|
|
55 |
=item C<validate> |
|
56 |
|
|
57 |
Returns an error if the shop description is missing |
|
58 |
|
|
59 |
=item C<shops_dd> |
|
60 |
|
|
61 |
Returns an array of hashes for dropdowns in filters |
|
62 |
|
|
63 |
=back |
|
64 |
|
|
65 |
=head1 AUTHORS |
|
66 |
|
|
67 |
Werner Hahn E<lt>wh@futureworldsearch.netE<gt> |
|
68 |
|
|
69 |
G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt> |
|
70 |
|
|
71 |
=cut |
templates/webpages/shop_order/_filter.html | ||
---|---|---|
5 | 5 |
<form method="post" action="controller.pl" name="shop_orders" id="shoporders"> |
6 | 6 |
<table id='filter_table'> |
7 | 7 |
|
8 |
<tr> |
|
9 |
<th align="right">[% 'Shop' | $T8 %]</th> |
|
10 |
<td>[% L.select_tag('filter.shop_id:eq_ignore_empty', SELF.shops, value_key = 'value', title_key = 'title', default=0) %]</td> |
|
11 |
</tr> |
|
12 |
|
|
8 | 13 |
<tr> |
9 | 14 |
<th align="right">[% 'Status' | $T8 %]</th> |
10 | 15 |
<td>[% L.select_tag('filter.transferred:eq_ignore_empty', SELF.transferred, value_key = 'value', title_key = 'title', default=0) %]</td> |
templates/webpages/shop_part/_filter.html | ||
---|---|---|
7 | 7 |
|
8 | 8 |
<tr> |
9 | 9 |
<th align="right">[% 'Shop' | $T8 %]</th> |
10 |
<td>[% L.select_tag('filter.transferred:eq_ignore_empty', SELF.shop, value_key = 'value', title_key = 'title', default=SHOPS) %]</td>
|
|
10 |
<td>[% L.select_tag('filter.shop_id:eq_ignore_empty', SELF.shops, value_key = 'value', title_key = 'title', default=0) %]</td>
|
|
11 | 11 |
</tr> |
12 | 12 |
|
13 | 13 |
</table> |
Auch abrufbar als: Unified diff
Shopmodul: Filter nach Shop in Shopartikellisting und Bestelllisting