Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision cbb1f3f2

Von Jan Büren vor mehr als 1 Jahr hinzugefügt

  • ID cbb1f3f20a7c9d574b22d3bd98c842801c5ec148
  • Vorgänger 5a485635
  • Nachfolger 46a49667

Form: check_exchangerate auf Parameter-Validierung umgestellt

Unterschiede anzeigen:

SL/Form.pm
49 49
use File::Temp ();
50 50
use IO::File;
51 51
use Math::BigInt;
52
use Params::Validate qw(:all);
52 53
use POSIX qw(strftime);
53 54
use SL::Auth;
54 55
use SL::Auth::DB;
......
1538 1539
sub check_exchangerate {
1539 1540
  $main::lxdebug->enter_sub();
1540 1541

  
1541
  my ($self, $myconfig, $currency, $transdate, $fld) = @_;
1542

  
1543
  if ($fld !~/^buy|sell$/) {
1544
    $self->error('Fatal: check_exchangerate called with invalid buy/sell argument');
1545
  }
1546

  
1547
  unless ($transdate) {
1548
    $main::lxdebug->leave_sub();
1549
    return "";
1550
  }
1542
  my $self = shift;
1543
  validate_pos(@_,
1544
                 { type => HASHREF, callbacks => { has_yy_in_dateformat => sub { $_[0]->{dateformat} =~ m/yy/ } } },
1545
                 { type => SCALAR  }, # should be ISO three letter codes for currency identification (ISO 4217)
1546
                 { type => SCALAR, callbacks  => { is_valid_kivi_date   => sub { shift =~ m/\d+\d+\d+/ } } }, # we have three numers
1547
                 { type => SCALAR, callbacks  => { is_buy_or_sell_rate  => sub { shift =~ m/^buy|sell$/ } } },
1548
              );
1549
  my ($myconfig, $currency, $transdate, $fld) = @_;
1551 1550

  
1552 1551
  my ($defaultcurrency) = $self->get_default_currency($myconfig);
1553

  
1554 1552
  if ($currency eq $defaultcurrency) {
1555 1553
    $main::lxdebug->leave_sub();
1556 1554
    return 1;

Auch abrufbar als: Unified diff