Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 092a8193

Von Tamino Steinert vor 5 Tagen hinzugefügt

  • ID 092a81936b3e09786b840fb5aec23092b16c0063
  • Vorgänger 76a8257b
  • Nachfolger 5a8094ff

S:D:Part: EAN eindeutig machen

Unterschiede anzeigen:

SL/DB/Part.pm
136 136
__PACKAGE__->attr_sorted('businessmodels');
137 137

  
138 138
__PACKAGE__->before_save('_before_save_set_partnumber');
139
__PACKAGE__->before_save('_before_save_remove_empty_ean');
139 140
__PACKAGE__->before_save('_before_save_set_assembly_weight');
140 141
__PACKAGE__->before_save('_before_check_variant_property_values');
141 142

  
......
146 147
  return 1;
147 148
}
148 149

  
150
sub _before_save_remove_empty_ean {
151
  my ($self) = @_;
152

  
153
  $self->ean(undef) if defined $self->ean && $self->ean eq '';
154
  return 1;
155
}
156

  
157

  
149 158
sub _before_save_set_assembly_weight {
150 159
  my ($self) = @_;
151 160

  
......
216 225
  unless ( $self->id ) {
217 226
    push @errors, $::locale->text('The partnumber already exists.') if SL::DB::Manager::Part->get_all_count(where => [ partnumber => $self->partnumber ]);
218 227
  }
228
  push @errors, $::locale->text('The ean already exists.') if $self->ean ne '' && SL::DB::Manager::Part->get_all_count(
229
    where => [
230
      ean   => $self->ean,
231
      '!id' => $self->id,
232
    ]
233
  );
219 234

  
220 235
  if ($self->is_assortment && $self->orphaned && scalar @{$self->assortment_items} == 0) {
221 236
    # when assortment isn't orphaned form doesn't contain any items

Auch abrufbar als: Unified diff