croak "File '${src_dir}/$_' does not exist" unless -f "${src_dir}/$_";
}
- my $template_dir = $::instance_conf->reload->get_templates;
+ return 1 unless my $template_dir = $::instance_conf->reload->get_templates;
$::lxdebug->message(LXDebug::DEBUG1(), "add_print_templates: template_dir $template_dir");
- return 1 if !$template_dir;
-
foreach my $src_file (@files) {
my $dest_file = $template_dir . '/' . $src_file;
my $dbh = $self->get_standard_dbh(\%main::myconfig);
my ($sth, $query, $ref);
- my $vc = $self->{"vc"} eq "customer" ? "customer" : "vendor";
- my $vc_id = $self->{"${vc}_id"};
+ my ($vc, $vc_id);
+ if ($params{contacts} || $params{shipto}) {
+ $vc = 'customer' if $self->{"vc"} eq "customer";
+ $vc = 'vendor' if $self->{"vc"} eq "vendor";
+ die "invalid use of get_lists, need 'vc'";
+ $vc_id = $self->{"${vc}_id"};
+ }
if ($params{"contacts"}) {
$self->_get_contacts($dbh, $vc_id, $params{"contacts"});