Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9f892f4e

Von Sven Schöling vor mehr als 6 Jahren hinzugefügt

  • ID 9f892f4e6bc40ede85dad9f1ef9efa6f3c9dc65a
  • Vorgänger 4ad23419
  • Nachfolger d255a1f6

CVar::parse: Objekte cached laden

Unterschiede anzeigen:

SL/CVar.pm
671 671
sub parse {
672 672
  my ($self, $value, $config) = @_;
673 673

  
674
  return undef unless defined $value;
675
  return undef if $value eq '';
676

  
674 677
  return $::form->parse_amount(\%::myconfig, $value)          if $config->{type} eq 'number';
675 678
  return DateTime->from_lxoffice($value)                      if $config->{type} eq 'date';
676
  return !ref $value ? SL::DB::Manager::Customer->find_by(id => $value * 1) : $value  if $config->{type} eq 'customer';
677
  return !ref $value ? SL::DB::Manager::Vendor->find_by(id => $value * 1)   : $value  if $config->{type} eq 'vendor';
678
  return !ref $value ? SL::DB::Manager::Part->find_by(id => $value * 1)     : $value  if $config->{type} eq 'part';
679
  return !ref $value ? SL::DB::Customer->load_cached($value) : $value  if $config->{type} eq 'customer';
680
  return !ref $value ? SL::DB::Vendor->load_cached($value)   : $value  if $config->{type} eq 'vendor';
681
  return !ref $value ? SL::DB::Part->load_cached($value)     : $value  if $config->{type} eq 'part';
679 682
  return $value;
680 683
}
681 684

  

Auch abrufbar als: Unified diff