[Mpuls-commits] r2369 - wasko/branches/2.0/mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 15 12:23:17 CEST 2010


Author: torsten
Date: 2010-04-15 12:23:17 +0200 (Thu, 15 Apr 2010)
New Revision: 2369

Modified:
   wasko/branches/2.0/mpulsweb/model/appointment.py
Log:
* mpulsweb/model/appointment.py (Appointment.oldAndActive),
(Appointment.oldAndFinished): Also check remindconditon.


Modified: wasko/branches/2.0/mpulsweb/model/appointment.py
===================================================================
--- wasko/branches/2.0/mpulsweb/model/appointment.py	2010-04-15 10:21:04 UTC (rev 2368)
+++ wasko/branches/2.0/mpulsweb/model/appointment.py	2010-04-15 10:23:17 UTC (rev 2369)
@@ -118,6 +118,7 @@
    WHERE zugriff < now() - interval '1 day' * %%(maxdays)s AND status <> 5) s
    JOIN master_tbl_view m ON m.id = s.master_id
 WHERE phase in (%s)
+AND (%s)
 """
 
 GET_OLDACTIVE_CASES = """
@@ -126,7 +127,7 @@
   (SELECT * FROM ka_status_tbl_view
    WHERE zugriff < now() - interval '1 day' * %%(maxdays)s AND status <> 5) s
    JOIN master_tbl_view m ON m.id = s.master_id
-WHERE phase in (%s) AND m.bearbeiter_id = %%(editor)s
+WHERE phase in (%s) AND (%s) AND m.bearbeiter_id = %%(editor)s
 """
 
 GET_OLDFINISHED_CASES_4_ADMIN = """\
@@ -135,7 +136,7 @@
 WHERE s.status <> 5
       AND extract(day from now()-s.zugriff) > %%(maxdays)s
       AND phase in (%s)
-"""
+      AND (%s)"""
 
 GET_OLDFINISHED_CASES = """\
 SELECT m.id, s.zugriff, getLastCaseAppointment(m.id) as last_date
@@ -144,6 +145,7 @@
       AND m.bearbeiter_id = %%(editor)s
       AND extract(day from now()-s.zugriff) > %%(maxdays)s
       AND phase in (%s)
+      AND (%s)
 """
 
 log = logging.getLogger(__name__)
@@ -492,18 +494,19 @@
     def getOldAndFinishedCases(self, days, user):
         conn, cur = None, None
         list = {}
+        remindercondition = g.mpuls_config.get('case', 'remindercondition') 
         try:
             conn = db.getConnection()
             cur = conn.cursor()
             if user.isAdmin():
                 sql = (GET_OLDFINISHED_CASES_4_ADMIN
-                       % ",".join(g.mpuls_config.get('phases', 'finished')))
-                cur.execute(sql,
-                            {'maxdays': days})
+                       % (",".join(g.mpuls_config.get('phases', 'finished')), remindercondition))
+                cur.execute(sql, {'maxdays': days})
             else:
                 sql = (GET_OLDFINISHED_CASES
-                       % ",".join(g.mpuls_config.get('phases', 'finished')))
-                cur.execute(sql, {'maxdays': days, 'editor': user.id})
+                       % (",".join(g.mpuls_config.get('phases', 'finished')), remindercondition))
+                cur.execute(sql, {'maxdays': days, 
+                                  'editor': user.id})
             result = cur.fetchall()
             for r in result:
                 list[r[0]] = {'access':r[1], 'last_date': r[2]}
@@ -515,17 +518,20 @@
     def getOldAndActiveCases(self, days, user):
         conn, cur = None, None
         list = {}
+        remindercondition = g.mpuls_config.get('case', 'remindercondition') 
         try:
             conn = db.getConnection()
             cur = conn.cursor()
             if user.isAdmin():
                 sql = (GET_OLDACTIVE_CASES_4_ADMIN
-                       % ",".join(g.mpuls_config.get('phases', 'active')))
-                cur.execute(sql, {'maxdays': days, 'editor': user.id})
+                       % (",".join(g.mpuls_config.get('phases', 'active')), remindercondition))
+                cur.execute(sql, {'maxdays': days, 
+                                  'editor': user.id})
             else:
                 sql = (GET_OLDACTIVE_CASES
-                       % ",".join(g.mpuls_config.get('phases', 'active')))
-                cur.execute(sql, {'maxdays': days, 'editor': user.id})
+                       % (",".join(g.mpuls_config.get('phases', 'active')), remindercondition))
+                cur.execute(sql, {'maxdays': days, 
+                                  'editor': user.id})
             result = cur.fetchall()
             for r in result:
                 list[r[0]] = {'access':r[1], 'last_date': r[2]}



More information about the Mpuls-commits mailing list