Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9f6a981f

Von Werner Hahn vor 11 Monaten hinzugefügt

  • ID 9f6a981f10c69e80f68fc1223040aff4013ff84f
  • Vorgänger 2480121f
  • Nachfolger f36c200a

VariantProperty: EIgenschaft anlegen

Unterschiede anzeigen:

SL/Controller/VariantProperty.pm
23 23
  my ($self) = @_;
24 24

  
25 25
  $self->_setup_list_action_bar;
26
  $self->render('variant_property/list',
26
  $self->render('variant_property/variant_property_list',
27 27
                title             => t8('Variant Property'),
28 28
                VARIANTPROPERTIES => SL::DB::Manager::VariantProperty->get_all_sorted,
29 29
               );
......
34 34

  
35 35
  my $is_new = !$self->variant_property->id;
36 36
  $self->_setup_form_action_bar;
37
  $self->render('variant_property/variant_propertie_form', title => ($is_new ? t8('Add Variant Property') : t8('Edit Variant Property')));
37
  $self->render('variant_property/variant_property_form', title => ($is_new ? t8('Add Variant Property') : t8('Edit Variant Property')));
38 38
}
39 39

  
40 40
sub action_save_property {
41 41
  my ($self) = @_;
42 42

  
43
  $self->create_or_update;
43
  $self->create_or_update_property;
44 44
}
45 45

  
46 46
sub action_delete_property {
......
51 51
  } else {
52 52
    flash_later('error', $::locale->text('The shop is in use and cannot be deleted.'));
53 53
  };
54
  $self->redirect_to(action => 'list');
54
  $self->redirect_to(action => 'list_properties');
55 55
}
56 56

  
57 57
sub action_reorder_properties {
......
66 66
#
67 67

  
68 68
sub init_variant_property {
69
  SL::DB::Manager::VariantProperty::find_by_or_create(id => $::form->{id} || 0)->assign_attributes(%{ $::form->{variant_property} });
69
  SL::DB::Manager::VariantProperty->find_by_or_create(id => $::form->{id} || 0)->assign_attributes(%{ $::form->{variant_property} });
70 70
}
71 71

  
72 72
#
......
81 81
  my @errors = $self->variant_property->validate;
82 82
  if (@errors) {
83 83
    flash('error', @errors);
84
    $self->action_edit();
84
    $self->action_edit_property();
85 85
    return;
86 86
  }
87 87

  
88 88
  $self->variant_property->save;
89 89

  
90 90
  flash_later('info', $is_new ? t8('The Variant Property has been created.') : t8('The Variant Property has been saved.'));
91
  $self->redirect_to(action => 'list_property');
91
  $self->redirect_to(action => 'list_properties');
92 92
}
93 93

  
94 94
sub _setup_form_action_bar {
SL/DB/VariantProperty.pm
19 19

  
20 20
__PACKAGE__->meta->initialize;
21 21

  
22
sub validate {
23
  my ($self) = @_;
24

  
25
  my @errors;
26
  # critical checks
27
  push @errors, $::locale->text('The name is missing.') unless $self->{name};
28
  push @errors, $::locale->text('The unique name is missing.')        unless $self->{unique_name};
29
  push @errors, $::locale->text('The abbreviation is missing')    unless $self->{abbreviation};
30
  return @errors;
31
}
32

  
22 33
1;
templates/design40_webpages/variant_property/variant_property_list.html
17 17
    </tr>
18 18
  </thead>
19 19
  <tbody>
20
    [% FOREACH row = SELF.VARIANTPROPERTIES %]
20
    [% FOREACH row = VARIANTPROPERTIES %]
21 21
      <tr>
22 22
        <td>[% row.name         | html %]</td>
23 23
        <td>[% row.unique_name  | html %]</td>
24
        <td>[% row.abbraviation | html %]</td>
24
        <td>[% row.abbreviation | html %]</td>
25 25
      </tr>
26 26
    [% END %]
27 27
  </tbody>

Auch abrufbar als: Unified diff