require_once('user.func.inc.php');
-function get_user_ax($uid, $raw=false) {
+function get_user_ax($uid, $raw=false)
+{
require_once('webservices/manageurs.inc.php');
require_once('webservices/manageurs.client.inc.php');
global $globals;
$res = $globals->xdb->query(
- "SELECT matricule_ax
- FROM auth_user_md5 AS u
- WHERE u.user_id = {?}", $uid);
+ "SELECT matricule_ax
+ FROM auth_user_md5 AS u
+ WHERE u.user_id = {?}", $uid);
$matricule_ax = $res->fetchOneCell();
$array = get_annuaire_infos(2, $matricule_ax, 0);
$userax = Array();
+ $userax['matricule_ax'] = $matricule_ax;
$userax['uid'] = $uid;
+
$userax['nom'] = $ancien[0];
- $userax['prenom'] = $ancien[4];
+ // ancien1 = ?
$userax['epouse'] = ($ancien[2] != $ancien[0])?$ancien[2]:"";
- $userax['promo'] = $ancien[6];
+ // ancien3 = ?
+ $userax['prenom'] = $ancien[4];
$userax['sexe'] = ($ancien[5] != 'M')?1:0;
+ $userax['promo'] = $ancien[6];
+ // ancien7 = Type de membre à l'AX
+ // ancien8 = dernière année de cotisation
$userax['nationalite'] = $ancien[9];
+ // ancien10 = ?
+ // ancine11 = ?
$userax['date'] = substr($ancien[12], 0, 10);
$userax['mobile'] = $array['cell'];
if ($ancien[13] == 'D' || $ancien[13] == 'Z') {
} else {
$userax['applis_join'] = "Corps ".$ancien[13]." - ".$ancien[14];
}
+ // ancien15 = login AX
+ // ancien16 = ?
+ // ancien17 = prenom.nom
$userax['adr_pro'] = array();
if (is_array($array['dump']['pro'])) {
foreach ($array['dump']['pro'] as $job) {
+ // job0 = code identifiant de l'entreprise
$jobax['entreprise'] = $job[1];
+ // job2 = comme job1 (peut etre plus court pour les noms longs)
+ // job4 = sigle de l'entreprise
+ // job5 = maj de l'adresse pro
$jobax['fonction'] = $job[6];
+ // job7 = ? peut être id de l'adresse dans la base AX
+ // job8 = matricule AX
+ // job9 = type d'adresse PRO = professionelle
$jobax['adr1'] = $job[10];
$jobax['adr2'] = $job[11];
$jobax['adr3'] = $job[12];
$jobax['cp'] = $job[13];
$jobax['ville'] = $job[14];
+ // job15 = ?
+ // job16 = ?
$jobax['pays'] = $job[17];
+ // job18 = ?
$jobax['tel'] = $job[19];
+ $jobax['fax'] = $job[20];
+ // job21 = f ?
+ // job22 = ?
+ // job23 = date de mise à jour de l'adresse
+ // job24 = ?
$userax['adr_pro'][] = $jobax;
}
}
$userax['adr'] = array();
if (is_array($array['dump']['adresse'])) {
foreach ($array['dump']['adresse'] as $adr) {
+ // adr0 : ?
+ // adr1 = matricule ax
+ // adr2 = type d'adresse P = personnelle
$adrax['adr1'] = $adr[3];
$adrax['adr2'] = $adr[4];
$adrax['adr3'] = $adr[5];
$adrax['cp'] = $adr[6];
$adrax['ville'] = $adr[7];
+ // adr8 = ?
+ // adr9 = ?
$adrax['pays'] = $adr[10];
+ // adr 11 = ?
$adrax['tel'] = $adr[12];
$adrax['fax'] = $adr[13];
+ // adr 14 = t ?
+ // adr15 = ?
+ // adr 16 = date de mise a jour
$userax['adr'][] = $adrax;
}
}
return $userax;
}
-function import_from_ax($userax, $epouse=false, $mobile=false, $del_address=null, $add_address=null, $del_pro=null, $add_pro=null) {
+function import_from_ax($userax, $epouse=false, $mobile=false, $del_address=null, $add_address=null, $del_pro=null, $add_pro=null)
+{
global $globals;
if ($epouse) {
$globals->xdb->execute(
"INSERT INTO entreprises
SET uid = {?}, entrid = {?},
+ entreprise = {?}, poste = {?},
adr1 = {?}, adr2 = {?}, adr3 = {?},
cp = {?}, ville = {?},
pays = {?},
tel = {?}, fax = {?},
- entreprise = {?}, fonction = {?},
visibilite = 'entreprise_ax,adr_ax,tel_ax'",
$userax['uid'], $new_entrid,
+ $pro['entreprise'], $pro['fonction'],
$pro['adr1'], $pro['adr2'], $pro['adr3'],
$pro['cp'], $pro['ville'],
$a2,
- $pro['tel'], $pro['fax'],
- $pro['entreprise'], $pro['fonction']);
+ $pro['tel'], $pro['fax']);
}}
}
</table>
</form>
+{if $x}
<form action='{$smarty.request.PHP_SELF}' method='post'>
{if $x.profile_from_ax}
<div style="text-align:center;margin:5px;background:green">
<tr>
<th>champ</th>
<th style='width:50%'>x.org</th>
+ <th>supprimer</th>
<th style='width:50%'>AX</th>
+ <th>importer</th>
+ </tr>
+ <tr class="pair">
+ <td>fiches</td>
+ <td colspan='2'>
+ <a href='{rel}/fiche.php?user={$x.user_id}' class='popup2'>polytechnique.org</a>
+ </td>
+ <td colspan='2'>
+ <a href='http://www.polytechniciens.com/index.php?page=AX_FICHE_ANCIEN&anc_id={$x.matricule_ax}'>polytechniciens.com</a>
+ </td>
</tr>
{foreach from=$ax item='val' key='i'}
{if ($i neq 'adr') and ($i neq 'adr_pro')}
+ {if $x[$i] neq $val}
<tr class="{cycle values='impair,pair'}">
<td>
{$i}
</td>
- <td>
+ <td colspan='2'>
{$x[$i]}
</td>
- <td>
- {if ($i eq 'epouse') or ($i eq 'mobile')}
+ <td colspan='2'>
+ {if (($i eq 'epouse') or ($i eq 'mobile')) and $val}
<div style='float:right'>
<input style='flat:right' type='checkbox' name='{$i}' />
</div>
{$val}
</td>
</tr>
+ {/if}
{/if}
{/foreach}
<tr class='impair'>
<td>
adresses
</td>
- <td>
+ <td colspan='2'>
{foreach from=$x.adr item='adr'}
<div style="padding:5px">
+ {if $ax.adr[0]}
<div style='float:right'>
<input type='checkbox' name='del_address{$adr.adrid}' />
</div>
+ {/if}
{include file='geoloc/address.tpl' address=$adr no_div=1}
</div>
{/foreach}
</td>
- <td>
+ <td colspan='2'>
{foreach from=$ax.adr item='adr' key='adrid'}
<div style='padding:5px'>
<div style='float:right'>
<td>
adr_pro
</td>
- <td>
+ <td colspan='2'>
{foreach from=$x.adr_pro item='pro'}
{if ($pro.poste) or ($pro.fonction) or ($pro.entreprise)}
<div style='padding:5px'>
+ {if $ax.adr_pro[0]}
<div style='float:right'>
- <input type='checkbox' name='add_pro{$pro.entrid}' />
+ <input type='checkbox' name='del_pro{$pro.entrid}' />
</div>
+ {/if}
{if $pro.entreprise}
<div>
<em>Entreprise/Organisme : </em> <strong>{$pro.entreprise}</strong>
{/if}
{/foreach}
</td>
- <td>
+ <td colspan='2'>
{foreach from=$ax.adr_pro item='pro' key='proid'}
{if ($pro.poste) or ($pro.fonction) or ($pro.entreprise)}
<div style='padding:5px'>
<input type='submit' name='importe' value='Importer' />
</div>
</form>
+{/if}
{* vim:set et sw=2 sts=2 sws=2: *}