Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7fe78e85

Von Sven Schöling vor fast 2 Jahren hinzugefügt

  • ID 7fe78e8550edb55c75ba62fa1d3311cfab0a7c52
  • Vorgänger 8625a634
  • Nachfolger b341a77d

PriceRule: Warnings und Test-Folgefehler

Unterschiede anzeigen:

SL/DB/CustomVariable.pm
40 40

  
41 41
  if ($type =~ m{^(?:customer|vendor|part|number)}) {
42 42
    return $self->number_value(!defined($unparsed) ? undef
43
                               : (any { ref($unparsed) eq $_ } qw(SL::DB::Customer SL::DB::Vendor SL::DB::Part)) ? $unparsed->id * 1
43
                               : (any { ref($unparsed) eq $_ } qw(SL::DB::Customer SL::DB::Vendor SL::DB::Part)) ? $unparsed->id
44 44
                               : $unparsed * 1);
45 45
  }
46 46

  
......
76 76
  if ( $type eq 'customer' ) {
77 77
    require SL::DB::Customer;
78 78

  
79
    my $id = int($self->number_value);
79
    my $id = defined($self->number_value) ? int($self->number_value) : undef;
80 80
    return $id ? SL::DB::Customer->new(id => $id)->load() : undef;
81 81
  } elsif ( $type eq 'vendor' ) {
82 82
    require SL::DB::Vendor;
83 83

  
84
    my $id = int($self->number_value);
84
    my $id = defined($self->number_value) ? int($self->number_value) : undef;
85 85
    return $id ? SL::DB::Vendor->new(id => $id)->load() : undef;
86 86
  } elsif ( $type eq 'part' ) {
87 87
    require SL::DB::Part;
88 88

  
89
    my $id = int($self->number_value);
89
    my $id = defined($self->number_value) ? int($self->number_value) : undef;
90 90
    return $id ? SL::DB::Part->new(id => $id)->load() : undef;
91 91
  } elsif ( $type eq 'date' ) {
92 92
    return $self->timestamp_value ? $self->timestamp_value->clone->truncate(to => 'day') : undef;
t/db/price_rule.t
343 343
      searchable  => 0,
344 344
      includeable => 0,
345 345
      included_by_default => 0,
346
      flags => '',
346 347
    )->save->load;
347 348

  
348 349
    my $customer = new_customer()->save->load;
......
388 389
      searchable  => 0,
389 390
      includeable => 0,
390 391
      included_by_default => 0,
392
      flags => '',
391 393
    )->save->load;
392 394

  
393 395
    my $price_rule = SL::DB::PriceRule->new(
......
419 421
  }
420 422
}
421 423

  
424
reset_db();
422 425

  
423 426
done_testing();

Auch abrufbar als: Unified diff