Kompatibilität mit Text::CSV_XS >= 0.89
[kivitendo-erp.git] / SL / CVar.pm
index c0b3f43..02456cb 100644 (file)
@@ -2,12 +2,13 @@ package CVar;
 
 use strict;
 
+use List::MoreUtils qw(any);
 use List::Util qw(first);
 use Scalar::Util qw(blessed);
 use Data::Dumper;
 
 use SL::DBUtils;
-use SL::MoreCommon qw(any listify);
+use SL::MoreCommon qw(listify);
 
 sub get_configs {
   $main::lxdebug->enter_sub();
@@ -42,6 +43,15 @@ SQL
       } elsif ($config->{type} eq 'number') {
         $config->{precision} = $1 if ($config->{options} =~ m/precision=(\d+)/i);
 
+      } elsif ($config->{type} eq 'textfield') {
+        $config->{width}  = 30;
+        $config->{height} =  5;
+        $config->{width}  = $1 if ($config->{options} =~ m/width=(\d+)/i);
+        $config->{height} = $1 if ($config->{options} =~ m/height=(\d+)/i);
+
+      } elsif ($config->{type} eq 'text') {
+        $config->{maxlength} = $1 if ($config->{options} =~ m/maxlength=(\d+)/i);
+
       }
 
       $self->_unpack_flags($config);
@@ -730,6 +740,8 @@ sub parse {
   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 !ref $value ? SL::DB::Manager::Vendor->find_by(id => $value * 1)   : $value  if $config->{type} eq 'vendor';
+  return !ref $value ? SL::DB::Manager::Part->find_by(id => $value * 1)     : $value  if $config->{type} eq 'part';
   return $value;
 }