[Mpuls-commits] r404 - in wasko/trunk: . waskaweb/controllers waskaweb/i18n/de/LC_MESSAGES waskaweb/lib waskaweb/templates/casemanagement

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Mar 18 17:47:04 CET 2009


Author: torsten
Date: 2009-03-18 17:47:00 +0100 (Wed, 18 Mar 2009)
New Revision: 404

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/controllers/case.py
   wasko/trunk/waskaweb/controllers/caselifetime.py
   wasko/trunk/waskaweb/i18n/de/LC_MESSAGES/waskaweb.po
   wasko/trunk/waskaweb/lib/validators.py
   wasko/trunk/waskaweb/templates/casemanagement/neuaufnahme.mako
   wasko/trunk/waskaweb/templates/casemanagement/wiederaufnahme.mako
Log:
Added basic workflow for "wiederaufnahme"/"neuaufnahme" when creating a new case


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-03-18 15:48:54 UTC (rev 403)
+++ wasko/trunk/ChangeLog.txt	2009-03-18 16:47:00 UTC (rev 404)
@@ -1,3 +1,15 @@
+2009-03-18	Torsten Irlaender  <torsten.irlaender at intevation.de> 
+
+	Added basic workflow for "wiederaufnahme"/"neuaufnahme" when creating
+	a new case.
+
+	* waskaweb/i18n/de/LC_MESSAGES/waskaweb.po: New versionstrng
+	* waskaweb/controllers/caselifetime.py,
+	  waskaweb/controllers/case.py,
+	  waskaweb/lib/validators.py,
+	  waskaweb/templates/casemanagement/neuaufnahme.mako,
+	  waskaweb/templates/casemanagement/wiederaufnahme.mako: New workflow
+
 2009-03-18	Sascha L. Teichmann <teichmann at intevation.de>
 
 	*  waskaweb/model/case.py: Convert session case back to form data

Modified: wasko/trunk/waskaweb/controllers/case.py
===================================================================
--- wasko/trunk/waskaweb/controllers/case.py	2009-03-18 15:48:54 UTC (rev 403)
+++ wasko/trunk/waskaweb/controllers/case.py	2009-03-18 16:47:00 UTC (rev 404)
@@ -51,8 +51,11 @@
                                         CreateAppointmentForm, \
                                         CreateLogbookForm, \
                                         EditLogbookForm, \
-                                        SetPhaseForm
+                                        SetPhaseForm, \
+                                        WiederaufnahmeCaseForm, \
+                                        NeuaufnahmeCaseForm
 
+
 from waskaweb.lib.helpers import dd_mm_YYYY, HH_MM
 
 from waskaweb.model.repeatgroup    import AidObject, AidList
@@ -68,6 +71,7 @@
 from waskaweb.model.navigation     import NavigationTree
 from waskaweb.lib.security         import checkRole
 from waskaweb.model.document       import listDocuments
+from waskaweb.model.casedocument   import DataSaveException
 from waskaweb.model.data           import FilteredNodeComponentProxy
 from waskaweb.model.logbook        import Logbook, LogbookEntry, LogbookEntryChecker
 
@@ -380,23 +384,44 @@
             raise HTTPNotFound("case not found")
 
         # check extra params here!
+        validator = NeuaufnahmeCaseForm()
+        try:
+            form_result = validator.to_python(request.params)
 
-        del session['signed']
-        session.save()
+            del session['signed']
+            session.save()
 
-        # 1. Create a new case
-        factory = CaseFactory()
-        case = factory.createNew(data=session_case.toFormData())
-        statement = case.getPrivacyStatement()
+            # 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()
+            # 2. Do we want to sign the statement?
+            if signed: statement.sign()
 
-        self.__init_case(case.id)
-        load_case(case.id)
+            self.__init_case(case.id)
+            load_case(case.id)
 
-        return self.select(str(case.id))
+            form_result['cm_neuauf_genehm'] = '1'
+            form_result['cm2c'] = '1'
+            form_result['cm_dok_end_art'] = '2'
+            try:
+                g.formedTree.setData(form_result)
+            except DataSaveException, err:
+                c.status_msg = h.status_message(
+                    "Eingabedaten fehlerhaft! Daten wurden nicht gespeichert.")
 
+            return self.select(str(case.id))
+        except formencode.Invalid, error:
+            c.form_result = error.value
+            c.form_errors = error.error_dict or {}
+            form = render('/casemanagement/neuaufnahme.mako')
+            print c.form_errors
+            return formencode.htmlfill.render(unicode(form, 'utf-8'), \
+                        defaults=c.form_result, \
+                        auto_insert_errors=False, \
+                        errors=c.form_errors)
+
     @checkRole('cm_ka')
     def wiederaufnahmeAction(self):
         try:
@@ -406,23 +431,44 @@
             raise HTTPNotFound("case not found")
 
         # check extra params here!
+        validator = WiederaufnahmeCaseForm()
+        try:
+            form_result = validator.to_python(request.params)
 
