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