X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/f01ed5d1c0d1bed1d04005e004a785c6cf047233..53593baa211863fbf66540cf1bcc36c8fb37257f:/SL/DB/Part.pm 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 ]); };