Wiederkehrende Rechnung mit Steuer inklusive buchen Erlöse falsch
[kivitendo-erp.git] / SL / DB / Helper / Attr.pm
index 94b53dd..8c99903 100644 (file)
@@ -33,6 +33,7 @@ sub _make_by_type {
   _as_percent($package, $name, places =>  2) if $type =~ /numeric | real | float/xi;
   _as_number ($package, $name, places =>  0) if $type =~ /int/xi;
   _as_date   ($package, $name)               if $type =~ /date | timestamp/xi;
+  _as_bool_yn($package, $name)               if $type =~ /bool/xi;
 }
 
 sub _as_number {
@@ -104,6 +105,23 @@ sub _as_date {
   return 1;
 }
 
+sub _as_bool_yn {
+  my ($package, $attribute, %params) = @_;
+
+  no strict 'refs';
+  *{ $package . '::' . $attribute . '_as_bool_yn' } = sub {
+    my ($self) = @_;
+
+    if (@_ > 1) {
+      die 'not an accessor';
+    }
+
+    return !defined $self->$attribute ? ''
+         :          $self->$attribute ? $::locale->text('Yes')
+         :                              $::locale->text('No');
+  }
+}
+
 1;
 
 
@@ -111,6 +129,8 @@ sub _as_date {
 
 __END__
 
+=encoding utf-8
+
 =head1 NAME
 
 SL::DB::Helper::Attr - attribute helpers
@@ -126,10 +146,18 @@ SL::DB::Helper::Attr - attribute helpers
 
 =head1 DESCRIPTION
 
+Makes attribute helpers.
+
 =head1 FUNCTIONS
 
+see for yourself.
+
 =head1 BUGS
 
+None yet.
+
 =head1 AUTHOR
 
+Sven Schöling <s.schoeling@linet-services.de>
+
 =cut