Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 53c21645

Von Jan Büren vor etwa 2 Jahren hinzugefügt

  • ID 53c216458df42d677d8282332fe18bb457ca1637
  • Vorgänger 92bdcd10
  • Nachfolger f95e112a

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;
......
1536 1537
sub check_exchangerate {
1537 1538
  $main::lxdebug->enter_sub();
1538 1539

  
1539
  my ($self, $myconfig, $currency, $transdate, $fld) = @_;
1540

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

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

  
1550 1549
  my ($defaultcurrency) = $self->get_default_currency($myconfig);
1551

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

Auch abrufbar als: Unified diff