From: Sven Schöling Date: Thu, 2 Sep 2010 14:31:46 +0000 (+0200) Subject: stub für einen generische attrhelper. X-Git-Tag: release-2.6.2beta1~145 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=4aded4e8dae01257d3d835251b9ae7c2d7c8a767;p=kivitendo-erp.git stub für einen generische attrhelper. --- diff --git a/SL/DB/Object.pm b/SL/DB/Object.pm index 1a39431c6..f9508507e 100644 --- a/SL/DB/Object.pm +++ b/SL/DB/Object.pm @@ -80,6 +80,22 @@ sub update_attributes { return $self; } +sub make_attr_helper { + my ($self) = @_; + my $package = ref $self || $self; + + for my $col ($package->meta->columns) { + next if $col->primary_key_position; # don't make attr helper for primary keys + + attr_number ($package, $col->name, -2) if $col->type =~ /numeric | real | float/xi; + attr_percent($package, $col->name, -2) if $col->type =~ /numeric | real | float/xi; + attr_number ($package, $col->name, 0) if $col->type =~ /int/xi; + attr_date ($package, $col->name) if $col->type =~ /date | timestamp/xi; + } + + return $self; +} + sub attr_number { SL::DB::Helpers::AttrNumber::define(@_); }