]> wagnertech.de Git - mfinanz.git/blobdiff - SL/CVar.pm
cvars in aufträgen bei update korrekt parsen und formatieren
[mfinanz.git] / SL / CVar.pm
index e91a2366dbb0cb6bab9b9b214cb79a988b9ceec8..2408222782c2ab8a13b0e573a2336415ccf1723e 100644 (file)
@@ -3,6 +3,7 @@ package CVar;
 use strict;
 
 use List::Util qw(first);
+use Scalar::Util qw(blessed);
 use Data::Dumper;
 
 use SL::DBUtils;
@@ -706,6 +707,15 @@ sub custom_variables_validity_by_trans_id {
   return sub { !$invalids{+shift} };
 }
 
+sub parse {
+  my ($self, $value, $config) = @_;
+
+  return $::form->parse_amount(\%::myconfig, $value)          if $config->{type} eq 'number';
+  return DateTime->from_lxoffice($value)                      if $config->{type} eq 'date';
+  return !ref $value ? SL::DB::Manager::Customer->find_by(id => $value * 1) : $value  if $config->{type} eq 'customer';
+  return $value;
+}
+
 1;
 
 __END__