DO->retrieve('vc' => $form->{vc},
'ids' => $form->{id});
- $payment_id = $form->{payment_id} if ($form->{payment_id});
- $language_id = $form->{language_id} if ($form->{language_id});
- $taxzone_id = $form->{taxzone_id} if ($form->{taxzone_id});
- $salesman_id = $form->{salesman_id} if ($editing);
+ $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes));
+ $form->{shipto} = 1 if $form->{id};
+ # get customer / vendor
+ if ($form->{vc} eq 'vendor') {
+ IR->get_vendor(\%myconfig, \%$form);
+ } else {
+ IS->get_customer(\%myconfig, \%$form);
+ }
- $taxincluded = $form->{taxincluded};
- $form->{shipto} = 1 if $form->{id};
+ $form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id));
+ $form->restore_vars(qw(taxincluded)) if $form->{id};
+ $form->restore_vars(qw(salesman_id)) if $editing;
if ($form->{"all_$form->{vc}"}) {
unless ($form->{"$form->{vc}_id"}) {
}
}
- $cp_id = $form->{cp_id};
- $intnotes = $form->{intnotes};
-
- $form->{cp_id} = $cp_id;
-
- $form->{payment_id} = $payment_id if ($payment_id);
- $form->{language_id} = $language_id if ($language_id);
- $form->{taxzone_id} = $taxzone_id if ($taxzone_id);
- $form->{intnotes} = $intnotes if ($intnotes);
-
($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
$form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
(my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
$dec_qty = length $dec_qty;
$form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
-
- map { $form->{"${_}_$i"} =~ s/\"/"/g } qw(partnumber description unit);
}
$lxdebug->leave_sub();
} else {
- map { $form->{item_list}[$i]{$_} =~ s/\"/"/g } qw(partnumber description unit);
map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] };
$form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor};
'delivered' => { 'text' => $locale->text('Delivered'), },
);
- foreach my $name (qw(id transdate donumber ordnumber name employee shipvia)) {
+ foreach my $name (qw(id transdate donumber ordnumber name employee shipvia transaction_description)) {
my $sortdir = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir};
$column_defs{$name}->{link} = $href . "&sort=$name&sortdir=$sortdir";
}
push @options, $locale->text('Transaction description') . " : $form->{transaction_description}";
}
if ($form->{transdatefrom}) {
- push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
+ push @options, $locale->text('From') . " " . $locale->date(\%myconfig, $form->{transdatefrom}, 1);
}
if ($form->{transdateto}) {
- push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1);
+ push @options, $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{transdateto}, 1);
}
if ($form->{open}) {
push @options, $locale->text('Open');
$form->{title} = $locale->text('Add Vendor Invoice');
$form->{script} = 'ir.pl';
$script = "ir";
+ $buysell = 'sell';
} else {
$form->{title} = $locale->text('Add Sales Invoice');