} elsif (! $_->edi) {
$logger->error("Message (id " . $_->id. ") for $log_str has no EDI content");
$error = "EDI empty!";
- } elsif ($res = $server->put({remote_path => $account->path, content => $_->edi})) {
+ } elsif ($res = $server->put({remote_path => $account->path, content => $_->edi, single_ext => 1})) {
# This is the successful case!
$_->remote_file($res);
$_->status('complete');
local_file => undef,
tempfile => undef,
error => undef,
+ single_ext => undef,
specific => 0,
debug => 0,
);
$self->{put_args} = [$local_file]; # same for scp_put and uFTP put
if (defined $self->remote_path and not defined $self->remote_file) {
- $self->remote_file($self->remote_path . '/' . basename($local_file)); # if we know just the dir
+ my $rpath = $self->remote_path;
+ my $fname = basename($local_file);
+ if ($rpath =~ /^(.*)\*+(.*)$/) { # if the path has an asterisk in it, like './incoming/*.tst'
+ my $head = $1;
+ my $tail = $2;
+ if ($tail =~ /\//) {
+ $logger->warn($self->_error("remote path '$rpath' has dir slashes AFTER an asterisk. Cannot determine target dir"));
+ return;
+ }
+ if ($self->single_ext) {
+ $tail =~ /\./ and $fname =~ s/\./_/g; # if dot in tail, replace dots in fname (w/ _)
+ }
+ $self->remote_file($head . $fname . $tail);
+ } else {
+ $self->remote_file($rpath . '/' . $fname); # if we know just the dir
+ }
}
+
if (defined $self->remote_file) {
- push @{$self->{put_args}}, $self->remote_file; # user can specify remote_file name, optionally
+ push @{$self->{put_args}}, $self->remote_file; # user can specify remote_file name, optionally
}
my %keys = $self->key_check($params);
$Data::Dumper::Indent = 1;
my $remaining = $opts->{'max-batch-size'};
+# FIXME: this is the disclusion subquery. It discludes any PO that has
+# a non-retry edi_message linked to it. But that means that if there are
+# mutliple EDI messages (say, some failed translation) and one marked retry,
+# the PO is still discluded! Perhaps there should never be multiple messages,
+# but that makes testing much trickier (and is not DB-enforced).
+#
+# One approach might be to supplementally query for any "retry" messages that
+# are on active providers (and deduplicate).
+
my $subq = {
select => { acqedim => ['purchase_order'] },
from => 'acqedim',