Fix filtering by promos on advanced search
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Sat, 3 Jul 2010 23:46:19 +0000 (01:46 +0200)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Sat, 3 Jul 2010 23:46:19 +0000 (01:46 +0200)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/userfilter.php
include/ufbuilder.inc.php

index cc8a611..058def4 100644 (file)
@@ -156,7 +156,8 @@ class UFC_Promo implements UserFilterCondition
             UserFilter::assertGrade($this->grade);
         }
         if ($this->grade == UserFilter::DISPLAY && $this->comparison != '=') {
-            Platal::page()->killError('Comparison ' . $this->comparison . ' not allowed on displaid promo');
+            // XXX: we might try to guess the grade from the first char of the promo and forbid only '<= 2004', but allow '<= X2004'
+            Platal::page()->killError("Il n'est pas possible d'appliquer la comparaison '" . $this->comparison . "' aux promotions sans spécifier de formation (X/M/D)");
         }
     }
 
index 7e37f02..6475f98 100644 (file)
@@ -620,7 +620,7 @@ class UFBF_Promo extends UFB_Field
     }
 
     protected function buildUFC(UserFilterBuilder &$ufb) {
-        return new UFC_Promo($this->comp, UserFilter::DISPLAY, 'X' . $this->val);
+        return new UFC_Promo($this->comp, UserFilter::GRADE_ING, $this->val);
     }
 }
 // }}}