[open-ils-commits] r554 - constrictor/trunk/contrib/evergreen (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jun 30 23:10:28 EDT 2009
Author: erickson
Date: 2009-06-30 23:10:26 -0400 (Tue, 30 Jun 2009)
New Revision: 554
Added:
constrictor/trunk/contrib/evergreen/eg_user_transactions.py
Modified:
constrictor/trunk/contrib/evergreen/eg_tasks.py
Log:
added user transaction data retrieval, by various types of transaction
Modified: constrictor/trunk/contrib/evergreen/eg_tasks.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_tasks.py 2009-07-01 02:46:25 UTC (rev 553)
+++ constrictor/trunk/contrib/evergreen/eg_tasks.py 2009-07-01 03:10:26 UTC (rev 554)
@@ -164,3 +164,15 @@
registerTask(BibSearchTask())
+class UserTransactionsByType(AbstractMethodTask):
+
+ def __init__(self):
+ AbstractMethodTask.__init__(self)
+ self.service = 'open-ils.actor'
+
+ def run(self, **kw):
+ self.method = kw['method']
+ return self.runMethod(eg_utils.authtoken(), kw['user_id'])
+
+registerTask(UserTransactionsByType())
+
Added: constrictor/trunk/contrib/evergreen/eg_user_transactions.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_user_transactions.py (rev 0)
+++ constrictor/trunk/contrib/evergreen/eg_user_transactions.py 2009-07-01 03:10:26 UTC (rev 554)
@@ -0,0 +1,42 @@
+from constrictor.task import Task
+from constrictor.script import Script, ScriptManager, ScriptThread
+from constrictor.log import *
+import eg_utils, eg_data, eg_tasks
+import random
+
+eg_utils.init()
+
+types = [
+ 'open-ils.actor.user.transactions.history',
+ 'open-ils.actor.user.transactions.history.have_charge',
+ 'open-ils.actor.user.transactions.history.have_balance',
+ 'open-ils.actor.user.transactions.history.have_balance.authoritative',
+ 'open-ils.actor.user.transactions.history.still_open',
+ 'open-ils.actor.user.transactions.history.have_bill',
+ 'open-ils.actor.user.transactions.history.have_bill.authoritative',
+ 'open-ils.actor.user.transactions.have_balance',
+ 'open-ils.actor.user.transactions.have_balance.total',
+ 'open-ils.actor.user.transactions.have_balance.count',
+ 'open-ils.actor.user.transactions'
+]
+
+class BibSearchScript(Script):
+
+ def run(self):
+
+ dm = eg_data.DataManager()
+ user_id = dm.getThreadData(eg_data.PROP_PATRON_IDS)
+
+ for type in types:
+ logInfo('Loading patron(%s) transactions with %s' % (int(user_id), type))
+ res = eg_tasks.TASKS['UserTransactionsByType'].run(
+ method = type,
+ user_id = user_id
+ )
+
+ return True
+
+ScriptManager.go(BibSearchScript())
+
+
+
More information about the open-ils-commits
mailing list