X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=blobdiff_plain;f=SL%2FDB%2FPart.pm;fp=SL%2FDB%2FPart.pm;h=89261af01541a506132d75a431cdde9aace7029f;hp=1ee4f26eef1408698dd04a7d512eaa3e19c04053;hb=b293ff8ad52fc76ba0c44783e3982418114d6b08;hpb=d4925a8b60f04674885e30d9316dc0263f8b9a84 diff --git a/SL/DB/Part.pm b/SL/DB/Part.pm index 1ee4f26ee..89261af01 100644 --- a/SL/DB/Part.pm +++ b/SL/DB/Part.pm @@ -139,6 +139,13 @@ sub validate { push @errors, $::locale->text('The unit is missing.') unless $self->unit; push @errors, $::locale->text('The buchungsgruppe is missing.') unless $self->buchungsgruppen_id or $self->buchungsgruppe; + if ( $::instance_conf->get_partsgroup_required + && ( !$self->partsgroup_id or ( $self->id && !$self->partsgroup_id && $self->partsgroup ) ) ) { + # when unsetting an existing partsgroup in the interface, $self->partsgroup_id will be undef but $self->partsgroup will still have a value + # this needs to be checked, as partsgroup dropdown has an empty value + push @errors, $::locale->text('The partsgroup is missing.'); + } + unless ( $self->id ) { push @errors, $::locale->text('The partnumber already exists.') if SL::DB::Manager::Part->get_all_count(where => [ partnumber => $self->partnumber ]); };