[open-ils-commits] r16429 - in trunk/Open-ILS/src: perlmods/OpenILS/Application/Acq perlmods/OpenILS/Utils sql/Pg sql/Pg/upgrade (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu May 13 15:05:14 EDT 2010


Author: erickson
Date: 2010-05-13 15:05:09 -0400 (Thu, 13 May 2010)
New Revision: 16429

Added:
   trunk/Open-ILS/src/sql/Pg/upgrade/0262.data.acq.jedi_template.sql
Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm
   trunk/Open-ILS/src/perlmods/OpenILS/Utils/RemoteAccount.pm
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
use estimed_unit_price directly on the lineitem in JEDI creation.  strip protocol/port info from the edi account host before attempting remote delivery.  more strict check of successfull login for RemoteAccount

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm	2010-05-13 16:44:14 UTC (rev 16428)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm	2010-05-13 19:05:09 UTC (rev 16429)
@@ -264,9 +264,10 @@
         $args{remote_path} = $vendor->in_dir;    # override "path" with "in_dir"
     }
     my $host = $args{remote_host} || '';
-    ($host =~ /^(S?FTP):/i    and $args{type} = uc($1)) or
-    ($host =~ /^(SSH|SCP):/i  and $args{type} = 'SCP' ) ;
-     $host =~ /:(\d+)$/       and $args{port} = $1;
+    ($host =~ s/^(S?FTP)://i    and $args{type} = uc($1)) or
+    ($host =~ s/^(SSH|SCP)://i  and $args{type} = 'SCP' ) ;
+     $host =~ s/:(\d+)$//       and $args{port} = $1;
+     ($args{remote_host} = $host) =~ s#/+##;
     $verbose and $logger->warn("field_map: " . Dumper(\%args));
     return %args;
 }

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/RemoteAccount.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/RemoteAccount.pm	2010-05-13 16:44:14 UTC (rev 16428)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/RemoteAccount.pm	2010-05-13 19:05:09 UTC (rev 16429)
@@ -498,8 +498,9 @@
         $self->{$_} or last;
         push @login_args, $self->{$_};
     }
-    eval { $ftp->login(@login_args) };
-    if ($@) {
+    my $login_ok = 0;
+    eval { $login_ok = $ftp->login(@login_args) };
+    if ($@ or !$login_ok) {
         $logger->error($self->_error("failed login to", $self->remote_host,  "w/ args(" . join(',', @login_args) . ") : $@"));
         return;
     }

Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-05-13 16:44:14 UTC (rev 16428)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-05-13 19:05:09 UTC (rev 16429)
@@ -65,7 +65,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0261'); -- miker
+INSERT INTO config.upgrade_log (version) VALUES ('0262'); -- berick
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-05-13 16:44:14 UTC (rev 16428)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-05-13 19:05:09 UTC (rev 16429)
@@ -4737,7 +4737,7 @@
                 {"id-qualifier":"SA","id":"[% li.id %]"},
                 {"id-qualifier":"IB","id":"[% helpers.get_li_attr('isbn', li.attributes) %]"}
             ],
-            "price":[% helpers.get_li_attr('estimated_price', '', li.attributes) %],
+            "price":[% li.estimated_unit_price || '0.00' %],
             "desc":[
                 {"BTI":"[% helpers.get_li_attr('title',     '', li.attributes) %]"}, 
                 {"BPU":"[% helpers.get_li_attr('publisher', '', li.attributes) %]"},

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0262.data.acq.jedi_template.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0262.data.acq.jedi_template.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0262.data.acq.jedi_template.sql	2010-05-13 19:05:09 UTC (rev 16429)
@@ -0,0 +1,48 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0262');
+
+UPDATE action_trigger.event_definition SET template =
+$$[%- USE date -%]
+[%# start JEDI document -%]
+[%- BLOCK big_block -%]
+["order", {
+    "po_number":[% target.id %],
+    "date":"[% date.format(date.now, '%Y%m%d') %]",
+    "buyer":[
+        {"id":"[% target.ordering_agency.mailing_address.san %]",
+         "reference":{"API":"[% target.ordering_agency.mailing_address.san %]"}}
+    ],
+    "vendor":[ 
+        "[% target.provider.san %]", // [% target.provider.name %] ([% target.provider.id %])
+        {"id-qualifier":"91", "reference":{"IA":"[% target.provider.id %]"}, "id":"[% target.provider.san %]"}
+    ],
+    "currency":"[% target.provider.currency_type %]",
+    "items":[
+        [% FOR li IN target.lineitems %]
+        {
+            "identifiers":[
+                {"id-qualifier":"SA","id":"[% li.id %]"},
+                {"id-qualifier":"IB","id":"[% helpers.get_li_attr('isbn', li.attributes) %]"}
+            ],
+            "price":[% li.estimated_unit_price || '0.00' %],
+            "desc":[
+                {"BTI":"[% helpers.get_li_attr('title',     '', li.attributes) %]"}, 
+                {"BPU":"[% helpers.get_li_attr('publisher', '', li.attributes) %]"},
+                {"BPD":"[% helpers.get_li_attr('pubdate',   '', li.attributes) %]"},
+                {"BPH":"[% helpers.get_li_attr('pagination','', li.attributes) %]"}
+            ],
+            "quantity":[% li.lineitem_details.size %]
+            [%-# TODO: lineitem details (later) -%]
+        }[% UNLESS loop.last %],[% END -%]
+        [%- END %]
+    ],
+    "line_items":[% target.lineitems.size %]
+}]
+[% END %]
+[% tempo = PROCESS big_block; helpers.escape_json(tempo) %]
+$$
+WHERE id = 23;
+
+COMMIT;
+



More information about the open-ils-commits mailing list