Revision 8de87351
Von Tamino Steinert vor 23 Tagen hinzugefügt
SL/Controller/Part.pm | ||
---|---|---|
34 | 34 |
use SL::JSON; |
35 | 35 |
use SL::Locale::String qw(t8); |
36 | 36 |
use SL::MoreCommon qw(save_form); |
37 |
use SL::Presenter; |
|
37 | 38 |
use SL::Presenter::EscapedText qw(escape is_escaped); |
38 | 39 |
use SL::Presenter::Part; |
39 | 40 |
use SL::Presenter::Tag qw(select_tag); |
... | ... | |
739 | 740 |
} |
740 | 741 |
} |
741 | 742 |
|
743 |
sub action_show_multi_variants_dialog { |
|
744 |
my ($self) = @_; |
|
745 |
|
|
746 |
$self->render('part/_multi_variants_dialog', { layout => 0 }); |
|
747 |
} |
|
748 |
|
|
749 |
sub action_multi_variants_update_result { |
|
750 |
my ($self) = @_; |
|
751 |
my $max_count = $::form->{limit}; |
|
752 |
|
|
753 |
my $parent_variant_id = $::form->{multi_items}->{filter}->{parent_variant_id}; |
|
754 |
my $parent_variant; |
|
755 |
$parent_variant = SL::DB::Manager::Part->find_by( |
|
756 |
id => $parent_variant_id |
|
757 |
) if $parent_variant_id ne ''; |
|
758 |
return $self->js->flash('error', t8('No parent variant selected.'))->render |
|
759 |
unless $parent_variant; |
|
760 |
|
|
761 |
|
|
762 |
if ($::form->{old_parent_variant_id} ne $parent_variant_id) { |
|
763 |
# update parent_variant properties |
|
764 |
my $properties_table = SL::Presenter->get->render( |
|
765 |
'part/_multi_variants_parent_properties_table', |
|
766 |
PROPERTIES => \@{$parent_variant->variant_properties} |
|
767 |
); |
|
768 |
$::form->{multi_items}->{filter}->{'has_variant_property_value_id'} = []; |
|
769 |
$self->js->html('#multi_variants_parent_variant_properties', $properties_table); |
|
770 |
$self->js->val('#old_parent_variant_id', $parent_variant_id); |
|
771 |
} |
|
772 |
|
|
773 |
my $count = $self->multi_items_models->count; |
|
774 |
|
|
775 |
my $result; |
|
776 |
if ($count == 0) { |
|
777 |
my $text = escape($::locale->text('No results.')); |
|
778 |
$result = $text; |
|
779 |
} elsif ($max_count && $count > $max_count) { |
|
780 |
my $text = escape($::locale->text('Too many results (#1 from #2).', $count, $max_count)); |
|
781 |
$result = $text; |
|
782 |
} else { |
|
783 |
my $multi_variants = SL::DB::Manager::Part->sort_variants( |
|
784 |
$self->multi_items_models->get |
|
785 |
); |
|
786 |
$result = SL::Presenter->get->render('part/_multi_variants_result', multi_variants => $multi_variants); |
|
787 |
} |
|
788 |
|
|
789 |
$self->js->html('#multi_items_result', $result)->render; |
|
790 |
return; |
|
791 |
} |
|
792 |
|
|
742 | 793 |
sub action_add_makemodel_row { |
743 | 794 |
my ($self) = @_; |
744 | 795 |
|
... | ... | |
1766 | 1817 |
SL::Controller::Helper::GetModels->new( |
1767 | 1818 |
controller => $_[0], |
1768 | 1819 |
model => 'Part', |
1769 |
with_objects => [ qw(unit_obj partsgroup classification) ], |
|
1820 |
with_objects => [ qw(unit_obj partsgroup classification parent_variants variant_property_values variant_property_values.variant_property) ],
|
|
1770 | 1821 |
disable_plugin => 'paginated', |
1771 | 1822 |
source => $::form->{multi_items}, |
1772 | 1823 |
sorted => { |
Auch abrufbar als: Unified diff
Varianten: PartPicker: mehrere Varianten eines Stammartikel hinzufügen