Revision d9e5bd29
Von Werner Hahn vor mehr als 6 Jahren hinzugefügt
SL/Controller/ShopPart.pm | ||
---|---|---|
10 | 10 |
use SL::Locale::String qw(t8); |
11 | 11 |
use SL::DB::ShopPart; |
12 | 12 |
use SL::DB::File; |
13 |
use SL::DB::ShopImage; |
|
13 | 14 |
use SL::Controller::FileUploader; |
14 | 15 |
use SL::DB::Default; |
15 | 16 |
use SL::Helper::Flash; |
... | ... | |
65 | 66 |
|
66 | 67 |
sub action_show_files { |
67 | 68 |
my ($self) = @_; |
69 |
$main::lxdebug->message(0, "WH:ShowFiles "); |
|
70 |
$main::lxdebug->dump(0, 'WH:FORM ',$::form); |
|
71 |
$main::lxdebug->dump(0, 'WH:FORM ',$::form->{part}); |
|
68 | 72 |
|
69 |
my $images = SL::DB::Manager::File->get_all_sorted( where => [ trans_id => $::form->{id}, modul => $::form->{modul}, file_content_type => { like => 'image/%' } ], sort_by => 'position' ); |
|
73 |
#my $images = SL::DB::Manager::File->get_all_sorted( where => [ trans_id => $::form->{id}, modul => $::form->{modul}, file_content_type => { like => 'image/%' } ], sort_by => 'position' ); |
|
74 |
#my $images = SL::DB::Manager::ShopImage->get_all_sorted( where => [ partnumber => $::form->{part}{partnumber}, ], with_object => 'file', sort_by => 'position' ); |
|
75 |
my $images = SL::DB::Manager::ShopImage->get_all( where => [ 'files.object_id' => $::form->{id}, ], with_objects => 'file', sort_by => 'position' ); |
|
76 |
$main::lxdebug->dump(0, 'WH:ShowFiles1 ',$images); |
|
70 | 77 |
|
71 | 78 |
$self->render('shop_part/_list_images', { header => 0 }, IMAGES => $images); |
72 | 79 |
} |
... | ... | |
143 | 150 |
|
144 | 151 |
my $categories = $shop->connector->get_categories; |
145 | 152 |
|
146 |
$main::lxdebug->dump(0, 'WH:KAT ',$categories); |
|
147 | 153 |
$self->js |
148 | 154 |
->run( |
149 | 155 |
'kivi.shop_part.shop_part_dialog', |
... | ... | |
303 | 309 |
sub action_list_articles { |
304 | 310 |
my ($self) = @_; |
305 | 311 |
|
306 |
my %filter = ($::form->{filter} ? parse_filter($::form->{filter}) : query => [ transferred => 0 ]); |
|
312 |
my %filter = ($::form->{filter} ? parse_filter($::form->{filter}) : query => [ transferred => 0 ]);
|
|
307 | 313 |
my $transferred = $::form->{filter}->{transferred_eq_ignore_empty} ne '' ? $::form->{filter}->{transferred_eq_ignore_empty} : ''; |
308 |
my $sort_by = $::form->{sort_by} ? $::form->{sort_by} : 'part.partnumber'; |
|
314 |
my $sort_by = $::form->{sort_by} ? $::form->{sort_by} : 'part.partnumber';
|
|
309 | 315 |
$sort_by .=$::form->{sort_dir} ? ' DESC' : ' ASC'; |
310 | 316 |
|
311 | 317 |
my $articles = SL::DB::Manager::ShopPart->get_all(where => [ 'shop.obsolete' => 0 ],with_objects => [ 'part','shop' ], sort_by => $sort_by ); |
... | ... | |
390 | 396 |
#TODO Price must be formatted. Translations for $price_grp_str |
391 | 397 |
my $price; |
392 | 398 |
if ($price_src_str eq "master_data") { |
393 |
my $part = SL::DB::Manager::Part->get_all( where => [id => $self->shop_part->part_id], with_objects => ['prices'],limit => 1)->[0]; |
|
394 |
$price = $part->$price_src_id; |
|
399 |
my $part = SL::DB::Manager::Part->get_all( where => [id => $self->shop_part->part_id], with_objects => ['prices'],limit => 1)->[0];
|
|
400 |
$price = $part->$price_src_id;
|
|
395 | 401 |
$price_src_str = $price_src_id; |
396 |
}else{ |
|
397 |
my $part = SL::DB::Manager::Part->get_all( where => [id => $self->shop_part->part_id, 'prices.'.pricegroup_id => $price_src_id], with_objects => ['prices'],limit => 1)->[0]; |
|
398 |
my $pricegrp = SL::DB::Manager::Pricegroup->find_by( id => $price_src_id )->pricegroup; |
|
399 |
$price = $part->prices->[0]->price;
|
|
402 |
}else{
|
|
403 |
my $part = SL::DB::Manager::Part->get_all( where => [id => $self->shop_part->part_id, 'prices.'.pricegroup_id => $price_src_id], with_objects => ['prices'],limit => 1)->[0];
|
|
404 |
my $pricegrp = SL::DB::Manager::Pricegroup->find_by( id => $price_src_id )->pricegroup;
|
|
405 |
$price = $part->prices->[0]->price;
|
|
400 | 406 |
$price_src_str = $pricegrp; |
401 | 407 |
} |
402 | 408 |
return($price,$price_src_str); |
Auch abrufbar als: Unified diff
Shopmodul: Bilder hochladen