-        del session['signed']
-        session.save()
+            del session['signed']
+            session.save()
 
-        # 1. Create a new case
-        factory = CaseFactory()
-        case = factory.createNew(data=session_case.toFormData())
-        statement = case.getPrivacyStatement()
+            # 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()
+            # 2. Do we want to sign the statement?
+            if signed: statement.sign()
 
-        self.__init_case(case.id)
-        load_case(case.id)
+            self.__init_case(case.id)
+            load_case(case.id)
 
-        return self.select(str(case.id))
+            form_result['cm_wiederauf_genehm_1'] = '1'
+            form_result['cm2c'] = '1'
+            form_result['cm_dok_end_art'] = '1'
+            try:
+                g.formedTree.setData(form_result)
+            except DataSaveException, err:
+                c.status_msg = h.status_message(
+                    "Eingabedaten fehlerhaft! Daten wurden nicht gespeichert.")
 
+            return self.select(str(case.id))
+        except formencode.Invalid, error:
+            c.form_result = error.value
+            c.form_errors = error.error_dict or {}
+            form = render('/casemanagement/wiederaufnahme.mako')
+            print c.form_errors
+            return formencode.htmlfill.render(unicode(form, 'utf-8'), \
+                        defaults=c.form_result, \
+                        auto_insert_errors=False, \
+                        errors=c.form_errors)
+
     @checkRole(('admin_ka', 'cm_ka', 'pb_ka'))
     def showHelp(self, help_id):
         help = g.helpData.getHelp(help_id)

Modified: wasko/trunk/waskaweb/controllers/caselifetime.py
===================================================================
--- wasko/trunk/waskaweb/controllers/caselifetime.py	2009-03-18 15:48:54 UTC (rev 403)
+++ wasko/trunk/waskaweb/controllers/caselifetime.py	2009-03-18 16:47:00 UTC (rev 404)
@@ -83,7 +83,6 @@
     end_art = D('cm_end_art')
     c.casedata = g.formedTree 
     c.phase = D('phase')
-    c.phase = 3
     c.cm_neuauf_genehm = D('cm_neuauf_genehm')
 
     # Welche Beendigung?

Modified: wasko/trunk/waskaweb/i18n/de/LC_MESSAGES/waskaweb.po
===================================================================
--- wasko/trunk/waskaweb/i18n/de/LC_MESSAGES/waskaweb.po	2009-03-18 15:48:54 UTC (rev 403)
+++ wasko/trunk/waskaweb/i18n/de/LC_MESSAGES/waskaweb.po	2009-03-18 16:47:00 UTC (rev 404)
@@ -552,7 +552,7 @@
 
 #: waskaweb/templates/main.mako:197
 msgid "footer_version"
-msgstr "18.03.2009 | Version 0.6-preview"
+msgstr "18.03.2009 | Version 0.7-preview"
 
 #: waskaweb/templates/main_login.mako:38
 msgid "main_login_bmf_phrase"

Modified: wasko/trunk/waskaweb/lib/validators.py
===================================================================
--- wasko/trunk/waskaweb/lib/validators.py	2009-03-18 15:48:54 UTC (rev 403)
+++ wasko/trunk/waskaweb/lib/validators.py	2009-03-18 16:47:00 UTC (rev 404)
@@ -428,4 +428,16 @@
     cm_wiederauf_datum_bis_2    = DateCheck(not_empty=True)
     anmerkungen                 = formencode.validators.String(not_empty=True)
 
+class WiederaufnahmeCaseForm(BaseFormValidator):
+    cm_dok_datum_beendigung     = DateCheck(not_empty=True)
+    cm_dok_end_verm             = formencode.validators.String()
+    cm_wiederauf_genehm_datum_1 = DateCheck(not_empty=True)
+    cm_wiederauf_datum_bis_1    = DateCheck(not_empty=True)
+    cm2c_t                      = formencode.validators.String()
+
+class NeuaufnahmeCaseForm(BaseFormValidator):
+    cm_dok_datum_beendigung     = DateCheck(not_empty=True)
+    cm_dok_end_sonst            = formencode.validators.String()
+    cm2c_t                      = formencode.validators.String()
+
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8

Modified: wasko/trunk/waskaweb/templates/casemanagement/neuaufnahme.mako
===================================================================
--- wasko/trunk/waskaweb/templates/casemanagement/neuaufnahme.mako	2009-03-18 15:48:54 UTC (rev 403)
+++ wasko/trunk/waskaweb/templates/casemanagement/neuaufnahme.mako	2009-03-18 16:47:00 UTC (rev 404)
@@ -6,7 +6,35 @@
 		<li><a href="/case/">${_('cm_np_new')}</a></li>
 </%def>
 <div class="waska_form">
-<h1>Neuaufnahme nach sonstiger Beendigung</h1>
+<h1>Wiederaufnahme nach erfolgreicher Reintegration</h1>
 <form id="waska_form" action="/case/neuaufnahmeAction" accept-charset="UTF-8" name="waska_form" method="POST">
