[Mpuls-commits] r403 - in wasko/trunk: . waskaweb/controllers waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 18 16:48:58 CET 2009


Author: teichmann
Date: 2009-03-18 16:48:54 +0100 (Wed, 18 Mar 2009)
New Revision: 403

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/controllers/case.py
   wasko/trunk/waskaweb/model/case.py
Log:
Created new cases for Wiederaufnahme and Neuaufnahme.



Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-03-18 15:26:21 UTC (rev 402)
+++ wasko/trunk/ChangeLog.txt	2009-03-18 15:48:54 UTC (rev 403)
@@ -1,5 +1,12 @@
 2009-03-18	Sascha L. Teichmann <teichmann at intevation.de>
 
+	*  waskaweb/model/case.py: Convert session case back to form data
+
+	*  waskaweb/controllers/case.py: Create new cases in actions for 
+	   Wiederaufnahme and Neuaufnahme.
+
+2009-03-18	Sascha L. Teichmann <teichmann at intevation.de>
+
 	* waskaweb/controllers/case.py: render special templates if 
 	  new case should be created as 'Wiederaufnahme' or 'Neuaufnahme'.
 

Modified: wasko/trunk/waskaweb/controllers/case.py
===================================================================
--- wasko/trunk/waskaweb/controllers/case.py	2009-03-18 15:26:21 UTC (rev 402)
+++ wasko/trunk/waskaweb/controllers/case.py	2009-03-18 15:48:54 UTC (rev 403)
@@ -341,10 +341,14 @@
 
                 aufnahme_typ = form_result["aufnahme_typ"]
 
+                if aufnahme_typ in (1, 2):
+                    session['signed'] = bool(form_result.get('statement_signed'))
+                    session.save()
+
                 if aufnahme_typ == 1:
                     # Wiedernahme
                     return render('/casemanagement/wiederaufnahme.mako')
-                elif aufnahme_typ == 2:
+                if aufnahme_typ == 2:
                     # Neuaufnahme
                     return render('/casemanagement/neuaufnahme.mako')
 
@@ -369,12 +373,56 @@
 
     @checkRole('cm_ka')
     def neuaufnahmeAction(self):
-        return "Neuaufnahme"
+        try:
+            session_case = session['case']
+            signed       = session['signed']
+        except KeyError:
+            raise HTTPNotFound("case not found")
 
+        # check extra params here!
+
+        del session['signed']
+        session.save()
+
+        # 1. Create a new case
+        factory = CaseFactory()
+        case = factory.createNew(data=session_case.toFormData())
+        statement = case.getPrivacyStatement()
+
+        # 2. Do we want to sign the statement?
+        if signed: statement.sign()
+
+        self.__init_case(case.id)
+        load_case(case.id)
+
+        return self.select(str(case.id))
+
     @checkRole('cm_ka')
     def wiederaufnahmeAction(self):
-        return "Wiedernahme"
+        try:
+            session_case = session['case']
+            signed       = session['signed']
+        except KeyError:
+            raise HTTPNotFound("case not found")
 
+        # check extra params here!
+
+        del session['signed']
+        session.save()
+
+        # 1. Create a new case
+        factory = CaseFactory()
+        case = factory.createNew(data=session_case.toFormData())
+        statement = case.getPrivacyStatement()
+
+        # 2. Do we want to sign the statement?
+        if signed: statement.sign()
+
+        self.__init_case(case.id)
+        load_case(case.id)
+
+        return self.select(str(case.id))
+
     @checkRole(('admin_ka', 'cm_ka', 'pb_ka'))
     def showHelp(self, help_id):
         help = g.helpData.getHelp(help_id)

Modified: wasko/trunk/waskaweb/model/case.py
===================================================================
--- wasko/trunk/waskaweb/model/case.py	2009-03-18 15:26:21 UTC (rev 402)
+++ wasko/trunk/waskaweb/model/case.py	2009-03-18 15:48:54 UTC (rev 403)
@@ -820,6 +820,16 @@
         self.plz        = save_getone(params, "plz",       "")
         self.city       = save_getone(params, "wohnort",   "")
 
+    def toFormData(self):
+        return {
+            'strasse'  : self.street,
+            'strassenr': self.streetnr,
+            'plz'      : self.plz,
+            'wohnort'  : self.city,
+            'name_1'   : self.last_name,
+            'vorname_1': self.first_name
+        }
+
     def getFirstMeeting(self):
         return self.first_name
 



More information about the Mpuls-commits mailing list