Revision 3c3d13d8
Von Jan Büren vor mehr als 2 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
{ isa => 'DBI::db'},
|
||
{ type => SCALAR, callbacks => { is_fx_currency => sub { shift ne $_[1]->[0]->{defaultcurrency} } } }, # should be ISO three letter codes for currency identification (ISO 4217)
|
||
{ type => SCALAR, callbacks => { is_valid_kivi_date => sub { shift =~ m/\d+\d+\d+/ } } }, # we have three numers
|
||
{ type => SCALAR, callbacks => { is_null_or_digit => sub { $_[0] =~ m/(^0$|\d+)/ && $_[0] >= 0 } } }, # value buy fxrate
|
||
{ type => SCALAR, callbacks => { is_null_or_digit => sub { $_[0] =~ m/(^0$|\d+)/ && $_[0] >= 0 } } }, # value sell fxrate
|
||
{ type => SCALAR, callbacks => { is_null_or_ar_int => sub { $_[0] == 0
|
||
|| $_[0] > 0
|
||
&& $_[1]->[0]->{script} =~ m/ar\.pl|is\.pl/ } } }, # value buy fxrate
|
||
{ type => SCALAR, callbacks => { is_null_or_ap_int => sub { $_[0] == 0
|
||
|| $_[0] > 0
|
||
&& $_[1]->[0]->{script} =~ m/ap\.pl|ir\.pl/ } } }, # value sell fxrate
|
||
{ type => SCALAR, callbacks => { is_current_form_id => sub { $_[0] == $_[1]->[0]->{id} } }, optional => 1 },
|
||
{ type => SCALAR, callbacks => { is_valid_fx_table => sub { shift =~ m/(ar|ap|bank_transactions)/ } }, optional => 1 }
|
||
);
|
||
... | ... | |
if ($record_exchange_rate && $record_exchange_rate > 0) {
|
||
|
||
$main::lxdebug->leave_sub();
|
||
|
||
return $record_exchange_rate;
|
||
# second param indicates record exchange rate
|
||
return ($record_exchange_rate, 1);
|
||
}
|
||
}
|
||
|
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)