[open-ils-commits] r1272 - in servres/trunk/conifer: libsystems/evergreen syrup/views (artunit)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Mar 21 21:53:55 EDT 2011
Author: artunit
Date: 2011-03-21 21:53:53 -0400 (Mon, 21 Mar 2011)
New Revision: 1272
Modified:
servres/trunk/conifer/libsystems/evergreen/opensrf.py
servres/trunk/conifer/syrup/views/items.py
Log:
yet again with location, modifier, and call number updates
Modified: servres/trunk/conifer/libsystems/evergreen/opensrf.py
===================================================================
--- servres/trunk/conifer/libsystems/evergreen/opensrf.py 2011-03-21 01:47:41 UTC (rev 1271)
+++ servres/trunk/conifer/libsystems/evergreen/opensrf.py 2011-03-22 01:53:53 UTC (rev 1272)
@@ -27,6 +27,8 @@
print "*** print_exc:"
traceback.print_exc()
pass # fail silently in production
+ return None
+
return authtoken
def session_cleanup(authtoken):
@@ -37,5 +39,64 @@
print "*** print_exc:"
traceback.print_exc()
pass # fail silently in production
+ return None
return True
+
+def evergreen_item_update(barcode, callno, modifier, desk):
+ try:
+ token = auth_token(settings.OPENSRF_STAFF_USERID, settings.OPENSRF_STAFF_PW,
+ settings.OPENSRF_STAFF_ORG, settings.OPENSRF_STAFF_WORKSTATION)
+
+ null = None
+ true = True
+ false = False
+ barcode_copy = E1(settings.OPENSRF_CN_BARCODE, token, barcode);
+
+ copy = None
+ volumeinfo = None
+
+ if barcode_copy:
+ volumeinfo = barcode_copy.get("volume")
+ if volumeinfo:
+ volume = volumeinfo['__p']
+ if volume and volume[7] != callno:
+ volume[0] = []
+ volume[7] = str(callno)
+ vol_len = len(volume) - 1
+ volume[vol_len] = str(volume[vol_len])
+ # ok, this is bad, need to find what these values are
+ for i in range(0, 4):
+ volume.append(None)
+ volume.append('1')
+ # print "volume", volume
+ updaterec = E1(settings.OPENSRF_VOLUME_UPDATE,
+ token, [{"__c":"acn","__p":volume}], false,
+ {"auto_merge_vols":false})
+ # print "update", updaterec
+ copy = barcode_copy.get("copy")
+ if copy:
+ # print "copy", copy
+ detailid = copy['__p'][21]
+ details = E1(settings.OPENSRF_FLESHEDCOPY_CALL, [detailid])
+ if details and (details[0]['__p'][7] != modifier or details[0]['__p'][23] != desk):
+ details[0]['__p'][7] = str(modifier)
+ details[0]['__p'][23] = str(desk)
+ # ditto here too, need to find what these values are
+ for i in range(0, 6):
+ details[0]['__p'].append(None)
+ details[0]['__p'].append('1')
+
+ print "details", details
+ updaterec = E1(settings.OPENSRF_BATCH_UPDATE, token, details,true)
+ # print "updaterec", updaterec
+
+ session_cleanup(token)
+ except:
+ print "item update problem"
+ print "*** print_exc:"
+ traceback.print_exc()
+ pass # fail silently in production
+ return False
+
+ return True
Modified: servres/trunk/conifer/syrup/views/items.py
===================================================================
--- servres/trunk/conifer/syrup/views/items.py 2011-03-21 01:47:41 UTC (rev 1271)
+++ servres/trunk/conifer/syrup/views/items.py 2011-03-22 01:53:53 UTC (rev 1272)
@@ -464,6 +464,9 @@
item.evergreen_update = update_option
item.circ_desk = location_option
item.circ_modifier = modifier_option
+ else:
+ return simple_message(_('Unable to update'),
+ _('Sorry, unable to update at this time, please try again.'))
if update_option == 'None':
item.evergreen_update = ''
@@ -580,60 +583,3 @@
return HttpResponseRedirect(new_parent.item_url('meta'))
else:
return HttpResponseRedirect(site.site_url())
-
- at instructors_only
-def evergreen_item_update(barcode, callno, modifier, desk):
- try:
- token = auth_token(settings.OPENSRF_STAFF_USERID, settings.OPENSRF_STAFF_PW,
- settings.OPENSRF_STAFF_ORG, settings.OPENSRF_STAFF_WORKSTATION)
- print "token", token
- null = None
- true = True
- false = False
- barcode_copy = E1(settings.OPENSRF_CN_BARCODE, token, barcode);
- copy = None
- volumeinfo = None
- if barcode_copy:
- volumeinfo = barcode_copy.get("volume")
- if volumeinfo:
- volume = volumeinfo['__p']
- if volume and volume[7] != callno:
- volume[0] = []
- volume[5] = 1
- volume[7] = callno.encode('ascii')
- print "callno", callno
- volume[13] = None
- volume.append(None)
- volume.append('1')
- print "WOULD UPDATE", volume
- updaterec = E1(settings.OPENSRF_VOLUME_UPDATE,
- token, [{"__c":"acn","__p":volume}], false,
- {"auto_merge_vols":false})
- print "updaterec", updaterec
- copy = barcode_copy.get("copy")
- if copy:
- print "copy", copy
- detailid = copy['__p'][21]
- details = E1(settings.OPENSRF_FLESHEDCOPY_CALL, [detailid])
- print "details", details
- if details and (details[0]['__p'][6] != modifier or details[0]['__p'][23] != desk):
- details[0]['__p'][6] = modifier
- details[0]['__p'][23] = desk
-
- #the value of testing, these are in the fm_IDL.xml for RC but not production (total circ and holds)
- details[0]['__p'].append(None)
- details[0]['__p'].append('1')
-
- print "WOULD UPDATE", details
- updaterec = E1(settings.OPENSRF_BATCH_UPDATE, token, details,true)
- print "updaterec", updaterec
-
- session_cleanup(token)
- except:
- print "item update problem"
- print "*** print_exc:"
- traceback.print_exc()
- pass # fail silently in production
- return False
-
- return True
More information about the open-ils-commits
mailing list