- if ( $part_svc_column->columnflag eq $x ) {
- $self->setfield( $field, $part_svc_column->columnvalue );
- }
- }
+ if ( $part_svc_column->columnflag eq 'A' && $self->$field() eq '' ) {
+
+ my $classnum = $part_svc_column->columnvalue;
+ my $inventory_item = qsearchs({
+ 'table' => 'inventory_item',
+ 'hashref' => { 'classnum' => $classnum,
+ 'svcnum' => '',
+ },
+ 'extra_sql' => 'LIMIT 1 FOR UPDATE',
+ });
+
+ unless ( $inventory_item ) {
+ $dbh->rollback if $oldAutoCommit;
+ my $inventory_class =
+ qsearchs('inventory_class', { 'classnum' => $classnum } );
+ return "Can't find inventory_class.classnum $classnum"
+ unless $inventory_class;
+ return "Out of ". $inventory_class->classname. "s\n"; #Lingua:: BS
+ #for pluralizing
+ }