[open-ils-commits] r9619 - in branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb: controllers/acq lib

svn at svn.open-ils.org svn at svn.open-ils.org
Thu May 15 11:16:16 EDT 2008


Author: erickson
Date: 2008-05-15 11:16:14 -0400 (Thu, 15 May 2008)
New Revision: 9619

Modified:
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/util.py
Log:
for now, using provider code as source_label on lineitems for vendor imported records.  no longer connecting to settings server on connect since not necessary

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py	2008-05-15 15:15:28 UTC (rev 9618)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/po.py	2008-05-15 15:16:14 UTC (rev 9619)
@@ -126,35 +126,43 @@
 
         r = RequestMgr()
 
-        oils.system.System.connect(
+        oils.system.System.remote_connect(
             config_file = pylons.config['osrf_config'],
             config_context = pylons.config['osrf_config_ctxt'])
 
         if 'marc_file' in r.request.params:
 
-            provider = r.request.params['provider']
+            provider_id = r.request.params['provider']
             authtoken = r.request.params['authtoken']
 
             # first, create the PO
             po = osrf.net_obj.NetworkObject.acqpo()
-            po.provider(provider)
-            po_id = ClientSession.atomic_request('open-ils.acq', 
+            po.provider(provider_id)
+            po_id = ClientSession.atomic_request(
+                'open-ils.acq', 
                 'open-ils.acq.purchase_order.create', authtoken, po)
             oils.event.Event.parse_and_raise(po_id)
 
+            provider = ClientSession.atomic_request(
+                'open-ils.acq', 
+                'open-ils.acq.provider.retrieve', authtoken, provider_id)
+            oils.event.Event.parse_and_raise(provider)
+
             # now, parse the MARC and create a lineitem per record
             marc_reader = pymarc.reader.MARCReader(r.request.params['marc_file'].file)
             for record in marc_reader:
 
                 lineitem = osrf.net_obj.NetworkObject.jub()
                 lineitem.marc(pymarc.marcxml.record_to_xml(record))
-                lineitem.provider(provider)
+                lineitem.provider(provider_id)
                 lineitem.purchase_order(po_id)
+                lineitem.source_label(provider.code()) # XXX where should this really come from?
 
-                stat = ClientSession.atomic_request('open-ils.acq', 
+                stat = ClientSession.atomic_request(
+                    'open-ils.acq', 
                     'open-ils.acq.lineitem.create', authtoken, lineitem)
                 oils.event.Event.parse_and_raise(stat)
-                return redirect_to(controller='acq/po', action='view', id=po_id)
+            return redirect_to(controller='acq/po', action='view', id=po_id)
                 
         return r.render('acq/po/marc_upload.html')
 

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/util.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/util.py	2008-05-15 15:15:28 UTC (rev 9618)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/util.py	2008-05-15 15:16:14 UTC (rev 9619)
@@ -9,7 +9,7 @@
     '''
 
     import oils.system
-    oils.system.System.connect(
+    oils.system.System.remote_connect(
         config_file = pylons.config['osrf_config'],
         config_context = pylons.config['osrf_config_ctxt'],
         connect_cache = True)



More information about the open-ils-commits mailing list