Revision fe243aca
Von Jan Büren vor fast 2 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
1433 | 1433 |
{ isa => 'DBI::db'}, |
1434 | 1434 |
{ type => SCALAR, callbacks => { is_fx_currency => sub { shift ne $_[1]->[0]->{defaultcurrency} } } }, # should be ISO three letter codes for currency identification (ISO 4217) |
1435 | 1435 |
{ type => SCALAR, callbacks => { is_valid_kivi_date => sub { shift =~ m/\d+\d+\d+/ } } }, # we have three numers |
1436 |
{ type => SCALAR, callbacks => { is_null_or_digit => sub { $_[0] =~ m/(^0$|\d+)/ && $_[0] >= 0 } } }, # value buy fxrate |
|
1437 |
{ type => SCALAR, callbacks => { is_null_or_digit => sub { $_[0] =~ m/(^0$|\d+)/ && $_[0] >= 0 } } }, # value sell fxrate |
|
1436 |
{ type => SCALAR, callbacks => { is_null_or_ar_int => sub { $_[0] == 0 |
|
1437 |
|| $_[0] > 0 |
|
1438 |
&& $_[1]->[0]->{script} =~ m/ar\.pl|is\.pl/ } } }, # value buy fxrate |
|
1439 |
{ type => SCALAR, callbacks => { is_null_or_ap_int => sub { $_[0] == 0 |
|
1440 |
|| $_[0] > 0 |
|
1441 |
&& $_[1]->[0]->{script} =~ m/ap\.pl|ir\.pl/ } } }, # value sell fxrate |
|
1438 | 1442 |
{ type => SCALAR, callbacks => { is_current_form_id => sub { $_[0] == $_[1]->[0]->{id} } }, optional => 1 }, |
1439 | 1443 |
{ type => SCALAR, callbacks => { is_valid_fx_table => sub { shift =~ m/(ar|ap|bank_transactions)/ } }, optional => 1 } |
1440 | 1444 |
); |
... | ... | |
1512 | 1516 |
if ($record_exchange_rate && $record_exchange_rate > 0) { |
1513 | 1517 |
|
1514 | 1518 |
$main::lxdebug->leave_sub(); |
1515 |
|
|
1516 |
return $record_exchange_rate;
|
|
1519 |
# second param indicates record exchange rate |
|
1520 |
return ($record_exchange_rate, 1);
|
|
1517 | 1521 |
} |
1518 | 1522 |
} |
1519 | 1523 |
|
Auch abrufbar als: Unified diff
mehr Tests für update_exchangerate und Rückgabewert für check_exchangerate
> update_exchangerate nicht nur auf Position der Parametern sondern auch>script vertrauenden Wert im form
-> check_exchangerate gibt als zweiten Parameter den Ursprung des Wechselkurs
zurück (Beleg oder Tageskurs)