]> wagnertech.de Git - mfinanz.git/blobdiff - SL/BackgroundJob/ConvertTimeRecordings.pm
Zeiterfassung: Konvertierung: nur benötigte Paramter an new_from_time_recordings
[mfinanz.git] / SL / BackgroundJob / ConvertTimeRecordings.pm
index 1b2e53824608eed75ac201461b7e63d6bb1416a3..3071a57ceb90f0213ab0f4b3cdd17e919b859a32 100644 (file)
@@ -44,8 +44,7 @@ sub run {
                                                                                  '!duration' => undef,
                                                                                  %customer_where]);
 
-  # no time recordings at all ? -> better exit here before iterating a empty hash
-  # return undef or message unless ref $time_recordings->[0] eq SL::DB::Manager::TimeRecording;
+  return t8('No time recordings to convert') if scalar @$time_recordings == 0;
 
   my @donumbers;
 
@@ -157,8 +156,10 @@ sub convert_without_linking {
   my %time_recordings_by_customer_id;
   push @{ $time_recordings_by_customer_id{$_->customer_id} }, $_ for @$time_recordings;
 
-  my %convert_params = map { $_ => $self->params->{$_} } qw(rounding link_order project_id);
-  $convert_params{default_part_id} = $self->params->{part_id};
+  my %convert_params = (
+    rounding        => $self->params->{rounding},
+    default_part_id => $self->params->{part_id},
+  );
 
   my @donumbers;
   foreach my $customer_id (keys %time_recordings_by_customer_id) {
@@ -194,8 +195,10 @@ sub convert_without_linking {
 sub convert_with_linking {
   my ($self, $time_recordings_by_order_id, $orders_by_order_id) = @_;
 
-  my %convert_params = map { $_ => $self->params->{$_} } qw(rounding link_order project_id);
-  $convert_params{default_part_id} = $self->params->{part_id};
+  my %convert_params = (
+    rounding        => $self->params->{rounding},
+    default_part_id => $self->params->{part_id},
+  );
 
   my @donumbers;
   foreach my $related_order_id (keys %$time_recordings_by_order_id) {