+  <fieldset>
+<legend>Angaben zur bereits erfolgten Beendigung der Betreuung </legend>
+<div class="waska_form_element  w50">
+<label for="cm_dok_datum_beendigung"><a name="f_cm_dok_datum_beendigung">Datum der Beendigung</a> </label><br>
+<input type="text" size="10" maxlength="10" class=""  name="cm_dok_datum_beendigung" id="cm_dok_datum_beendigung"  onchange="setModification();"><br>
+</div>
+<div class="waska_form_element  w50">
+<label for="cm_dok_end_sonst"><a name="f_cm_dok_end_sonst">Gründe für sonstige Beendigung</a> </label><br>
+<select id="cm_dok_end_sonst" class="" onchange="setModification();" name="cm_dok_end_sonst" size="1">
+<option value="1">Umzug</option>
+<option value="2">Schwangerschaft</option>
+<option value="3">Krankheit</option>
+<option value="4">Überschreitung Förderzeitraum</option>
+<option value="" value="5">Haft/Strafvollzug</option>
+<option value="6">Ausbildung, Arbeit</option>
+<option value="-3">unbekannt</option>
+<option value="-2">Sonstiges</option>
+<option selected value="-1">keine Angabe</option>
+</select>
+</div>
+<div class="waska_form_element  w100">
+<label for="cm2c_t">
+<a name="f_cm2c_t">Anmerkungen zur Neuaufnahme</a>
+</label>
+<textarea onchange="setModification();" rows="2" id="cm2c_t" name="cm2c_t" class=""/></textarea>
+</div>
+</fieldset>
+<input type="submit" value="Fallakte anlegen">
 </form>
 </div>

Modified: wasko/trunk/waskaweb/templates/casemanagement/wiederaufnahme.mako
===================================================================
--- wasko/trunk/waskaweb/templates/casemanagement/wiederaufnahme.mako	2009-03-18 15:48:54 UTC (rev 403)
+++ wasko/trunk/waskaweb/templates/casemanagement/wiederaufnahme.mako	2009-03-18 16:47:00 UTC (rev 404)
@@ -8,5 +8,41 @@
 <div class="waska_form">
 <h1>Wiederaufnahme nach erfolgreicher Reintegration</h1>
 <form id="waska_form" action="/case/wiederaufnahmeAction" accept-charset="UTF-8" name="waska_form" method="POST">
+  <fieldset>
+<legend>Angaben zur bereits erfolgten Beendigung der Betreuung </legend>
+<div class="waska_form_element  w50">
+<label for="cm_dok_datum_beendigung"><a name="f_cm_dok_datum_beendigung">Datum der Beendigung</a> </label><br>
+<input type="text" size="10" maxlength="10" class=""  name="cm_dok_datum_beendigung" id="cm_dok_datum_beendigung"  onchange="setModification();"><br>
+</div>
+<div class="waska_form_element  w50">
+<label for="cm_dok_end_verm"><a name="f_cm_dok_end_verm">Wohin erfolgte die Reintegration?</a> </label><br>
+<select size="1" class=""   name="cm_dok_end_verm" id="cm_dok_end_verm" onchange="setModification();">
+<option value="1">Ursprungsklasse</option>
+<option value="2">gleiche Schule, neue Klasse</option>
+<option value="3">andere Schule</option>
+<option value="-3">unbekannt</option>
+<option value="-2">Sonstiges</option>
+<option value="-1" selected>keine Angabe</option>
+</select>
+</div>
+<div class="waska_form_element  w100">
+<label for="cm2c_t">
+<a name="f_cm2c_t">Anmerkungen zur Wiederaufnahme</a>
+</label>
+<textarea onchange="setModification();" rows="2" id="cm2c_t" name="cm2c_t" class=""/></textarea>
+</div>
+</fieldset>
+<fieldset>
+<legend>Wiederaufnahme der/des Jugendlichen für 3 Monate</legend>
+<div class="waska_form_element  w50">
+<label for="cm_wiederauf_genehm_datum_1"><a name="f_cm_wiederauf_genehm_datum_1">Datum Genehmigung der Wiederaufnahme</a></lable>
+<input type="text" size="10" maxlength="10" class=""  name="cm_wiederauf_genehm_datum_1" id="cm_wiederauf_genehm_datum_1"  onchange="setModification();"><br>
+</div>
+<div class="waska_form_element  w50">
+<label for="cm_wiederauf_datum_bis_1"><a name="f_cm_wiederauf_datum_bis_1">Datum Wiederaufnahme genehmigt bis</a> </label><br>
+<input type="text" size="10" maxlength="10" class=""  name="cm_wiederauf_datum_bis_1" id="cm_wiederauf_datum_bis_1"  onchange="setModification();"><br>
+</div>
+</fieldset>
+<input type="submit" value="Fallakte anlegen">
 </form>
 </div>



More information about the Mpuls-commits mailing list