Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fe4751de

Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt

  • ID fe4751dee76f518853a0546a2b0ef4149c2324c4
  • Vorgänger a261c693
  • Nachfolger 2a0a0b32

SL::DB::CustomVariable::{value,value_as_text}: Verwendung von $::request->cache()

Unterschiede anzeigen:

SL/DB/CustomVariable.pm
20 20
sub _ensure_config {
21 21
  my ($self) = @_;
22 22

  
23
  return $self->config if  $self->config;
23
  return $self->config if  defined $self->{config};
24 24
  return undef         if !defined $self->config_id;
25
  $self->config( SL::DB::CustomVariableConfig->new(id => $self->config_id)->load );
25

  
26
  no warnings 'once';
27
  return $::request->cache('config_by_id')->{$self->config_id} //= SL::DB::CustomVariableConfig->new(id => $self->config_id)->load;
26 28
}
27 29

  
28 30
sub parse_value {
......
80 82

  
81 83
sub value_as_text {
82 84
  my $self = $_[0];
83
  my $type = $self->config->type;
85
  my $cfg  = $self->_ensure_config;
86
  my $type = $cfg->type;
84 87

  
85 88
  die 'not an accessor' if @_ > 1;
86 89

  
......
89 92
  } elsif ($type eq 'timestamp') {
90 93
    return $::locale->reformat_date( { dateformat => 'yy-mm-dd' }, $self->timestamp_value->ymd, $::myconfig{dateformat});
91 94
  } elsif ($type eq 'number') {
92
    return $::form->format_amount(\%::myconfig, $self->number_value, $self->config->processed_options->{PRECISION});
95
    return $::form->format_amount(\%::myconfig, $self->number_value, $cfg->processed_options->{PRECISION});
93 96
  } elsif ( $type eq 'customer' ) {
94 97
    require SL::DB::Customer;
95 98

  

Auch abrufbar als: Unified diff