[Mpuls-commits] r87 - in waska/trunk: . waskaweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Aug 25 18:23:57 CEST 2008
Author: teichmann
Date: 2008-08-25 18:23:56 +0200 (Mon, 25 Aug 2008)
New Revision: 87
Modified:
waska/trunk/ChangeLog.txt
waska/trunk/waskaweb/model/case.py
Log:
Load phase from ka_status_tbl.
Modified: waska/trunk/ChangeLog.txt
===================================================================
--- waska/trunk/ChangeLog.txt 2008-08-21 12:28:38 UTC (rev 86)
+++ waska/trunk/ChangeLog.txt 2008-08-25 16:23:56 UTC (rev 87)
@@ -1,3 +1,7 @@
+2008-08-25 Sascha L. Teichmann <sascha.teichmann at intevation.de>
+
+ * waskaweb/model/case.py: Load phase from ka_status_tbl.
+
2008-08-21 Sascha L. Teichmann <sascha.teichmann at intevation.de>
* waskaweb/controllers/agency_overview.py: Added dispositon headers
Modified: waska/trunk/waskaweb/model/case.py
===================================================================
--- waska/trunk/waskaweb/model/case.py 2008-08-21 12:28:38 UTC (rev 86)
+++ waska/trunk/waskaweb/model/case.py 2008-08-25 16:23:56 UTC (rev 87)
@@ -64,10 +64,53 @@
return v
# SQL STATEMENTS
-LOAD_CASESTATE_SQL = """SELECT s.id, s.status, s.zugriff, m.zeitraum_nachbetreuung as cm_beendet, m.art_beendigung as cm_abbruch, getLastCaseAppointment(m.id) as letzer_termin from ka_status_tbl_view s JOIN master_tbl_view m ON m.id = s.master_id WHERE s.master_id = %(id)s"""
-SET_CASESTATE_SQL = """UPDATE ka_status_tbl_view SET status = %(status)s WHERE id = %(id)s"""
+LOAD_CASESTATE_SQL = """
+SELECT
+ s.id,
+ s.status,
+ s.zugriff,
+ m.zeitraum_nachbetreuung AS cm_beendet,
+ m.art_beendigung AS cm_abbruch,
+ getLastCaseAppointment(m.id) AS letzer_termin,
+ s.phase AS phase
+FROM ka_status_tbl_view s JOIN master_tbl_view m ON m.id = s.master_id
+WHERE s.master_id = %(id)s
+"""
-LOAD_CASE_DIGEST_SQL = """SELECT name_1, vorname_1, kundennummer, date_part('year', age(geburtsdatum::timestamp)) as alter, plz, strasse, wohnort, vorwahl, telefon_1, mobiltelefon, telefon_sonstige, email, einverstaendniserklaerung, name_2, vorname_2, vorwahl_1, telefon_1_1, mobiltelefon_1, email_1 from master_tbl_view WHERE id = %(id)s"""
+SET_CASESTATE_SQL = """
+UPDATE ka_status_tbl_view
+ SET status = %(status)s
+ WHERE id = %(id)s"""
+
+SET_CASEPHASE_SQL = """
+ UPDATE ka_status_tbl_view
+ SET phase = %(phase)s
+ WHERE id = %(id)s"""
+
+LOAD_CASE_DIGEST_SQL = """
+SELECT
+ name_1,
+ vorname_1,
+ kundennummer,
+ date_part('year', age(geburtsdatum::timestamp)) AS alter,
+ plz,
+ strasse,
+ wohnort,
+ vorwahl,
+ telefon_1,
+ mobiltelefon,
+ telefon_sonstige,
+ email,
+ einverstaendniserklaerung,
+ name_2,
+ vorname_2,
+ vorwahl_1,
+ telefon_1_1,
+ mobiltelefon_1,
+ email_1
+FROM master_tbl_view WHERE id = %(id)s
+"""
+
LOAD_CASE_SQL = """SELECT name_1, vorname_1, bearbeiter_id, kundennummer from master_tbl_view WHERE id = %(id)s"""
DELETE_CASE_SQL = """select delete_master_ds(%(id)s)"""
@@ -695,13 +738,13 @@
def __init__(self, id=None):
if id is None: self.id = None
else: self.id = int(id)
- self.page_id = None
- self.mode = "show"
- self.form_errors = {}
- self.last_name = None
- self.first_name = None
- self.knr = None
- self.state = None
+ self.page_id = None
+ self.mode = "show"
+ self.form_errors = {}
+ self.last_name = None
+ self.first_name = None
+ self.knr = None
+ self.state = None
self.privacy_statement = False
self.street = None
@@ -747,22 +790,22 @@
class Case:
def __init__(self):
- self.id = None
+ self.id = None
self.first_name = None
- self.last_name = None
- self.knr = None
- self.editor = None
- self.standin = None
- self.state = None
+ self.last_name = None
+ self.knr = None
+ self.editor = None
+ self.standin = None
+ self.state = None
- self.digest = None
- self.page = None
- self.documents = []
- self.appointments = []
+ self.digest = None
+ self.page = None
+ self.documents = []
+ self.appointments = []
self.privacy_statement_signed = False
- self.privacy_statement = None
- self.aidplan_statement = None
- self.discretion_statement = None
+ self.privacy_statement = None
+ self.aidplan_statement = None
+ self.discretion_statement = None
def delete(self):
'''Deletes the case from data base. Returns True if deletion succseeds'''
@@ -797,12 +840,12 @@
def getSessionCase(self):
'''Returns a SessionCaseObject which is initiated with values from the current user'''
- session = SessionCase(self.id)
- session.last_name = self.last_name
- session.first_name = self.first_name
- session.knr = self.knr
- session.state = self.state
- privacy_statement = self.getPrivacyStatement()
+ session = SessionCase(self.id)
+ session.last_name = self.last_name
+ session.first_name = self.first_name
+ session.knr = self.knr
+ session.state = self.state
+ privacy_statement = self.getPrivacyStatement()
session.privacy_statement = privacy_statement.isSigned()
return session
@@ -993,10 +1036,11 @@
last_date = property(getLastDateFromDB)
def __init__(self, master_id=None):
- self.master_id = master_id
- self.id = None
- self.state = None
- self.access = None
+ self.master_id = master_id
+ self.id = None
+ self.state = None
+ self.access = None
+ self.phase = None
self._last_date = None
if master_id:
@@ -1005,10 +1049,10 @@
def setData(self, id, master_id, state, access, cm_finished, cm_canceled):
- self.master_id = master_id
- self.id = id
- self.state = state
- self.access = access
+ self.master_id = master_id
+ self.id = id
+ self.state = state
+ self.access = access
self.cm_finished = cm_finished
self.cm_canceled = cm_canceled
@@ -1026,6 +1070,7 @@
self._last_date = result.get('letzer_termin')
self.cm_finished = result.get('cm_beendet')
self.cm_canceled = result.get('cm_abbruch')
+ #self.phase = result.get('phase')
finally:
db.recycleConnection(conn, cur)
except:
@@ -1067,6 +1112,26 @@
traceback.print_exc(file=sys.stderr)
return False
+ def setPhase(self, phase):
+ conn, cur = None, None
+ try:
+ try:
+ conn = db.getConnection()
+ cur = conn.cursor()
+ fields = {'phase': phase, 'id': self.id}
+ cur.execute(SET_CASEPHASE_SQL, fields)
+ conn.commit()
+ self.phase = phase
+ finally:
+ db.recycleConnection(conn, cur)
+ return True
+ except:
+ traceback.print_exc(file=sys.stderr)
+ return False
+
+ def getPhase(self):
+ return self.phase
+
def getAccessTime(self, format=None):
if format:
try:
More information about the Mpuls-commits
mailing list