|| $this->matchWord($ini, $new, $newLen)
|| ($field == 'nom' && $new == 'DE ' . $old);
if (!$success) {
- global $page;
- $page->trigError("Le $field que tu as choisi ($value) est trop loin de ton $field initial ($init)"
- . (($init == $current)? "" : " et de ton prénom précédent ($current)"));
+ Platal::page()->trigError("Le $field que tu as choisi ($value) est trop loin de ton $field initial ($init)"
+ . (($init == $current)? "" : " et de ton prénom précédent ($current)"));
}
return $success ? $value : $current;
}
}
$success = true;
foreach($value as $i=>&$network) {
- if(!isset($network['pub'])) {
- $network['pub'] = 'private';
- }
- $network['error'] = false;
- $network['pub'] = $this->pub->value($page, 'pub', $network['pub'], $s);
- $s = true;
- if ($filters[$network['type']] == 'web') {
- $network['address'] = $this->web->value($page, 'address', $network['address'], $s);
- } elseif ($filters[$network['type']] == 'email') {
- $network['address'] = $this->email->value($page, 'address', $network['address'], $s);
- } elseif ($filters[$network['type']] == 'number') {
- $network['address'] = $this->number->value($page, 'address', $network['address'], $s);
- }
- if (!$s) {
- $success = false;
- $network['error'] = true;
+ if (!trim($network['address'])) {
+ unset($value[$i]);
+ } else {
+ if (!isset($network['pub'])) {
+ $network['pub'] = 'private';
+ }
+ $network['error'] = false;
+ $network['pub'] = $this->pub->value($page, 'pub', $network['pub'], $s);
+ $s = true;
+ if ($filters[$network['type']] == 'web') {
+ $network['address'] = $this->web->value($page, 'address', $network['address'], $s);
+ } elseif ($filters[$network['type']] == 'email') {
+ $network['address'] = $this->email->value($page, 'address', $network['address'], $s);
+ } elseif ($filters[$network['type']] == 'number') {
+ $network['address'] = $this->number->value($page, 'address', $network['address'], $s);
+ }
+ if (!$s) {
+ $success = false;
+ $network['error'] = true;
+ }
}
}
return $value;
$this->settings['nom'] = $this->settings['prenom']
= new ProfileNom();
$this->settings['naissance'] = new ProfileDate();
- $this->settings['mobile_pub']
- = $this->settings['freetext_pub']
+ $this->settings['freetext_pub']
= $this->settings['photo_pub']
= new ProfilePub();
$this->settings['freetext']
= null;
$this->settings['synchro_ax']
= new ProfileBool();
- $this->settings['mobile'] = new ProfileTel();
$this->settings['email_directory']
= new ProfileEmail();
$this->settings['email_directory_new']
= new ProfileEmailDirectory();
$this->settings['networking'] = new ProfileNetworking();
+ $this->settings['tels'] = new ProfilePhones('user', 0);
$this->settings['appli1']
= $this->settings['appli2']
= new ProfileAppli();
- $this->watched= array('nom' => true, 'freetext' => true, 'mobile' => true,
+ $this->watched= array('nom' => true, 'freetext' => true, 'tels' => true,
'networking' => true, 'appli1' => true, 'appli2' => true,
'nationalite' => true, 'nick' => true);
}
{
// Checkout all data...
$res = XDB::query("SELECT u.promo, u.promo_sortie, u.nom_usage, u.nationalite, u.naissance,
- q.profile_mobile as mobile, q.profile_mobile_pub as mobile_pub,
+ t.display_tel as mobile, t.pub as mobile_pub,
d.email_directory as email_directory,
q.profile_freetext as freetext, q.profile_freetext_pub as freetext_pub,
q.profile_nick as nick, q.profile_from_ax as synchro_ax, u.matricule_ax,
FROM auth_user_md5 AS u
INNER JOIN auth_user_quick AS q ON(u.user_id = q.user_id)
INNER JOIN profile_names_display AS n ON(n.user_id = u.user_id)
+ LEFT JOIN profile_phones AS t ON(u.user_id = t.uid AND link_type = 'user')
LEFT JOIN profile_directory AS d ON(d.uid = u.user_id)
LEFT JOIN applis_ins AS a1 ON(a1.uid = u.user_id and a1.ordre = 0)
LEFT JOIN applis_ins AS a2 ON(a2.uid = u.user_id and a2.ordre = 1)
WHERE sn.user_id = {?}
ORDER BY sn.name_type, search_score, search_name",
S::v('uid'));
+
+ // Retreive phones
+ $res = XDB::iterator("SELECT t.display_tel AS tel, t.tel_type AS type, t.pub, t.comment
+ FROM profile_phones AS t
+ WHERE t.uid = {?} AND t.link_type = 'user'
+ ORDER BY t.tel_id",
+ S::v('uid'));
+ $this->values['tels'] = $res->fetchAllAssoc();
}
protected function _saveData()
preg_replace('@(\d{2})/(\d{2})/(\d{4})@', '\3-\2-\1', $this->values['naissance']),
S::v('uid'));
}
- if ($this->changed['nick'] || $this->changed['mobile'] || $this->changed['mobile_pub']
- || $this->changed['freetext']
- || $this->changed['freetext_pub'] || $this->changed['synchro_ax']) {
+ if ($this->changed['nick'] || $this->changed['freetext'] || $this->changed['freetext_pub'] || $this->changed['synchro_ax']) {
XDB::execute("UPDATE auth_user_quick
- SET profile_nick= {?}, profile_mobile={?}, profile_mobile_pub={?},
+ SET profile_nick= {?},
profile_freetext={?},
profile_freetext_pub={?}, profile_from_ax = {?}
WHERE user_id = {?}",
- $this->values['nick'], $this->values['mobile'], $this->values['mobile_pub'],
+ $this->values['nick'],
$this->values['freetext'], $this->values['freetext_pub'],
$this->values['synchro_ax'], S::v('uid'));
}
}
}
- public function _prepare(PlatalPage &$page, $id)
+ public function _prepare(PlPage &$page, $id)
{
require_once "applis.func.inc.php";