X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FTimeRecording.pm;h=575e219fbd176a758ef45f76569f1803686d7596;hb=3782a90c336bc6c506f572e607c8526cb5e79ea3;hp=13329b782aded9bf9d950e42812391478c61b335;hpb=5202b3e71b817c6a78845cd4c27773760ff408b6;p=kivitendo-erp.git diff --git a/SL/DB/TimeRecording.pm b/SL/DB/TimeRecording.pm index 13329b782..575e219fb 100644 --- a/SL/DB/TimeRecording.pm +++ b/SL/DB/TimeRecording.pm @@ -38,6 +38,11 @@ sub validate { push @errors, t8('Employee must not be empty.') if !$self->employee_id; push @errors, t8('Description must not be empty.') if !$self->description; push @errors, t8('Start time must be earlier than end time.') if $self->is_time_in_wrong_order; + push @errors, t8('Assigned order must be a sales order.') if $self->order_id && 'sales_order' ne $self->order->type; + push @errors, t8('Customer of assigned order must match customer.') if $self->order_id && $self->order->customer_id != $self->customer_id; + push @errors, t8('Customer of assigned project must match customer.') if $self->project_id && $self->project->customer_id && $self->project->customer_id != $self->customer_id; + push @errors, t8('Project of assigned order must match assigned project.') + if $self->project_id && $self->order_id && $self->order->globalproject_id && $self->project_id != $self->order->globalproject_id; my $conflict = $self->is_time_overlapping; push @errors, t8('Entry overlaps with "#1".', $conflict->displayable_times) if $conflict;