Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 53d15b75

Von Kivitendo Admin vor etwa 8 Jahren hinzugefügt

  • ID 53d15b75d74b5db63bd41be18be774ecd26d9451
  • Vorgänger 65de6f61
  • Nachfolger 13fb6d81

SL::DB::Part - neue Methode validate

Unterschiede anzeigen:

SL/DB/Part.pm
58 58
  return 1;
59 59
}
60 60

  
61
sub validate {
62
  my ($self) = @_;
63

  
64
  my @errors;
65
  push @errors, $::locale->text('The partnumber is missing.')     unless $self->partnumber;
66
  push @errors, $::locale->text('The unit is missing.')           unless $self->unit;
67
  push @errors, $::locale->text('The buchungsgruppe is missing.') unless $self->buchungsgruppen_id or $self->buchungsgruppe;
68

  
69
  unless ( $self->id ) {
70
    push @errors, $::locale->text('The partnumber already exists.') if SL::DB::Manager::Part->get_all_count(where => [ partnumber => $self->partnumber ]);
71
  };
72

  
73
  if ($self->is_assortment && scalar @{$self->assortment_items} == 0) {
74
    push @errors, $::locale->text('The assortment doesn\'t have any items.');
75
  }
76

  
77
  if ($self->is_assembly && scalar @{$self->assemblies} == 0) {
78
    push @errors, $::locale->text('The assembly doesn\'t have any items.');
79
  }
80

  
81
  return @errors;
82
}
83

  
61 84
sub is_type {
62 85
  my $self = shift;
63 86
  my $type  = lc(shift || '');

Auch abrufbar als: Unified diff