[Mpuls-commits] r1915 - in waska/trunk: . formed waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Mar 9 15:29:49 CET 2010


Author: roland
Date: 2010-03-09 15:29:48 +0100 (Tue, 09 Mar 2010)
New Revision: 1915

Modified:
   waska/trunk/ChangeLog
   waska/trunk/formed/formedtree_web.xml
   waska/trunk/waskaweb/model/datapage.py
Log:
Added check for case management date start and end

Modified: waska/trunk/ChangeLog
===================================================================
--- waska/trunk/ChangeLog	2010-03-09 09:10:37 UTC (rev 1914)
+++ waska/trunk/ChangeLog	2010-03-09 14:29:48 UTC (rev 1915)
@@ -1,3 +1,10 @@
+2010-03-09	Roland Geider <roland.geider at intevation.de>
+
+        Added date check for case management start and end
+
+        * waskaweb/model/datapage.py save: check if new date value is before the 01.01.2010
+        * formed/formedtree_web.xml: conditional to set date to read only
+
 2010-03-04  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	* waskaweb/lib/config.py: Changed default values for evaluation to

Modified: waska/trunk/formed/formedtree_web.xml
===================================================================
--- waska/trunk/formed/formedtree_web.xml	2010-03-09 09:10:37 UTC (rev 1914)
+++ waska/trunk/formed/formedtree_web.xml	2010-03-09 14:29:48 UTC (rev 1915)
@@ -595,7 +595,9 @@
               <bool description="Ja" name="Ja" value="1"/>
               <bool description="Nein" name="Nein" value="0"/>
             </choice>
-            <date description="Datum der Entscheidung" flags="required:clearing_ende,beratung_start,cm_start;time:clearing_ende,cm_start,beratung_start" name="datum_feststellung" target="b"/>
+            <conditional expr="$datum_feststellung isset not $datum_feststellung 1 1 2010 date > or" name="conditional-11" target="a">
+                <date description="Datum der Entscheidung" flags="required:clearing_ende,beratung_start,cm_start;time:clearing_ende,cm_start,beratung_start" name="datum_feststellung" target="b"/>
+            </conditional>
           </group>
           <group containers="a,b" description="Case-Management-Fall (nur ausfüllen wenn Übernahme in das CM)" name="case_management_fall" target="c">
             <choice description="Kompetenzfeststellung ist erforderlich mit folgender primärer Zielsetzung" formularname="Zielsetzung" name="zielsetzung" size="1" target="a">
@@ -1539,7 +1541,9 @@
             <int description="Zeitraum CM (in Wochen)" flags="evaluation" formularname="Zeitraum_Fallmanagement" maxvalue="250" minvalue="0" name="zeitraum_fallmanagement" target="b"/>
           </group>
           <group containers="a,b,c" description="Angaben zur Beendigung des CM" name="angabenzurbeendigungdescm" target="c">
-            <date description="Beendigung CM (Datum)" flags="required:cm_ende,nachbetreuung_start;time:cm_ende,nachbetreuung_start" formularname="Beendigung" name="beendigung_5" target="a"/>
+              <conditional expr="$beendigung_5 isset not $beendigung_5 1 1 2010 date > or" name="conditional-12" target="a">
+                <date description="Beendigung CM (Datum)" flags="required:cm_ende,nachbetreuung_start;time:cm_ende,nachbetreuung_start" formularname="Beendigung" name="beendigung_5" target="a"/>
+            </conditional>
             <choice description="Art der Beendigung" flags="evaluation;required:cm_ende" formularname="Art_Beendigung" name="art_beendigung" size="1" target="a">
               <bool checked="s" description="Keine Angabe" name="keineangabe" value="-1"/>
               <bool description="vorzeitige Beendigung" name="vorzeitig" value="2"/>

Modified: waska/trunk/waskaweb/model/datapage.py
===================================================================
--- waska/trunk/waskaweb/model/datapage.py	2010-03-09 09:10:37 UTC (rev 1914)
+++ waska/trunk/waskaweb/model/datapage.py	2010-03-09 14:29:48 UTC (rev 1915)
@@ -35,6 +35,7 @@
 from waskaweb.lib.db         import db
 
 import sys
+import datetime
 
 def convert(x):
     if isinstance(x, str): return unicode(x, 'utf-8') 
@@ -191,7 +192,17 @@
                     # Hopefully this one causes no trouble any more
                     old_errors.pop(k, None)
                     # the empty array is for the rules
-                    to_be_set[k] = (checkAndConvert(widget, value), [])
+                    nv = checkAndConvert(widget, value)
+                    ov = self.getData(k)
+                    if nv != ov:
+                        # Raise an exception if the new date of the start or the end of
+                        # the case management is before the 1.1.2010 (ignore if the value
+                        # is from an old file)
+                        if k in ['datum_feststellung', 'beendigung_5']:
+                            
+                            if nv < datetime.date(2010, 01, 01):
+                                raise SematicError('Datum darf nicht vor dem 1.1.2010 liegen')
+                        to_be_set[k] = (nv, [])
             except SematicError, inst:
                 ei = ErrorItem(pageName, value, widget.getDescription())
                 ei.addMessage(inst.value)



More information about the Mpuls-commits mailing list