Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2e19b5c0

Von Tamino Steinert vor etwa 1 Jahr hinzugefügt

  • ID 2e19b5c00190067c491b149ff88458e887c25cb5
  • Vorgänger 4ebee618
  • Nachfolger 6a5a4049

Varianten: Schnellbearbeitung von Varianten

Unterschiede anzeigen:

SL/Controller/Part.pm
$select_tag_options{empty_title} = t8("Select Variant Property First");
}
foreach my $variant (@{$self->part->variants}) {
my $select_tag_name = "add_variant_property_value_" . $variant->id;
my $new_select_tag = select_tag(
$select_tag_name, \@options,
%select_tag_options
);
$self->js->replaceWith("#$select_tag_name", $new_select_tag);
}
my $new_select_tag = select_tag(
"variants[].add_variant_property_value", \@options,
%select_tag_options
);
$self->js->replaceWith('[name^="variants[].add_variant_property_value"]', $new_select_tag);
my $new_select_tag_multible = select_tag(
"add_variant_property_value_for_selected_variants", \@options,
%select_tag_options
);
$self->js->replaceWith("#add_variant_property_value_for_selected_variants", $new_select_tag_multible);
$self->js->render();
}
......
my $variant_property_id = $::form->{add_variant_property};
die t8("Please select a variant property") unless ($variant_property_id);
my %variant_id_to_values = map {$_->{id} => $_} @{$::form->{variants}};
foreach my $variant (@{$self->part->variants}) {
die t8("Please select a new variant property value for all variants")
unless $::form->{"add_variant_property_value_" . $variant->id};
unless $variant_id_to_values{$variant->id}->{"add_variant_property_value"};
}
SL::DB->client->with_transaction(sub {
......
foreach my $variant (@{$self->part->variants}) {
SL::DB::VariantPropertyValuePart->new(
part_id => $variant->id,
variant_property_value_id => $::form->{"add_variant_property_value_" . $variant->id},
variant_property_value_id => $variant_id_to_values{$variant->id}->{"add_variant_property_value"},
)->save;
}
1;

Auch abrufbar als: Unified diff