Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c5d1e2ed

Von Bernd Bleßmann vor 28 Tagen 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;

Auch abrufbar als: Unified diff