X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fprofil%2Fverif_adresses.inc.php;h=5ad35c5a942b3928a8487daf07644ecd7535c2a4;hb=17d6ca08e9f5e7bbad291d5fabfb2bc6da957381;hp=93ee5cbfad3311648b54c193184819e7c70445ff;hpb=0337d704b62718d7c77106c0e4c4e26fb02beacf;p=platal.git
diff --git a/include/profil/verif_adresses.inc.php b/include/profil/verif_adresses.inc.php
index 93ee5cb..5ad35c5 100644
--- a/include/profil/verif_adresses.inc.php
+++ b/include/profil/verif_adresses.inc.php
@@ -1,6 +1,6 @@
$adr) {
@@ -136,35 +173,29 @@ foreach($adresses as $adrid => $adr) {
$description = (($adr['numero_formulaire'] > 0)?"Adresse n°{$adr['numero_formulaire']}":"Nouvelle adresse");
if (strlen(strtok($adr['adr1'],"<>{}@~?!§*`|%$^=+")) < strlen($adr['adr1']))
{
- $str_error = $str_error."Le champ '$description - Ligne 1' contient un caractère interdit.
";
+ $page->trig("Le champ '$description - Ligne 1' contient un caractère interdit.");
}
if (strlen(strtok($adr['adr2'],"<>{}@~?!§*`|%$^=+")) < strlen($adr['adr2']))
{
- $str_error = $str_error."Le champ '$description - Ligne 2' contient un caractère interdit.
";
+ $page->trig("Le champ '$description - Ligne 2' contient un caractère interdit.");
}
if (strlen(strtok($adr['adr3'],"<>{}@~?!§*`|%$^=+")) < strlen($adr['adr3']))
{
- $str_error = $str_error."Le champ '$description - Ligne 3' contient un caractère interdit.
";
+ $page->trig("Le champ '$description - Ligne 3' contient un caractère interdit.");
}
if (strlen(strtok($adr['postcode'],"<>{}@~?!§*`|%$^=+")) < strlen($adr['postcode']))
{
- $str_error = $str_error."Le champ '$description - Code Postal' contient un caractère interdit.
";
- }
- if (strlen(strtok($adr['city'],"<>{}@~?!§*`|%$^=+")) < strlen($adr['postcode']))
- {
- $str_error = $str_error."Le champ '$description - Ville' contient un caractère interdit.
";
+ $page->trig("Le champ '$description - Code Postal' contient un caractère interdit.");
}
- if (strlen(strtok($adr['tel'],"<>{}@~\/:;?,!§*_`[]|%$^=\"")) < strlen($adr['tel']))
- {
- $str_error = $str_error."Le champ '$description - Téléphone' contient un caractère interdit.
";
- }
- if (strlen(strtok($adr['fax'],"<>{}@~\/:;?,!§*_`[]|%$^=\"")) < strlen($adr['fax']))
- {
- $str_error = $str_error."Le champ '$description - Fax' contient un caractère interdit.
";
+ foreach ($adr['tels'] as $tel) {
+ if (strlen(strtok($tel['tel'],"<>{}@~:;?,!§*_`[]|%$^=\"")) < strlen($tel['tel']))
+ {
+ $page->trig("Le champ '$description - ".$tel['tel_type']."' contient un caractère interdit.");
+ }
}
if(!$adr['secondaire']){
if($adresses_principales == 1){ //deja une adresse principale
- $str_error = $str_error."Tu ne peux avoir qu'une résidence principale.
";
+ $page->trig("Tu ne peux avoir qu'une résidence principale.");
$adresses_principales++;//pour eviter de repeter le message plusieurs fois
}
else $adresses_principales = 1;
@@ -173,83 +204,4 @@ foreach($adresses as $adrid => $adr) {
}
-//on vire les adresses vides :
-if(isset($adresses)){ // s'il y en a
- reset($adresses);
- foreach($adresses as $adrid => $adr){
- if(is_adr_empty($adrid)){
- delete_address($adrid);
- }
- }
-}
-//on génère une éventuelle nouvelle adresse
-if (!isset($adresses) || (count($adresses) < $nb_adr_max)){
- $adrid = generate_new_adrid();
- $adresses[$adrid]['adrid'] = $adrid;
- $adr = &$adresses[$adrid];
- $adr['adr1'] = '';
- $adr['adr2'] = '';
- $adr['adr3'] = '';
- $adr['postcode'] = '';
- $adr['city'] = '';
- $adr['country'] = '00';
- $adr['region'] = '';
- $adr['tel'] = '';
- $adr['fax'] = '';
- $adr['secondaire'] = 1;
- $adr['courrier'] = 0;
- $adr['active'] = 0;
- $adr['temporaire'] = 1;
- $adr['pub'] = 'private';
- $adr['tel_pub'] = 'private';
- $adr['nouvelle'] = 'new'; //n'est pas issue d'un formulaire (sert dans update_adresses...)
-}
-
-unset($adr);
-unset($adrid);
-
-//tri des adresses :
-
-reset($adresses);
-$i = 1;
-foreach($adresses as $adrid_ => $adr_){
- if(($adresses[$adrid_]['active']) && ($adr_['nouvelle'] != 'new')){
- $ordre_des_adrid[$i] = $adrid_;
- $i++;
- $est_attribuee[$adrid_] = 1;
- }
- else
- $est_attribuee[$adrid_] = 0;
-}
-
-reset($adresses);
-foreach($adresses as $adrid_ => $adr_){
- if(($adresses[$adrid_]['secondaire'] == 0) && ($est_attribuee[$adrid_] == 0) && ($adr_['nouvelle'] != 'new')){ // principale et non attribuee
- $ordre_des_adrid[$i] = $adrid_;
- $i++;
- $est_attribuee[$adrid_] = 1;
- }
-}
-
-reset($adresses);
-foreach($adresses as $adrid_ => $adr_){
- if(($adresses[$adrid_]['temporaire'] == 0) && ($est_attribuee[$adrid_] == 0) && ($adr_['nouvelle'] != 'new')){ // permanente et non attribuee
- $ordre_des_adrid[$i] = $adrid_;
- $i++;
- $est_attribuee[$adrid_] = 1;
- }
-}
-reset($adresses);
-foreach($adresses as $adrid_ => $adr_){
- if($est_attribuee[$adrid_] == 0){ // non attribuee
- $ordre_des_adrid[$i] = $adrid_;
- $i++;
- $est_attribuee[$adrid_] = 1;
- }
-}
-
-$nb_adr = $i - 1;
-$page->assign_by_ref('ordre_adrid',$ordre_des_adrid);
-$page->assign('nb_adr',$nb_adr+1);
-
?>