Revision 3c3d13d8
Von Jan Büren vor etwa 2 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
1431 | 1431 |
{ isa => 'DBI::db'}, |
1432 | 1432 |
{ type => SCALAR, callbacks => { is_fx_currency => sub { shift ne $_[1]->[0]->{defaultcurrency} } } }, # should be ISO three letter codes for currency identification (ISO 4217) |
1433 | 1433 |
{ type => SCALAR, callbacks => { is_valid_kivi_date => sub { shift =~ m/\d+\d+\d+/ } } }, # we have three numers |
1434 |
{ type => SCALAR, callbacks => { is_null_or_digit => sub { $_[0] =~ m/(^0$|\d+)/ && $_[0] >= 0 } } }, # value buy fxrate |
|
1435 |
{ type => SCALAR, callbacks => { is_null_or_digit => sub { $_[0] =~ m/(^0$|\d+)/ && $_[0] >= 0 } } }, # value sell fxrate |
|
1434 |
{ type => SCALAR, callbacks => { is_null_or_ar_int => sub { $_[0] == 0 |
|
1435 |
|| $_[0] > 0 |
|
1436 |
&& $_[1]->[0]->{script} =~ m/ar\.pl|is\.pl/ } } }, # value buy fxrate |
|
1437 |
{ type => SCALAR, callbacks => { is_null_or_ap_int => sub { $_[0] == 0 |
|
1438 |
|| $_[0] > 0 |
|
1439 |
&& $_[1]->[0]->{script} =~ m/ap\.pl|ir\.pl/ } } }, # value sell fxrate |
|
1436 | 1440 |
{ type => SCALAR, callbacks => { is_current_form_id => sub { $_[0] == $_[1]->[0]->{id} } }, optional => 1 }, |
1437 | 1441 |
{ type => SCALAR, callbacks => { is_valid_fx_table => sub { shift =~ m/(ar|ap|bank_transactions)/ } }, optional => 1 } |
1438 | 1442 |
); |
... | ... | |
1510 | 1514 |
if ($record_exchange_rate && $record_exchange_rate > 0) { |
1511 | 1515 |
|
1512 | 1516 |
$main::lxdebug->leave_sub(); |
1513 |
|
|
1514 |
return $record_exchange_rate;
|
|
1517 |
# second param indicates record exchange rate |
|
1518 |
return ($record_exchange_rate, 1);
|
|
1515 | 1519 |
} |
1516 | 1520 |
} |
1517 | 1521 |
|
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)