X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/e0fb092b1a1ac0429036b41abc0a85a011e0d9a8..f3bad0c2bf4ac1a731ee7f1d8da2cccde5f3f10c:/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 ]); };