projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT# 78547 Allow for simulated billing within a transaction
[freeside.git]
/
FS
/
FS
/
upload_target.pm
diff --git
a/FS/FS/upload_target.pm
b/FS/FS/upload_target.pm
index
8466a62
..
af2dcb1
100644
(file)
--- a/
FS/FS/upload_target.pm
+++ b/
FS/FS/upload_target.pm
@@
-153,7
+153,8
@@
sub put {
local $@;
my $connection = eval { $self->connect };
return $@ if $@;
local $@;
my $connection = eval { $self->connect };
return $@ if $@;
- $connection->put($localname, $remotename) or return $connection->error;
+ $connection->put($localname, $remotename);
+ return $connection->error || '';
} elsif ( $self->protocol eq 'email' ) {
my $to = join('@', $self->username, $self->hostname);
} elsif ( $self->protocol eq 'email' ) {
my $to = join('@', $self->username, $self->hostname);
@@
-162,7
+163,7
@@
sub put {
# (maybe use only the raw content, so that we don't have to supply a
# customer for substitutions? ewww.)
my %message = (
# (maybe use only the raw content, so that we don't have to supply a
# customer for substitutions? ewww.)
my %message = (
- 'from' => $conf->
config('invoice_from'
),
+ 'from' => $conf->
invoice_from_full(
),
'to' => $to,
'subject' => $self->subject,
'nobody' => 1,
'to' => $to,
'subject' => $self->subject,
'nobody' => 1,
@@
-182,13
+183,6
@@
sub put {
}
}
}
}
-
-
-
-
-
-
-
=item connect
Creates a Net::FTP or Net::SFTP::Foreign object (according to the setting
=item connect
Creates a Net::FTP or Net::SFTP::Foreign object (according to the setting
@@
-206,13
+200,15
@@
sub connect {
eval "use Net::SFTP::Foreign;";
die $@ if $@;
my %args = (
eval "use Net::SFTP::Foreign;";
die $@ if $@;
my %args = (
- port => $self->port,
user => $self->username,
user => $self->username,
- password => $self->password,
- more => ($DEBUG ? '-v' : ''),
timeout => 30,
timeout => 30,
- autodie =>
1
, #we're doing this anyway
+ autodie =>
0
, #we're doing this anyway
);
);
+ # Net::SFTP::Foreign does not deal well with args that are defined
+ # but empty
+ $args{port} = $self->port if $self->port and $self->port != 22;
+ $args{password} = $self->password if length($self->password) > 0;
+ $args{more} = '-v' if $DEBUG;
my $sftp = Net::SFTP::Foreign->new($self->hostname, %args);
$sftp->setcwd($self->path);
return $sftp;
my $sftp = Net::SFTP::Foreign->new($self->hostname, %args);
$sftp->setcwd($self->path);
return $sftp;