bug 270 : pub pour les entreprises
authorPascal Corpet <pascal.corpet@m4x.org>
Tue, 1 Feb 2005 11:46:35 +0000 (11:46 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:58 +0000 (23:27 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-421

include/profil/assign_emploi.inc.php
include/profil/get_emploi.inc.php
include/profil/update_emploi.inc.php
include/profil/verif_emploi.inc.php
include/synchro_ax.inc.php
templates/profil/emploi.tpl
upgrade/0.9.5/30_entreprises.sql [new file with mode: 0644]

index 70d03f5..65f4388 100644 (file)
@@ -4,7 +4,7 @@
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
+ *  it under the terms of the GNU General Public License as pubprolished by   *
  *  the Free Software Foundation; either version 2 of the License, or      *
  *  (at your option) any later version.                                    *
  *                                                                         *
@@ -35,12 +35,9 @@ $page->assign('regionpro',$regionpro);
 $page->assign('telpro',$telpro);
 $page->assign('faxpro',$faxpro);
 $page->assign('mobilepro', $mobilepro);
-$page->assign('entreprise_public',$entreprise_public);
-$page->assign('entreprise_ax',$entreprise_ax);
-$page->assign('adrpro_public',$adrpro_public);
-$page->assign('adrpro_ax',$adrpro_ax);
-$page->assign('telpro_public',$telpro_public);
-$page->assign('telpro_ax',$telpro_ax);
+$page->assign('pubpro',$pubpro);
+$page->assign('adr_pubpro',$adr_pubpro);
+$page->assign('tel_pubpro',$tel_pubpro);
 $page->assign('cv',$cv);
 
 ?>
index d312fb6..40f6061 100644 (file)
@@ -25,8 +25,7 @@ require_once('fonction.emploi.inc.php');
 
 $res = $globals->xdb->iterRow("SELECT entrid, entreprise, secteur, ss_secteur, poste, fonction,
        adr1, adr2, adr3, cp, ville, pays, region, tel, fax, mobile,
-       FIND_IN_SET('entreprise_public',visibilite),FIND_IN_SET('entreprise_ax',visibilite),FIND_IN_SET('adr_public',visibilite),
-       FIND_IN_SET('adr_ax',visibilite),FIND_IN_SET('tel_public',visibilite),FIND_IN_SET('tel_ax',visibilite)
+       pub, adr_pub, tel_pub
         FROM entreprises
         WHERE uid = {?} ORDER BY entrid",Session::getInt('uid', -1));
 
@@ -34,8 +33,8 @@ $nb_res = $res->total();
 for($i = 0; $i < $nb_res ; $i++){
        list($endrid[$i], $entreprise[$i], $secteur[$i], $ss_secteur[$i], $poste[$i], $fonction[$i],
                     $adrpro1[$i], $adrpro2[$i], $adrpro3[$i], $cppro[$i], $villepro[$i], $payspro[$i], $regionpro[$i],
-             $telpro[$i], $faxpro[$i], $mobilepro[$i], $entreprise_public[$i], $entreprise_ax[$i], $adrpro_public[$i], $adrpro_ax[$i],
-            $telpro_public[$i], $telpro_ax[$i]) = $res->next();
+             $telpro[$i], $faxpro[$i], $mobilepro[$i], $pubpro[$i], $adr_pubpro[$i],
+            $tel_pubpro[$i]) = $res->next();
 }
 //limite dure a 2
 for($i = $nb_res; $i < 2 ; $i++){
@@ -55,12 +54,9 @@ for($i = $nb_res; $i < 2 ; $i++){
         $telpro[$i] = '';
        $faxpro[$i] = '';
        $mobilepro[$i] = '';
-       $entreprise_public[$i] = '';
-       $entreprise_ax[$i] ='';
-       $adrpro_public[$i] = '';
-       $adrpro_ax[$i] = '';                 
-       $telpro_public[$i] = '';
-       $telpro_ax[$i] = '';
+       $pubpro[$i] = '';
+       $adr_pubpro[$i] = '';
+       $tel_pubpro[$i] = '';
 }
 
 //recuperation des donnees sur les secteurs :
index 9a61a33..3b9d14c 100644 (file)
  ***************************************************************************/
 
 for($i = 0; $i < 2; $i++){
-    $visibilite = "";
-    $tab = Env::getMixed("entreprise_public", Array());
-    if (! empty($tab[$i])) $visibilite .= 'entreprise_public,';
-    $tab = Env::getMixed("entreprise_ax", Array());
-    if (! empty($tab[$i])) $visibilite .= 'entreprise_ax,';
-    $tab = Env::getMixed("adrpro_public", Array());
-    if (! empty($tab[$i])) $visibilite .= 'adr_public,';
-    $tab = Env::getMixed("adrpro_ax", Array());
-    if (! empty($tab[$i])) $visibilite .= 'adr_ax,';
-    $tab = Env::getMixed("telpro_public", Array());
-    if (! empty($tab[$i])) $visibilite .= 'tel_public,';
-    $tab = Env::getMixed("telpro_ax", Array());
-    if (! empty($tab[$i])) $visibilite .= 'tel_ax,';
-    if (! empty($visibilite)) $visibilite = substr($visibilite, 0, -1);
 
-    $globals->xdb->execute("REPLACE INTO entreprises(uid,entrid,entreprise,secteur,ss_secteur,poste,fonction,adr1,adr2,adr3,cp,ville,pays,region,tel,fax,mobile,visibilite) ".
+    $globals->xdb->execute("REPLACE INTO entreprises(uid,entrid,entreprise,secteur,ss_secteur,poste,fonction,adr1,adr2,adr3,cp,ville,pays,region,tel,fax,mobile,pub, adr_pub, tel_pub) ".
               "VALUES ({?}, {?}, {?}, ".
              "{?},".
              "{?}".
              ", {?}, {?}, ".
              "{?}, {?}, {?}, {?}, ".
              "{?}, {?}, ".
-             "{?}, {?}, {?}, {?}, {?})",
+             "{?}, {?}, {?}, {?}, ".
+             "{?}, {?}, {?})",
              Session::getInt('uid', -1) , $i , $entreprise[$i] ,
              ( ($secteur[$i] == "") ? null : $secteur[$i]), //sinon un faux 0 est rentre dans la base
              ( ($ss_secteur[$i] == "") ? null : $ss_secteur[$i]),
              $poste[$i], $fonction[$i],
               $adrpro1[$i], $adrpro2[$i], $adrpro3[$i], $cppro[$i],
               $villepro[$i], $payspro[$i],
-             $regionpro[$i], $telpro[$i], $faxpro[$i], $mobilepro[$i], $visibilite);
+             $regionpro[$i], $telpro[$i], $faxpro[$i], $mobilepro[$i],
+             $pubpro[$i], $adr_pubpro[$i], $tel_pubpro[$i]);
 }
 $globals->xdb->execute("UPDATE auth_user_md5 set cv= {?} WHERE user_id = {?}", $cv, Session::getInt('uid', -1));
 ?>
index 6a51fec..7940eca 100644 (file)
@@ -46,15 +46,9 @@ replace_ifset_i($regionpro,"regionpro",$i);
 replace_ifset_i($telpro,"telpro",$i);
 replace_ifset_i($faxpro,"faxpro",$i);
 replace_ifset_i($mobilepro,"mobilepro",$i);
-
-if(Env::has('adresse_flag')){
-  set_flag_i($entreprise_public,"entreprise_public",$i);
-  set_flag_i($entreprise_ax,"entreprise_ax",$i);
-  set_flag_i($adrpro_public,"adrpro_public",$i);
-  set_flag_i($adrpro_ax,"adrpro_ax",$i);
-  set_flag_i($telpro_public,"telpro_public",$i);
-  set_flag_i($telpro_ax,"telpro_ax",$i);
-}
+replace_ifset_i($pubpro,"pubpro",$i);
+replace_ifset_i($adr_pubpro,"adr_pubpro",$i);
+replace_ifset_i($tel_pubpro,"tel_pubpro",$i);
 replace_ifset($cv,"cv");
 
 // validité de l'entreprise
index cd56e75..3e50610 100644 (file)
@@ -247,7 +247,7 @@ function import_from_ax($userax, $epouse=false, $mobile=false, $del_address=null
                          cp = {?}, ville = {?},
                          pays = {?},
                          tel = {?}, fax = {?},
-                         visibilite = 'entreprise_ax,adr_ax,tel_ax'",
+                         pub = 'ax', adr_pub = 'ax', tel_pub = 'ax'",
                 $userax['uid'], $new_entrid,
                 $pro['entreprise'], $pro['fonction'],
                 $pro['adr1'], $pro['adr2'], $pro['adr3'],
index 4e95f44..67f31a2 100644 (file)
         <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
           <tr>
             <td class="vert">
-              <input type="checkbox" name="entreprise_public[{$i}]" value="1" {if $entreprise_public.$i}checked="checked"{/if} />
+              <input type="radio" name="pubpro[{$i}]" value="public" {if $pubpro.$i eq 'public'}checked="checked"{/if} />
             </td>
             <td class="texte">
               site public
             </td>
             <td class="orange">
-              <input type="checkbox" name="entreprise_ax[{$i}]" value="1" {if $entreprise_ax.$i}checked="checked"{/if} />
+              <input type="radio" name="pubpro[{$i}]" value="ax" {if $pubpro.$i eq 'ax'}checked="checked"{/if} />
             </td>
             <td class="texte">
               transmis à l'AX
             </td>
+            <td class="rouge">
+              <input type="radio" name="pubpro[{$i}]" value="private" {if $pubpro.$i eq 'private'}checked="checked"{/if} />
+            </td>
+            <td class="texte">
+              prive
+            </td>
             <td class="texte">
               <a href="{"docs/faq.php"|url}#flags" class="popup_800x240">Quelle couleur ??</a>
             </td>
         <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
           <tr>
             <td class="vert">
-              <input type="checkbox" name="adrpro_public[{$i}]" value="1" {if $adrpro_public.$i}checked="checked"{/if} />
+              <input type="radio" name="adr_pubpro[{$i}]" value="public" {if $adr_pubpro.$i eq 'public'}checked="checked"{/if} />
             </td>
             <td class="texte">
               site public
             </td>
             <td class="orange">
-              <input type="checkbox" name="adrpro_ax[{$i}]" value="1" {if $adrpro_ax.$i}checked="checked"{/if} />
+              <input type="radio" name="adr_pubpro[{$i}]" value="ax" {if $adr_pubpro.$i eq 'ax'}checked="checked"{/if} />
             </td>
             <td class="texte">
               transmis à l'AX
             </td>
+            <td class="rouge">
+              <input type="radio" name="adr_pubpro[{$i}]" value="private" {if $adr_pubpro.$i eq 'private'}checked="checked"{/if} />
+            </td>
+            <td class="texte">
+              prive
+            </td>
             <td class="texte">
               <a href="{"docs/faq.php"|url}#flags" class="popup_800x240">Quelle couleur ??</a>
             </td>
         <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
           <tr>
             <td class="vert">
-              <input type="checkbox" name="telpro_public[{$i}]" value="1" {if $telpro_public.$i}checked="checked"{/if} />
+              <input type="radio" name="tel_pubpro[{$i}]" value="public" {if $tel_pubpro.$i eq 'public'}checked="checked"{/if} />
             </td>
             <td class="texte">
               site public
             </td>
             <td class="orange">
-              <input type="checkbox" name="telpro_ax[{$i}]" value="1" {if $telpro_ax.$i}checked="checked"{/if} />
+              <input type="radio" name="tel_pubpro[{$i}]" value="ax" {if $tel_pubpro.$i eq 'ax'}checked="checked"{/if} />
             </td>
             <td class="texte">
               transmis à l'AX
             </td>
+            <td class="rouge">
+              <input type="radio" name="tel_pubpro[{$i}]" value="private" {if $tel_pubpro.$i eq 'private'}checked="checked"{/if} />
+            </td>
+            <td class="texte">
+              prive
+            </td>
             <td class="texte">
               <a href="{"docs/faq.php"|url}#flags" class="popup_800x240">Quelle couleur ??</a>
             </td>
diff --git a/upgrade/0.9.5/30_entreprises.sql b/upgrade/0.9.5/30_entreprises.sql
new file mode 100644 (file)
index 0000000..4a06935
--- /dev/null
@@ -0,0 +1,9 @@
+ALTER TABLE entreprises
+ADD pub ENUM('private', 'ax', 'public') DEFAULT 'private' NOT NULL,
+ADD adr_pub ENUM('private', 'ax', 'public') DEFAULT 'private' NOT NULL,
+ADD tel_pub ENUM('private', 'ax', 'public') DEFAULT 'private' NOT NULL;
+UPDATE entreprises SET
+pub = IF(FIND_IN_SET('entreprise_public', visibilite), 'public', IF(FIND_IN_SET('entreprise_ax', visibilite), 'ax', 'private')), 
+adr_pub = IF(FIND_IN_SET('adr_public', visibilite), 'public', IF(FIND_IN_SET('adr_ax', visibilite), 'ax', 'private')), 
+tel_pub = IF(FIND_IN_SET('tel_public', visibilite), 'public', IF(FIND_IN_SET('tel_ax', visibilite),'ax', 'private'));
+ALTER TABLE entreprises DROP visibilite;