Revision 95a3cada
Von Kivitendo Admin vor mehr als 8 Jahren hinzugefügt
bin/mozilla/ic.pl | ||
---|---|---|
1640 | 1640 |
CVar->render_inputs('variables' => $form->{CUSTOM_VARIABLES}, show_disabled_message => 1, partsgroup_id => $partsgroup_id) |
1641 | 1641 |
if (scalar @{ $form->{CUSTOM_VARIABLES} }); |
1642 | 1642 |
|
1643 |
require SL::DB::Shop; |
|
1643 | 1644 |
my $active_shops = SL::DB::Manager::Shop->get_all(query => [ obsolete => 0 ], sort_by => 'sortkey'); |
1644 |
$form->{SHOP_PARTS} = SL::DB::Manager::ShopPart->get_all( query => [ part_id => $part->id , 'shop.obsolete' => 0 ], with_objects => ['shop'] ); |
|
1645 |
|
|
1646 |
# $form->{ACTIVE_SHOPS} = $active_shops; |
|
1647 |
# foreach my $shop ( @$active_shops ) { |
|
1648 |
# my ($shop_part) = $part->find_shop_parts( { shop_id => $shop->id } ); |
|
1649 |
# push( @{ $form->{SHOP_PARTS} }, $shop_part ); |
|
1650 |
# }; |
|
1651 |
my @used_shop_ids = map { $_->shop->id } @{ $form->{SHOP_PARTS} }; |
|
1652 |
$form->{SHOPS_NOT_ASSIGNED} = SL::DB::Manager::Shop->get_all( query => [ obsolete => 0, '!id' => \@used_shop_ids ], sort_by => 'sortkey' ); |
|
1645 |
# check for part variants and shop_parts |
|
1646 |
if ( $form->{id} ) { |
|
1647 |
require SL::DB::Part; |
|
1648 |
my $part = SL::DB::Part->new( id => $form->{id} )->load; |
|
1649 |
if ( $form->{id} ) { |
|
1650 |
if ( $part->is_variant ) { |
|
1651 |
$form->{is_variant} = 1; # for checking in the template |
|
1652 |
@{ $form->{PART_VARIANTS} } = grep { $_->id != $part->id } @{$part->part_variants->[0]->parts}; |
|
1653 |
}; |
|
1654 |
}; |
|
1655 |
$form->{SHOP_PARTS} = SL::DB::Manager::ShopPart->get_all( query => [ part_id => $part->id , 'shop.obsolete' => 0 ], with_objects => ['shop'] ); |
|
1656 |
# $form->{ACTIVE_SHOPS} = $active_shops; |
|
1657 |
# foreach my $shop ( @$active_shops ) { |
|
1658 |
# my ($shop_part) = $part->find_shop_parts( { shop_id => $shop->id } ); |
|
1659 |
# push( @{ $form->{SHOP_PARTS} }, $shop_part ); |
|
1660 |
# }; |
|
1661 |
my @used_shop_ids = map { $_->shop->id } @{ $form->{SHOP_PARTS} }; |
|
1662 |
if ( @used_shop_ids ) { |
|
1663 |
$form->{SHOPS_NOT_ASSIGNED} = SL::DB::Manager::Shop->get_all( query => [ obsolete => 0, '!id' => \@used_shop_ids ], sort_by => 'sortkey' ); |
|
1664 |
} else { |
|
1665 |
$form->{SHOPS_NOT_ASSIGNED} = SL::DB::Manager::Shop->get_all( query => [ obsolete => 0 ], sort_by => 'sortkey' ); |
|
1666 |
}; |
|
1667 |
}; |
|
1653 | 1668 |
|
1654 | 1669 |
$::request->layout->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery kivi.PriceRule kivi.shop_part); |
1655 | 1670 |
$::request->layout->add_javascripts_inline("\$(function(){kivi.PriceRule.load_price_rules_for_part(@{[ $::form->{id} * 1 ]})});") if $::form->{id}; |
Auch abrufbar als: Unified diff
ShopParts - nur für vorhandene Artikel prüfen
Conflicts:
bin/mozilla/ic.pl