efc418da91ec2b91c8c5841818d94bd384645348
2 /***************************************************************************
3 * Copyright (C) 2003-2004 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
23 require_once("xorg.inc.php");
24 new_admin_page('admin/synchro_ax.tpl');
26 require_once('user.func.inc.php');
27 require_once('synchro_ax.inc.php');
29 if (Env
::has('user')) {
30 $login = get_user_forlife(Env
::get('user'));
31 if ($login === false
) {
36 if (Env
::has('mat')) {
37 $res = $globals->xdb
->query(
40 INNER JOIN auth_user_md5 AS u ON (a.id=u.user_id AND a.type='a_vie')
41 WHERE matricule={?}", Env
::getInt('mat'));
42 $login = $res->fetchOneCell();
46 $new = Env
::get('modif') == 'new';
47 $user = get_user_details($login, Session
::getInt('uid'));
48 $userax= get_user_ax($user['user_id']);
50 if (Env
::has('importe')) {
53 foreach ($user['adr'] as $adr) {
54 if (Env
::has('del_address'.$adr['adrid'])) {
55 $adr_dels[] = $adr['adrid'];
60 foreach ($userax['adr'] as $i => $adr) {
61 if (Env
::has('add_address'.$i)) {
67 foreach ($user['adr_pro'] as $pro) {
68 if (Env
::has('del_pro'.$pro['entrid'])) {
69 $pro_dels[] = $pro['entrid'];
74 foreach ($userax['adr_pro'] as $i => $pro) {
75 if (Env
::has('add_pro'.$i)) {
80 import_from_ax($userax, Env
::has('nom_usage'), Env
::has('mobile'), $adr_dels, $adr_adds, $pro_dels, $pro_adds, Env
::has('nationalite'));
84 $user = get_user_details($login, Session
::getInt('uid'));
87 $user['matricule_ax'] = $userax['matricule_ax'];
88 unset($userax['matricule_ax']);
89 $user['nom'] = ucwords(strtolower($user['nom']));
90 $user['nom_usage'] = ucwords(strtolower($user['nom_usage']));
93 $page->assign('watch_champs',array('nom', 'nom_usage', 'prenom', 'nationalite', 'mobile'));
94 $page->assign('modifiables', array(0,1,0,1,1));
96 $page->assign('x', $user);
97 $page->assign('ax', $userax);
101 // vim:set et sts=4 sws=4 sw=4: