[Devel] r454 - branches/dui

svn at agendadulibre.org svn at agendadulibre.org
Dim 1 Nov 19:10:08 CET 2009


Author: ldayot
Date: Sun Nov  1 19:10:07 2009
New Revision: 454

Log:
Correction pour permettre un evenement propose pour une ville ayant plusieurs codes postaux et l'inverse. Avant, c'etait bloquant.

Modified:
   branches/dui/class.event.inc.php
   branches/dui/submit.php

Modified: branches/dui/class.event.inc.php
==============================================================================
--- branches/dui/class.event.inc.php	Sun Nov  1 19:08:38 2009	(r453)
+++ branches/dui/class.event.inc.php	Sun Nov  1 19:10:07 2009	(r454)
@@ -302,8 +302,14 @@
             substr("0". $city_record->postalcode, -5). " ".
             $city_record->majname. "</option>";
         }
-      echo "</select> <br/>ou "; 
-    } ?>
+      echo "</select>\n <br/>ou "; 
+    } else {
+			if ($this->postalcode>0)
+			{
+				echo "<input type='hidden' name='__event_postalcode' value='{$this->postalcode}' />\n";
+			}
+		}
+			?>
        <input type="text" size="70" name="__event_city" value="<?php echo $this->city;?>"/>
       </td>
     </tr>
@@ -585,9 +591,21 @@
           }
         else
           {
-            $this->message .= returnError ("Plusieurs villes portent ce nom. Veuillez préciser.");
-            $this->postalcode = -1;
-            $error_cnt++;
+						while ($city_record = $this->db->fetchObject($city_res))
+						{
+							if ($this->postalcode ==
+              	(strlen($city_record->postalcode)==4 ? "0" : ""). $city_record->postalcode)
+							{
+								$_isPostalcodeCity = true;
+								break;
+							}
+						}
+						if (! isset($_isPostalcodeCity))
+						{ 
+              $this->message .= returnError ("Plusieurs villes portent ce nom. Veuillez préciser.");
+              $this->postalcode = -1;
+              $error_cnt++;
+					  }
           }
       }
     else

Modified: branches/dui/submit.php
==============================================================================
--- branches/dui/submit.php	Sun Nov  1 19:08:38 2009	(r453)
+++ branches/dui/submit.php	Sun Nov  1 19:10:07 2009	(r454)
@@ -59,7 +59,7 @@
   $event->fromForm();
   $event->check();
 
-  $_check_ok = ($event->error==0 || $_POST['__event_force']);
+  $_check_ok = ($event->error==0 || isset($_POST['__event_force']));
 
   if ($event->message>"")
     error($event->message);


Plus d'informations sur la liste de diffusion Devel