[Mpuls-commits] r544 - in wasko/trunk: . waskaweb/controllers waskaweb/lib waskaweb/templates/casemanagement

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Jul 16 10:33:39 CEST 2009


Author: torsten
Date: 2009-07-16 10:33:39 +0200 (Thu, 16 Jul 2009)
New Revision: 544

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/controllers/case_overview.py
   wasko/trunk/waskaweb/lib/search.py
   wasko/trunk/waskaweb/templates/casemanagement/search.mako
Log:
Added new searchfilter for migration


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-07-15 15:23:35 UTC (rev 543)
+++ wasko/trunk/ChangeLog.txt	2009-07-16 08:33:39 UTC (rev 544)
@@ -1,3 +1,12 @@
+2009-07-16	Torsten Irlaender  <torsten.irlaender at intevation.de> 
+
+	Added addidional search filter:
+
+	* waskaweb/controllers/case_overview.py,
+	  waskaweb/lib/search.py,
+	  waskaweb/templates/casemanagement/search.mako: New search filter to
+	  search for migration
+
 2009-07-15	Sascha L. Teichmann <sascha.teichmann at intevation.de>
 
 	* waskaweb/model/casexml.py: Fixed issue344 

Modified: wasko/trunk/waskaweb/controllers/case_overview.py
===================================================================
--- wasko/trunk/waskaweb/controllers/case_overview.py	2009-07-15 15:23:35 UTC (rev 543)
+++ wasko/trunk/waskaweb/controllers/case_overview.py	2009-07-16 08:33:39 UTC (rev 544)
@@ -148,6 +148,10 @@
     if options.get('search_str'):
         search_options.append(options.get('search_str'))
 
+    #Migration
+    if options.get('migration', '-2') != '-2':
+        search_options.append('migration:%s' % options.get('migration'))
+
     #cm-states
     cm_state = options.get('cm_state')
     phases = [] # default
@@ -289,6 +293,7 @@
         validator = SearchCaseForm()
         c.form_result = {}
         c.form_errors = {}
+        print request.params
         try:
             form_result = validator.to_python(request.params)
         except formencode.Invalid, error:

Modified: wasko/trunk/waskaweb/lib/search.py
===================================================================
--- wasko/trunk/waskaweb/lib/search.py	2009-07-15 15:23:35 UTC (rev 543)
+++ wasko/trunk/waskaweb/lib/search.py	2009-07-16 08:33:39 UTC (rev 544)
@@ -39,7 +39,7 @@
 
 SAVE_SEARCH = re.compile(r'[^\w:;\-\. ]', re.UNICODE)
 
-VALID_OPTIONS = ['editor', 'own', 'standin', 'state', 'sort_field', 'sort_order', 'interval_start_date', 'interval_end_date', 'interval_start_field', 'interval_end_field', 'gender', 'phase', 'branch', 'fkz', 'inconsistency', 'only_cases_after', 'bad', 'field']
+VALID_OPTIONS = ['editor', 'migration', 'own', 'standin', 'state', 'sort_field', 'sort_order', 'interval_start_date', 'interval_end_date', 'interval_start_field', 'interval_end_field', 'gender', 'phase', 'branch', 'fkz', 'inconsistency', 'only_cases_after', 'bad', 'field']
 
 SEARCH_CASE_SQL = \
 """ SELECT
@@ -78,6 +78,7 @@
       AND %s
       AND %s
       AND %s
+      AND %s
     ORDER BY %s %s"""
 
 INCONSISTENCY_CHECK_AFTER = '2008-08-31'
@@ -269,6 +270,17 @@
         if phaseslist:
             phases = 'm.id in (SELECT id from master_tbl_view WHERE phase in (%s))' % ','.join([str(p) for p in phaseslist])
 
+        #Migration
+        migration = "TRUE"
+        print options.get('migration')
+        if options.get('migration'):
+            if options.get('migration') == '1':
+                migration = "(nat_muspra not in (18,-1, -3) or nat_staat not in (1,-1,-3) or vater_land not in (1, -1, -3) or mutter_land not in (1,-1, -3))"
+            elif options.get('migration') == '0':
+                migration = "(nat_muspra in (18) and nat_staat in (1) and vater_land not in (1) and mutter_land in (1))"
+            elif options.get('migration') == '2':
+                migration = "(nat_staat = 2 and (vater_staat != 2 or mutter_staat != 2))"
+
         ##User defined fieldsearch
         #fieldsearchlist = [] 
         #for field, value in fieldsdic.iteritems():
@@ -280,7 +292,8 @@
         #    fieldsearch = 'TRUE'
 
         fields['needle'] = " ".join(search) 
-        SQL = SEARCH_CASE_SQL % (",".join([str(x) for x in allowed_states]), ee, allowed_viewer, editor, gender, time_interval, phases, branch, fkz, bad, only_cases_after, sort_field, sort_order) 
+        SQL = SEARCH_CASE_SQL % (",".join([str(x) for x in allowed_states]), ee, allowed_viewer, editor, gender, time_interval, phases, branch, fkz, bad, only_cases_after, migration, sort_field, sort_order) 
+        print  options 
         return (SQL, fields)
 
 # vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:

Modified: wasko/trunk/waskaweb/templates/casemanagement/search.mako
===================================================================
--- wasko/trunk/waskaweb/templates/casemanagement/search.mako	2009-07-15 15:23:35 UTC (rev 543)
+++ wasko/trunk/waskaweb/templates/casemanagement/search.mako	2009-07-16 08:33:39 UTC (rev 544)
@@ -62,6 +62,17 @@
       </tr>
       % endif
       <tr>
+        <td width="80" valign="top"><label for="migration">Migration:</label></td>
+        <td valign="top">
+          <select name="migration" id="migration">
+            <option value="-2">Keine Auswahl</option>
+            <option value="1">Ja</option>
+            <option value="0">Nein</option>
+            <option value="2">Auffällig</option>
+          </select>
+        </td>
+      </tr>
+      <tr>
         <td width="80" valign="top"><label for="gender">Geschlecht:</label></td>
         <td valign="top">
           <select name="gender" id="gender">



More information about the Mpuls-commits mailing list