pl_cached_content_headers('text/x-csv', 'iso-8859-1', 1, 'adresses.csv');
$csv = fopen('php://output', 'w');
- fputcsv($csv, array('PROMOTION', 'TITRE', 'NOM', 'SOCIETE', 'ADRESSE', 'EMAIL'), ';');
+ fputcsv($csv, array('PROMOTION', 'CIVILITE', 'NOM', 'SOCIETE', 'ADRESSE', 'EMAIL'), ';');
if (!empty($pids)) {
- $res = XDB::query("SELECT pd.promo, IF(p.sex = 'female', 'Mme', 'M'), pd.short_name, pje.name,
+ $res = XDB::query("SELECT pd.promo, p.title, pd.short_name, pje.name,
pa.postalText, p.email_directory
FROM profile_addresses AS pa
INNER JOIN profiles AS p ON (pa.pid = p.pid)
$page->changeTpl('admin/add_accounts.tpl');
if (Env::has('add_type') && Env::has('people')) {
+ static $titles = array('male' => 'M', 'female' => 'MLLE');
$lines = explode("\n", Env::t('people'));
$separator = Env::t('separator');
$promotion = Env::i('promotion');
continue;
}
- XDB::execute('INSERT INTO profiles (hrpid, xorg_id, ax_id, birthdate_ref, sex)
- VALUES ({?}, {?}, {?}, {?}, {?})',
- $infos['hrid'], $xorgId, (isset($infos[5]) ? $infos[5] : null), $birthDate, $sex);
+ XDB::execute('INSERT INTO profiles (hrpid, xorg_id, ax_id, birthdate_ref, sex, title)
+ VALUES ({?}, {?}, {?}, {?}, {?}, {?})',
+ $infos['hrid'], $xorgId, (isset($infos[5]) ? $infos[5] : null),
+ $birthDate, $sex, $titles[$sex]);
$pid = XDB::insertId();
XDB::execute('INSERT INTO profile_public_names (pid, lastname_initial, lastname_main, firstname_initial, firstname_main)
VALUES ({?}, {?}, {?}, {?}, {?})',
Nom_usuel VARCHAR(255) NOT NULL COMMENT 'Nom usuel (nom marital par exemple) sans la particule',
partic_nom VARCHAR(5) NOT NULL COMMENT 'Particule du nom usuel',
Nom_complet VARCHAR(255) NOT NULL COMMENT 'Nom patronymique complet (avec la particule)',
+ Civilité ENUM('M', 'MLLE', 'MME') NOT NULL DEFAULT 'M',
Code_nationalite CHAR(4) NOT NULL COMMENT 'Nationalité (code)',
corps_sortie VARCHAR(50) NOT NULL COMMENT 'Corps de sortie (ou D si aucun)',
Date_deces DATE COMMENT 'Date de décès',
LOAD DATA LOCAL INFILE '{?}Anciens.txt' INTO TABLE `fusionax_anciens` CHARACTER SET utf8 FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
(AN, ax_id, @login, @password, promotion_etude, groupe_promo, Nom_patronymique, partic_patro, prenom, Nom_usuel, partic_nom,
- Nom_complet, @civilite, Code_nationalite, @type, corps_sortie, @StringDate_deces, grade, Mel_usage, Mel_publiable, @xxx, Mob_publiable,
+ Nom_complet, Civilite, Code_nationalite, @type, corps_sortie, @StringDate_deces, grade, Mel_usage, Mel_publiable, @xxx, Mob_publiable,
tel_mobile, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @X_M_D, @xxx, @xxx, @xxx, @xxx, @xxx, @xxx, @Type_adr,
@Ligne1, @Ligne2, @Ligne3, @code_postal, @ville, @zip_cedex, @etat_distr, @pays, @tel, @fax, @StringDate_maj)
SET
$this->settings['nationality1'] = $this->settings['nationality2']
= $this->settings['nationality3']
= $this->settings['promo_display']
+ = $this->settings['profile_title']
= null;
$this->settings['email_directory'] = new ProfileSettingEmail();
$this->settings['email_directory_new'] = new ProfileSettingEmailDirectory();
$res = XDB::query("SELECT p.nationality1, p.nationality2, p.nationality3, IF(p.birthdate = 0, '', p.birthdate) AS birthdate,
p.email_directory as email_directory, pd.promo AS promo_display,
p.freetext, p.freetext_pub, p.ax_id AS matricule_ax, pd.yourself,
- p.deathdate, IF(p.birthdate_ref = 0, '', p.birthdate_ref) AS birthdate_ref
+ p.deathdate, IF(p.birthdate_ref = 0, '', p.birthdate_ref) AS birthdate_ref,
+ p.title AS profile_title
FROM profiles AS p
INNER JOIN profile_display AS pd ON (pd.pid = p.pid)
WHERE p.pid = {?}", $this->pid());
{
if ($this->changed['nationality1'] || $this->changed['nationality2'] || $this->changed['nationality3']
|| $this->changed['birthdate'] || $this->changed['freetext'] || $this->changed['freetext_pub']
- || $this->changed['email_directory']) {
+ || $this->changed['email_directory'] || $this->changed['profile_title']) {
if ($this->values['nationality3'] == "") {
$this->values['nationality3'] = NULL;
}
XDB::execute("UPDATE profiles
SET nationality1 = {?}, nationality2 = {?}, nationality3 = {?}, birthdate = {?},
- freetext = {?}, freetext_pub = {?}, email_directory = {?}
+ freetext = {?}, freetext_pub = {?}, email_directory = {?}, title = {?}
WHERE pid = {?}",
$this->values['nationality1'], $this->values['nationality2'], $this->values['nationality3'],
ProfileSettingDate::toSQLDate($this->values['birthdate']),
- $this->values['freetext'], $this->values['freetext_pub'], $new_email, $this->pid());
+ $this->values['freetext'], $this->values['freetext_pub'], $new_email,
+ $this->values['profile_title'], $this->pid());
}
if ($this->changed['photo_pub']) {
XDB::execute("UPDATE profile_photos
<a href="javascript:delNationality('3');">{icon name=cross title="Supprimer cette nationalité"}</a>
</td>
</tr>
+ <tr>
+ <td><span class="titre">Civilité</span></td>
+ <td>
+ <select name="profile_title">
+ <option value="M" {if $profile_title eq "M"}selected="selected"{/if}>M</option>
+ <option value="MLLE" {if $profile_title eq "MLLE"}selected="selected"{/if}>MLLE</option>
+ <option value="MME" {if $profile_title eq "MME"}selected="selected"{/if}>MME</option>
+ </select>
+ </td>
+ </tr>
</table>
<table class="bicol" style="margin-bottom: 1em" summary="Profil : Formations à l'X">
XDB::rawExecute("DELETE FROM profile_corps_rank_enum
WHERE name LIKE 'DEL%'");
+// Updates title.
+XDB::rawExecute("UPDATE profiles AS p
+ INNER JOIN fusionax_anciens AS f ON (p.pid = f.pid)
+ SET p.title = f.Civilite");
+
// Updates email_directory.
XDB::rawExecute("UPDATE profiles AS p
INNER JOIN fusionax_anciens AS f ON (p.pid = f.pid)
--- /dev/null
+ALTER TABLE profiles ADD COLUMN title ENUM('M', 'MLLE', 'MME') NOT NULL DEFAULT 'M';
+
+-- vim:set syntax=mysql: