[open-ils-commits] r17201 - in trunk/Open-ILS/src: perlmods/OpenILS/Application/Acq perlmods/OpenILS/Utils support-scripts (atz)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Aug 12 15:49:58 EDT 2010
Author: atz
Date: 2010-08-12 15:49:53 -0400 (Thu, 12 Aug 2010)
New Revision: 17201
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm
trunk/Open-ILS/src/perlmods/OpenILS/Utils/RemoteAccount.pm
trunk/Open-ILS/src/support-scripts/edi_pusher.pl
Log:
Allow * in file portion of pathname
Example:
incoming/*.xpo => incoming/yegagufoNy.xpo
You cannot put an asterisk in the path portion of the string, however,
since that would mean the target directory was not determined.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm 2010-08-12 18:54:25 UTC (rev 17200)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm 2010-08-12 19:49:53 UTC (rev 17201)
@@ -156,7 +156,7 @@
} 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');
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/RemoteAccount.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/RemoteAccount.pm 2010-08-12 18:54:25 UTC (rev 17200)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/RemoteAccount.pm 2010-08-12 19:49:53 UTC (rev 17201)
@@ -39,6 +39,7 @@
local_file => undef,
tempfile => undef,
error => undef,
+ single_ext => undef,
specific => 0,
debug => 0,
);
@@ -260,10 +261,26 @@
$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);
Modified: trunk/Open-ILS/src/support-scripts/edi_pusher.pl
===================================================================
--- trunk/Open-ILS/src/support-scripts/edi_pusher.pl 2010-08-12 18:54:25 UTC (rev 17200)
+++ trunk/Open-ILS/src/support-scripts/edi_pusher.pl 2010-08-12 19:49:53 UTC (rev 17201)
@@ -55,6 +55,15 @@
$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',
More information about the open-ils-commits
mailing list