use SL::IO;
use SL::MoreCommon;
use SL::DB::Default;
+use SL::TransNumber;
use strict;
($form->{id}) = selectrow_query($form, $dbh, $query);
$query = qq|INSERT INTO ar (id, invnumber, employee_id, currency_id) VALUES (?, 'dummy', ?, (SELECT id FROM currencies WHERE name=?))|;
do_query($form, $dbh, $query, $form->{id}, $form->{employee_id}, $form->{currency});
- $form->{invnumber} = $form->update_defaults($myconfig, "invnumber", $dbh) unless $form->{invnumber};
+ if (!$form->{invnumber}) {
+ my $trans_number = SL::TransNumber->new(type => 'invoice', dbh => $dbh, number => $form->{partnumber}, id => $form->{id});
+ $form->{invnumber} = $trans_number->create_unique;
+ }
}
}
1;
-