Revision 13e28674
Von Werner Hahn vor fast 8 Jahren hinzugefügt
SL/Controller/ShopOrder.pm | ||
---|---|---|
use SL::Controller::Helper::ParseFilter;
|
||
use Rose::Object::MakeMethods::Generic
|
||
(
|
||
'scalar --get_set_init' => [ qw(shop_order transferred js) ],
|
||
'scalar --get_set_init' => [ qw(shop_order shops transferred js) ],
|
||
);
|
||
|
||
__PACKAGE__->run_before('setup');
|
||
... | ... | |
{ title => t8("not transferred"), value => 0 }, ]
|
||
}
|
||
|
||
sub init_shops {
|
||
SL::DB::Shop->shops_dd;
|
||
}
|
||
|
||
sub _setup_list_action_bar {
|
||
my ($self) = @_;
|
||
|
||
... | ... | |
|
||
Transferstatuses for the filter dropdown
|
||
|
||
=item C<init_shops>
|
||
|
||
Filter dropdown Shops
|
||
|
||
=back
|
||
|
||
=head1 TODO
|
SL/Controller/ShopPart.pm | ||
---|---|---|
use Data::Dumper;
|
||
use SL::Locale::String qw(t8);
|
||
use SL::DB::ShopPart;
|
||
use SL::DB::Shop;
|
||
use SL::DB::File;
|
||
use SL::DB::ShopImage;
|
||
use SL::DB::Default;
|
||
use SL::Helper::Flash;
|
||
use SL::Controller::Helper::ParseFilter;
|
||
use MIME::Base64;
|
||
|
||
use Rose::Object::MakeMethods::Generic
|
||
(
|
||
scalar => [ qw(price_sources) ],
|
||
'scalar --get_set_init' => [ qw(shop_part file shops producers) ],
|
||
'scalar --get_set_init' => [ qw(shop_part file shops) ],
|
||
);
|
||
|
||
__PACKAGE__->run_before('check_auth');
|
||
... | ... | |
sub action_list_articles {
|
||
my ($self) = @_;
|
||
|
||
my %filter = ($::form->{filter} ? parse_filter($::form->{filter}) : query => [ transferred => 0 ]);
|
||
my $transferred = $::form->{filter}->{transferred_eq_ignore_empty} ne '' ? $::form->{filter}->{transferred_eq_ignore_empty} : '';
|
||
my %filter = ($::form->{filter} ? parse_filter($::form->{filter}) : query => [ 'shop.obsolete' => 0 ]);
|
||
my $sort_by = $::form->{sort_by} ? $::form->{sort_by} : 'part.partnumber';
|
||
$sort_by .=$::form->{sort_dir} ? ' DESC' : ' ASC';
|
||
|
||
my $articles = SL::DB::Manager::ShopPart->get_all(where => [ 'shop.obsolete' => 0 ],with_objects => [ 'part','shop' ], sort_by => $sort_by );
|
||
my $articles = SL::DB::Manager::ShopPart->get_all( %filter ,with_objects => [ 'part','shop' ], sort_by => $sort_by );
|
||
|
||
foreach my $article (@{ $articles}) {
|
||
my $images = SL::DB::Manager::ShopImage->get_all_count( where => [ 'files.object_id' => $article->part->id, ], with_objects => 'file', sort_by => 'position' );
|
||
... | ... | |
}
|
||
|
||
sub init_shops {
|
||
require SL::DB::Shop;
|
||
my @shops_dd = [ { title => t8("all") , value =>'' } ];
|
||
my $shops = SL::DB::Mangager::Shop->get_all( where => [ obsolete => 0 ] );
|
||
my @tmp = map { { title => $_->{description}, value => $_->{id} } } @{ $shops } ;
|
||
return @shops_dd;
|
||
SL::DB::Shop->shops_dd;
|
||
}
|
||
|
||
1;
|
SL/DB/Shop.pm | ||
---|---|---|
use SL::DB::MetaSetup::Shop;
|
||
use SL::DB::Manager::Shop;
|
||
use SL::DB::Helper::ActsAsList;
|
||
|
||
#__PACKAGE__->meta->add_relationships(
|
||
# shop_parts => {
|
||
# type => 'one to many',
|
||
# class => 'SL::DB::ShopPart',
|
||
# column_map => { id => 'shop_id' },
|
||
# },
|
||
#);
|
||
use SL::Locale::String qw(t8);
|
||
|
||
__PACKAGE__->meta->initialize;
|
||
|
||
... | ... | |
|
||
return @errors;
|
||
}
|
||
|
||
sub shops_dd {
|
||
my ( $self ) = @_;
|
||
|
||
my @shops_dd = [ { title => t8("all") , value =>'' } ];
|
||
my $shops = SL::DB::Manager::Shop->get_all( where => [ obsolete => 0 ] );
|
||
my @tmp = map { { title => $_->{description}, value => $_->{id} } } @{ $shops } ;
|
||
push @shops_dd, @tmp;
|
||
return \@shops_dd;
|
||
}
|
||
|
||
1;
|
||
|
||
__END__
|
||
|
||
=pod
|
||
|
||
=encoding utf-8
|
||
|
||
=head1 NAME
|
||
|
||
SL::DB::Shop - Model for the 'shops' table
|
||
|
||
=head1 SYNOPSIS
|
||
|
||
This is a standard Rose::DB::Object based model and can be used as one.
|
||
|
||
=head1 METHODS
|
||
|
||
=over 4
|
||
|
||
=item C<validate>
|
||
|
||
Returns an error if the shop description is missing
|
||
|
||
=item C<shops_dd>
|
||
|
||
Returns an array of hashes for dropdowns in filters
|
||
|
||
=back
|
||
|
||
=head1 AUTHORS
|
||
|
||
Werner Hahn E<lt>wh@futureworldsearch.netE<gt>
|
||
|
||
G. Richardson E<lt>grichardson@kivitendo-premium.deE<gt>
|
||
|
||
=cut
|
templates/webpages/shop_order/_filter.html | ||
---|---|---|
<form method="post" action="controller.pl" name="shop_orders" id="shoporders">
|
||
<table id='filter_table'>
|
||
|
||
<tr>
|
||
<th align="right">[% 'Shop' | $T8 %]</th>
|
||
<td>[% L.select_tag('filter.shop_id:eq_ignore_empty', SELF.shops, value_key = 'value', title_key = 'title', default=0) %]</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<th align="right">[% 'Status' | $T8 %]</th>
|
||
<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 | ||
---|---|---|
|
||
<tr>
|
||
<th align="right">[% 'Shop' | $T8 %]</th>
|
||
<td>[% L.select_tag('filter.transferred:eq_ignore_empty', SELF.shop, value_key = 'value', title_key = 'title', default=SHOPS) %]</td>
|
||
<td>[% L.select_tag('filter.shop_id:eq_ignore_empty', SELF.shops, value_key = 'value', title_key = 'title', default=0) %]</td>
|
||
</tr>
|
||
|
||
</table>
|
Auch abrufbar als: Unified diff
Shopmodul: Filter nach Shop in Shopartikellisting und Bestelllisting