Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 1861cb74

Von Tamino Steinert vor 6 Tagen hinzugefügt

  • ID 1861cb749f71d74f0fb4f041f7c714362c37224a
  • Vorgänger 4d65e27a
  • Nachfolger daa95513

Varianten: alle Artikeltypen ermöglichen

Unterschiede anzeigen:

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

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

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

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

  
344 343
  $self->redirect_to(
......
454 453
                     assembly       => t8('Edit Assembly'),
455 454
                     service        => t8('Edit Service'),
456 455
                     assortment     => t8('Edit Assortment'),
457
                     parent_variant => t8('Edit Parent Variant'),
458
                     variant        => t8('Edit Variant'),
459 456
                   );
457
  my $title = $title_hash{$self->part->part_type};
458
  $title .=
459
    ' (' . SL::Presenter::Part::variant_type_abbreviation($self->part->variant_type) . ')'
460
    if $self->part->variant_type;
460 461

  
461 462
  $self->part->prices([])       unless $self->part->prices;
462 463
  $self->part->translations([]) unless $self->part->translations;
463 464

  
464 465
  $self->render(
465 466
    'part/form',
466
    title             => $title_hash{$self->part->part_type},
467
    title             => $title,
467 468
    %assortment_vars,
468 469
    %assembly_vars,
469 470
    %parent_variant_vars,
......
1123 1124
                     assembly       => t8('Add Assembly'),
1124 1125
                     service        => t8('Add Service'),
1125 1126
                     assortment     => t8('Add Assortment'),
1126
                     parent_variant => t8('Add Parent Variant'),
1127
                     variant        => t8('Add Variant'),
1128 1127
                   );
1128
  my $title = $title_hash{$self->part->part_type};
1129
  $title .=
1130
    ' (' . SL::Presenter::Part::variant_type_abbreviation($self->part->variant_type) . ')'
1131
    if $self->part->variant_type;
1129 1132

  
1130 1133
  $self->render(
1131 1134
    'part/form',
1132
    title => $title_hash{$self->part->part_type},
1135
    title => $title,
1133 1136
  );
1134 1137
}
1135 1138

  
......
1776 1779
}
1777 1780

  
1778 1781
sub check_has_valid_part_type {
1779
  die "invalid part_type" unless $_[0] =~ /^(part|service|assembly|assortment|parent_variant|variant)$/;
1782
  Carp::confess "invalid part_type" unless $_[0] =~ /^(part|service|assembly|assortment)$/;
1780 1783
}
1781 1784

  
1782 1785

  

Auch abrufbar als: Unified diff