Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bc8ddcc1

Von Tamino Steinert vor 12 Monaten hinzugefügt

  • ID bc8ddcc1e89d5a73e60af488d21e2bb0ec000cad
  • Vorgänger 93b347a8
  • Nachfolger 8a0d2996

Varianten: alle Artikeltypen ermöglichen

Unterschiede anzeigen:

SL/Controller/Part.pm
93 93
  my ($self, %params) = @_;
94 94

  
95 95
  $self->part( SL::DB::Part->new_parent_variant );
96
  $self->part->part_type($::form->{part_type});
96 97
  $self->add;
97 98
}
98 99

  
......
117 118
  $self->action_add_service        if $::form->{part_type} eq 'service';
118 119
  $self->action_add_assembly       if $::form->{part_type} eq 'assembly';
119 120
  $self->action_add_assortment     if $::form->{part_type} eq 'assortment';
120
  $self->action_add_parent_variant if $::form->{part_type} eq 'parent_variant';
121
  $self->action_add_variant        if $::form->{part_type} eq 'variant';
122 121
};
123 122

  
124 123
sub action_save {
......
337 336
      for @variant_property_values_lists;
338 337
    1;
339 338
  }) or do {
340
    return $self->js->error(t8('Error while creating variants: ' . @_))->render();
339
    die t8('Error while creating variants: '), $@;
341 340
  };
342 341

  
343 342
  $self->redirect_to(
......
447 446
                     assembly       => t8('Edit Assembly'),
448 447
                     service        => t8('Edit Service'),
449 448
                     assortment     => t8('Edit Assortment'),
450
                     parent_variant => t8('Edit Parent Variant'),
451
                     variant        => t8('Edit Variant'),
452 449
                   );
450
  my $title = $title_hash{$self->part->part_type};
451
  $title .=
452
    ' (' . SL::Presenter::Part::variant_type_abbreviation($self->part->variant_type) . ')'
453
    if $self->part->variant_type;
453 454

  
454 455
  $self->part->prices([])       unless $self->part->prices;
455 456
  $self->part->translations([]) unless $self->part->translations;
456 457

  
457 458
  $self->render(
458 459
    'part/form',
459
    title             => $title_hash{$self->part->part_type},
460
    title             => $title,
460 461
    %assortment_vars,
461 462
    %assembly_vars,
462 463
    %parent_variant_vars,
......
1114 1115
                     assembly       => t8('Add Assembly'),
1115 1116
                     service        => t8('Add Service'),
1116 1117
                     assortment     => t8('Add Assortment'),
1117
                     parent_variant => t8('Add Parent Variant'),
1118
                     variant        => t8('Add Variant'),
1119 1118
                   );
1119
  my $title = $title_hash{$self->part->part_type};
1120
  $title .=
1121
    ' (' . SL::Presenter::Part::variant_type_abbreviation($self->part->variant_type) . ')'
1122
    if $self->part->variant_type;
1120 1123

  
1121 1124
  $self->render(
1122 1125
    'part/form',
1123
    title => $title_hash{$self->part->part_type},
1126
    title => $title,
1124 1127
  );
1125 1128
}
1126 1129

  
......
1742 1745
}
1743 1746

  
1744 1747
sub check_has_valid_part_type {
1745
  die "invalid part_type" unless $_[0] =~ /^(part|service|assembly|assortment|parent_variant|variant)$/;
1748
  Carp::confess "invalid part_type" unless $_[0] =~ /^(part|service|assembly|assortment)$/;
1746 1749
}
1747 1750

  
1748 1751

  

Auch abrufbar als: Unified diff