sub vendor_details {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ($self, $myconfig, $form, @wanted_vars) = @_;
# connect to database
my $dbh = $form->dbconnect($myconfig);
# remove id and taxincluded before copy back
delete @$ref{qw(id taxincluded)};
+
+ if (scalar(@wanted_vars) > 0) {
+ my %h_wanted_vars;
+ map({ $h_wanted_vars{$_} = 1; } @wanted_vars);
+ map({ delete($ref->{$_}) unless ($h_wanted_vars{$_}); } keys(%{$ref}));
+ }
+
map { $form->{$_} = $ref->{$_} } keys %$ref;
$sth->finish;
sub customer_details {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $form) = @_;
+ my ($self, $myconfig, $form, @wanted_vars) = @_;
# connect to database
my $dbh = $form->dbconnect($myconfig);
# remove id and taxincluded before copy back
delete @$ref{qw(id taxincluded)};
+
+ if (scalar(@wanted_vars) > 0) {
+ my %h_wanted_vars;
+ map({ $h_wanted_vars{$_} = 1; } @wanted_vars);
+ map({ delete($ref->{$_}) unless ($h_wanted_vars{$_}); } keys(%{$ref}));
+ }
+
map { $form->{$_} = $ref->{$_} } keys %$ref;
$sth->finish;
sub customer_details {
$lxdebug->enter_sub();
- IS->customer_details(\%myconfig, \%$form);
+ IS->customer_details(\%myconfig, \%$form, @_);
$lxdebug->leave_sub();
}
sub vendor_details {
$lxdebug->enter_sub();
- IR->vendor_details(\%myconfig, \%$form);
+ IR->vendor_details(\%myconfig, \%$form, @_);
$lxdebug->leave_sub();
}
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
qw(exchangerate creditlimit creditremaining);
+ my @shipto_vars =
+ qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry
+ shiptocontact shiptophone shiptofax shiptoemail
+ shiptodepartment_1 shiptodepartment_2);
+
# get details for name
- &{"$form->{vc}_details"};
+ &{"$form->{vc}_details"}(@shipto_vars);
$number =
($form->{vc} eq 'customer')
|;
# delete shipto
- map { delete $form->{$_} }
- qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail shiptodepartment_1 shiptodepartment_2 header);
+ map({ delete $form->{$_} } (@shipto_vars, qw(header)));
$form->{title} = $title;
foreach $key (keys %$form) {