[Mpuls-commits] r4938 - in base/trunk: . mpulsweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon May 2 11:31:09 CEST 2011


Author: torsten
Date: 2011-05-02 11:31:08 +0200 (Mon, 02 May 2011)
New Revision: 4938

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb/model/case.py
Log:
mpulsweb/model/case.py (createNew): Issue2017: If half- or fullautomatic changemode for phases is enabled ttry to set the highest reachable phase on case-creation.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2011-05-02 09:10:17 UTC (rev 4937)
+++ base/trunk/ChangeLog	2011-05-02 09:31:08 UTC (rev 4938)
@@ -9,6 +9,9 @@
 	case creation to display errors in input data.
 	* mpulsweb/model/case.py (_updateMasterOnCreate): Reraise exception.
 	Is not handled in controller.
+	* mpulsweb/model/case.py (createNew): Issue2017: If half- or
+	fullautomatic changemode for phases is enabled ttry to set the highest
+	reachable phase on case-creation.
 
 2011-04-29  Roland Geider  <roland.geider at intevation.de>
 	* mpulsweb/public/styles/all.css,

Modified: base/trunk/mpulsweb/model/case.py
===================================================================
--- base/trunk/mpulsweb/model/case.py	2011-05-02 09:10:17 UTC (rev 4937)
+++ base/trunk/mpulsweb/model/case.py	2011-05-02 09:31:08 UTC (rev 4938)
@@ -58,7 +58,7 @@
 from mpulsweb.model.document import listDocuments
 from mpulsweb.model.statement import PrivacyStatement
 from mpulsweb.model.phase import PhaseFactory, StartPhasePart, \
-    ConsistenceCheckException, PHASEFIELD
+    ConsistenceCheckException, PHASEFIELD, PC_MANUAL
 from mpulsweb.model.user import UserObject
 from mpulsweb.model.agencysettings import Agency
 from mpulsweb.model.logbook import export_logbook, get_logbook_import_factory, \
@@ -1191,6 +1191,13 @@
 
         case = self.case_cls(id)
         case.checkValidity()
+        # Set hightes reachable phase id phase change mode is half or
+        # fullautomatic
+        changemode = g.mpuls_config.get('phases', 'changemode')
+        if changemode != PC_MANUAL: 
+            phases = PhaseFactory().load(case.id)
+            reachable_phase = phases.get_max_phase_id()
+            case.setPhase(reachable_phase)
         return case
 
     def _updateMasterOnCreate(self, instance_tree, data):



More information about the Mpuls-commits mailing list