Revision aa7ea0f0
Von Tamino Steinert vor 17 Tagen hinzugefügt
SL/DB/MetaSetup/Part.pm | ||
---|---|---|
53 | 53 |
|
54 | 54 |
__PACKAGE__->meta->primary_key_columns([ 'id' ]); |
55 | 55 |
|
56 |
__PACKAGE__->meta->unique_keys([ 'partnumber' ]); |
|
56 |
__PACKAGE__->meta->unique_keys( |
|
57 |
[ 'ean' ], |
|
58 |
[ 'partnumber' ], |
|
59 |
); |
|
57 | 60 |
|
58 | 61 |
__PACKAGE__->meta->allow_inline_column_values(1); |
59 | 62 |
|
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 |
locale/de/all | ||
---|---|---|
4136 | 4136 |
'The document has been printed.' => 'Das Dokument wurde gedruckt.', |
4137 | 4137 |
'The documents have been sent to the printer \'#1\'.' => 'Die Dokumente sind zum Drucker \'#1\' geschickt', |
4138 | 4138 |
'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.', |
4139 |
'The ean already exists.' => 'Diese EAN existiert bereits', |
|
4139 | 4140 |
'The email entry for #1 looks invalid' => 'Die eingetragene E-Mail-Adresse für #1 sieht ungültig aus.', |
4140 | 4141 |
'The email has been sent.' => 'Die E-Mail wurde verschickt.', |
4141 | 4142 |
'The email was not sent due to the following error: #1.' => 'Die E-Mail wurde aufgrund des folgenden Fehlers nicht verschickt: #1', |
locale/en/all | ||
---|---|---|
4134 | 4134 |
'The document has been printed.' => '', |
4135 | 4135 |
'The documents have been sent to the printer \'#1\'.' => '', |
4136 | 4136 |
'The dunnings have been printed.' => '', |
4137 |
'The ean already exists.' => '', |
|
4137 | 4138 |
'The email entry for #1 looks invalid' => '', |
4138 | 4139 |
'The email has been sent.' => '', |
4139 | 4140 |
'The email was not sent due to the following error: #1.' => '', |
sql/Pg-upgrade2/parts_ean_unique.sql | ||
---|---|---|
1 |
-- @tag: parts_ean_unique |
|
2 |
-- @description: EAN in Artikel eindeutig machen |
|
3 |
-- @depends: release_3_8_0 |
|
4 |
-- @ignore: 0 |
|
5 |
|
|
6 |
UPDATE parts SET ean = null where ean = ''; |
|
7 |
ALTER TABLE parts ADD CONSTRAINT parts_ean_unique UNIQUE(ean); |
Auch abrufbar als: Unified diff
S:D:Part: EAN eindeutig machen