Revision 98404f3e
Von Tamino Steinert vor 8 Monaten hinzugefügt
SL/Controller/Part.pm | ||
---|---|---|
33 | 33 |
use SL::JSON; |
34 | 34 |
use SL::Locale::String qw(t8); |
35 | 35 |
use SL::MoreCommon qw(save_form); |
36 |
use SL::Presenter; |
|
36 | 37 |
use SL::Presenter::EscapedText qw(escape is_escaped); |
37 | 38 |
use SL::Presenter::Part; |
38 | 39 |
use SL::Presenter::Tag qw(select_tag); |
... | ... | |
732 | 733 |
} |
733 | 734 |
} |
734 | 735 |
|
736 |
sub action_show_multi_variants_dialog { |
|
737 |
my ($self) = @_; |
|
738 |
|
|
739 |
$self->render('part/_multi_variants_dialog', { layout => 0 }); |
|
740 |
} |
|
741 |
|
|
742 |
sub action_multi_variants_update_result { |
|
743 |
my ($self) = @_; |
|
744 |
my $max_count = $::form->{limit}; |
|
745 |
|
|
746 |
my $parent_variant_id = $::form->{multi_items}->{filter}->{parent_variant_id}; |
|
747 |
my $parent_variant; |
|
748 |
$parent_variant = SL::DB::Manager::Part->find_by( |
|
749 |
id => $parent_variant_id |
|
750 |
) if $parent_variant_id ne ''; |
|
751 |
return $self->js->flash('error', t8('No parent variant selected.'))->render |
|
752 |
unless $parent_variant; |
|
753 |
|
|
754 |
|
|
755 |
if ($::form->{old_parent_variant_id} ne $parent_variant_id) { |
|
756 |
# update parent_variant properties |
|
757 |
my $properties_table = SL::Presenter->get->render( |
|
758 |
'part/_multi_variants_parent_properties_table', |
|
759 |
PROPERTIES => \@{$parent_variant->variant_properties} |
|
760 |
); |
|
761 |
$::form->{multi_items}->{filter}->{'has_variant_property_value_id'} = []; |
|
762 |
$self->js->html('#multi_variants_parent_variant_properties', $properties_table); |
|
763 |
$self->js->val('#old_parent_variant_id', $parent_variant_id); |
|
764 |
} |
|
765 |
|
|
766 |
my $count = $self->multi_items_models->count; |
|
767 |
|
|
768 |
my $result; |
|
769 |
if ($count == 0) { |
|
770 |
my $text = escape($::locale->text('No results.')); |
|
771 |
$result = $text; |
|
772 |
} elsif ($max_count && $count > $max_count) { |
|
773 |
my $text = escape($::locale->text('Too many results (#1 from #2).', $count, $max_count)); |
|
774 |
$result = $text; |
|
775 |
} else { |
|
776 |
my $multi_variants = SL::DB::Manager::Part->sort_variants( |
|
777 |
$self->multi_items_models->get |
|
778 |
); |
|
779 |
$result = SL::Presenter->get->render('part/_multi_variants_result', multi_variants => $multi_variants); |
|
780 |
} |
|
781 |
|
|
782 |
$self->js->html('#multi_items_result', $result)->render; |
|
783 |
return; |
|
784 |
} |
|
785 |
|
|
735 | 786 |
sub action_add_makemodel_row { |
736 | 787 |
my ($self) = @_; |
737 | 788 |
|
... | ... | |
1732 | 1783 |
SL::Controller::Helper::GetModels->new( |
1733 | 1784 |
controller => $_[0], |
1734 | 1785 |
model => 'Part', |
1735 |
with_objects => [ qw(unit_obj partsgroup classification) ], |
|
1786 |
with_objects => [ qw(unit_obj partsgroup classification parent_variants variant_property_values variant_property_values.variant_property) ],
|
|
1736 | 1787 |
disable_plugin => 'paginated', |
1737 | 1788 |
source => $::form->{multi_items}, |
1738 | 1789 |
sorted => { |
Auch abrufbar als: Unified diff
Varianten: PartPicker: mehrere Varianten eines Stammartikel hinzufügen