Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c5d1e2ed

Von Bernd Bleßmann vor 4 Monaten hinzugefügt

  • ID c5d1e2ed5f0877bc6fea170553fc9dfd6553ae0a
  • Vorgänger 7dd9c5f7
  • Nachfolger 1758316c

S:D:StockCounting/Item: Methoden zum Validieren

Unterschiede anzeigen:

SL/DB/StockCounting.pm
5 5

  
6 6
use strict;
7 7

  
8
use List::Util qw(none);
9

  
8 10
use SL::DB::MetaSetup::StockCounting;
9 11
use SL::DB::Manager::StockCounting;
10 12

  
13
use SL::Locale::String qw(t8);
14

  
11 15
__PACKAGE__->meta->initialize;
12 16

  
17
sub validate {
18
  my ($self) = @_;
19

  
20
  my @errors;
21

  
22
  # If part and partsgroup are given then part must belong to the partsgroup.
23
  if ($self->part && $self->partsgroup_id && $self->part->partsgroup_id != $self->partsgroup_id) {
24
    push @errors, t8('The part must belong to the partsgroup.');
25
  }
26

  
27
  # If part and vendor are given then vendor must be a make of the part.
28
  if ($self->part && $self->vendor_id && none { $_->make == $self->vendor_id } @{$self->part->makemodels}) {
29
    push @errors, t8('The vendor must be a vendor of the part.');
30
  }
31

  
32
  return @errors;
33
}
34

  
13 35
1;
SL/DB/StockCountingItem.pm
5 5

  
6 6
use strict;
7 7

  
8
use List::Util qw(none);
9

  
8 10
use SL::DB::MetaSetup::StockCountingItem;
9 11
use SL::DB::Manager::StockCountingItem;
10 12

  
13
use SL::Locale::String qw(t8);
14

  
11 15
__PACKAGE__->meta->initialize;
12 16

  
17
sub validate {
18
  my ($self) = @_;
19

  
20
  my @errors;
21

  
22
  push @errors, t8('A Stock Counting must be set.') if !$self->counting_id;
23
  push @errors, t8('A part must be set.')           if !$self->part_id;
24
  push @errors, t8('A bin must be set.')            if !$self->bin_id;
25

  
26
  # If part in counting is given then it must match the part of the item to count.
27
  if ($self->counting->part_id && $self->part_id != $self->counting->part_id) {
28
    push @errors, t8('The part must match the part given in the counting.');
29
  }
30

  
31
  # If partsgroup in counting is given then the part of the item to count must belong to the partsgroup.
32
  if ($self->counting->partsgroup_id && $self->part->partsgroup_id != $self->counting->partsgroup_id) {
33
    push @errors, t8('The part must belong to the partsgroup given in the counting.');
34
  }
35

  
36
  # If vendor in counting is given then the vendor must be a make of the part of the item to count.
37
  if ($self->counting->vendor_id && none { $_->make == $self->counting->vendor_id } @{$self->part->makemodels}) {
38
    push @errors, t8('The vendor given in the counting must be a vendor of the part.');
39
  }
40

  
41
  return @errors;
42
}
43

  
13 44
1;
locale/de/all
4191 4191
  'The order intake has been deleted' => 'Der Auftragseingang wurde gelöscht',
4192 4192
  'The order intake has been saved' => 'Der Auftragseingang wurde gespeichert',
4193 4193
  'The package name is invalid.' => 'Der Paketname ist ungültig.',
4194
  'The part must belong to the partsgroup.' => 'Die Ware muss zur Warengruppe gehören.',
4194 4195
  'The partnumber already exists!' => 'Die Artikelnummer wird bereits verwendet.',
4195 4196
  'The partnumber already exists.' => 'Die Artikelnummer wird bereits verwendet.',
4196 4197
  'The partnumber is already being used' => 'Der Artikel ist bereits in Verwendung',
......
4335 4336
  'The value \'our routing id at customer\' must be set in the customer\'s master data for profile #1.' => 'Der Wert »unsere Leitweg-ID beim Kunden« muss in den Kundenstammdaten gesetzt sein für Profil #1.',
4336 4337
  'The variable name must only consist of letters, numbers and underscores. It must begin with a letter. Example: send_christmas_present' => 'Der Variablenname darf nur aus Zeichen (keine Umlaute), Ziffern und Unterstrichen bestehen. Er muss mit einem Buchstaben beginnen. Beispiel: weihnachtsgruss_verschicken',
4337 4338
  'The vendor could not be found. Please register the vendor with the exact name from the QR bill as shown below.' => 'Der Lieferant konnte nicht gefunden werden. Bitte registrieren Sie den Lieferanten mit dem exakten Namen aus der QR-Rechnung wie unten angezeigt.',
4339
  'The vendor must be a vendor of the part.' => 'Der Lieferant muss ein Lieferant der Ware sein.',
4338 4340
  'The vendor name is missing.' => 'Der Liefeantenname fehlt.',
4339 4341
  'The version number is missing.' => 'Die Versionsnummer fehlt.',
4340 4342
  'The warehouse could not be deleted because it has already been used.' => 'Das Lager konnte nicht gelöscht werden, da es bereits in Benutzung war.',
locale/en/all
4189 4189
  'The order intake has been deleted' => '',
4190 4190
  'The order intake has been saved' => '',
4191 4191
  'The package name is invalid.' => '',
4192
  'The part must belong to the partsgroup.' => '',
4192 4193
  'The partnumber already exists!' => '',
4193 4194
  'The partnumber already exists.' => '',
4194 4195
  'The partnumber is already being used' => '',
......
4333 4334
  'The value \'our routing id at customer\' must be set in the customer\'s master data for profile #1.' => '',
4334 4335
  'The variable name must only consist of letters, numbers and underscores. It must begin with a letter. Example: send_christmas_present' => '',
4335 4336
  'The vendor could not be found. Please register the vendor with the exact name from the QR bill as shown below.' => '',
4337
  'The vendor must be a vendor of the part.' => '',
4336 4338
  'The vendor name is missing.' => '',
4337 4339
  'The version number is missing.' => '',
4338 4340
  'The warehouse could not be deleted because it has already been used.' => '',

Auch abrufbar als: Unified diff