Revision aa7ea0f0
Von Tamino Steinert vor 10 Tagen hinzugefügt
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 $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(where => [ ean => $self->ean ]); |
|
219 | 229 |
|
220 | 230 |
if ($self->is_assortment && $self->orphaned && scalar @{$self->assortment_items} == 0) { |
221 | 231 |
# when assortment isn't orphaned form doesn't contain any items |
Auch abrufbar als: Unified diff
S:D:Part: EAN eindeutig machen