$language_saved = $form->{language_id};
$payment_id_saved = $form->{payment_id};
$salesman_id_saved = $form->{salesman_id};
+ $cp_id_saved = $form->{cp_id};
&{"$form->{vc}_details"}();
$form->{"cc"} = $saved_cc if ($saved_cc);
$form->{"bcc"} = $saved_bcc if ($saved_bcc);
+ if (!$cp_id_saved) {
+ # No contact was selected. Delete all contact variables because
+ # IS->customer_details() and IR->vendor_details() get the default
+ # contact anyway.
+ map({ delete($form->{$_}); } grep(/^cp_/, keys(%{ $form })));
+ }
+
my ($language_tc, $output_numberformat, $output_dateformat, $output_longdates);
if ($form->{"language_id"}) {
($language_tc, $output_numberformat, $output_dateformat, $output_longdates) =
"all" => 0,
"old_id" => \@old_project_ids });
- my (%labels, @values);
+ my %labels;
+ my @values = (undef);
foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
push(@values, $item->{"cp_id"});
$labels{$item->{"cp_id"}} = $item->{"cp_name"} .
"old_id" => \@old_project_ids },
"employees" => "ALL_SALESMEN");
- my (%labels, @values);
+ my %labels;
+ my @values = (undef);
foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
push(@values, $item->{"cp_id"});
$labels{$item->{"cp_id"}} = $item->{"cp_name"} .
"old_id" => \@old_project_ids },
"employees" => "ALL_SALESMEN");
- my (%labels, @values);
+ my %labels;
+ my @values = (undef);
foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
push(@values, $item->{"cp_id"});
$labels{$item->{"cp_id"}} = $item->{"cp_name"} .