From e18058739181026c96edbbaa02a311f6b58339e9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Fri, 26 Aug 2011 10:21:01 +0200 Subject: [PATCH] Allows edition of empty reference birthdates (Closes #1532). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- ChangeLog | 3 +++ modules/profile/general.inc.php | 9 ++++++++- templates/profile/general.tpl | 12 ++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4236ace..17d402a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,9 @@ Bug/Wish: - #1517: Fixes bestalias update when two local_part are identical -JAC - #1533: Fixes bestalias after updating melix alias -JAC + * Profile: + - #1532: Allows edition of empty reference birthdates -JAC + From 1.1.2 branch: * Newsletter: diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index 12731d2..b235080 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -571,6 +571,7 @@ class ProfilePageGeneral extends ProfilePage if (!S::user()->isMe($this->owner)) { $this->settings['deathdate'] = new ProfileSettingDate(true); $this->settings['birthdate'] = new ProfileSettingDate(true); + $this->settings['birthdate_ref'] = new ProfileSettingDate(true); } else { $this->settings['yourself'] = null; $this->settings['birthdate'] = new ProfileSettingDate(); @@ -592,7 +593,7 @@ class ProfilePageGeneral extends ProfilePage $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 + p.deathdate, IF(p.birthdate_ref = 0, '', p.birthdate_ref) AS birthdate_ref FROM profiles AS p INNER JOIN profile_display AS pd ON (pd.pid = p.pid) WHERE p.pid = {?}", $this->pid()); @@ -697,6 +698,12 @@ class ProfilePageGeneral extends ProfilePage } } } + if ($this->orig['birthdate_ref'] == 0 && !S::user()->isMe($this->owner) && $this->changed['birthdate_ref']) { + XDB::execute('UPDATE profiles + SET birthdate_ref = {?} + WHERE pid = {?}', + ProfileSettingDate::toSQLDate($this->values['birthdate_ref']), $this->pid()); + } if (!S::user()->isMe($this->owner) && $this->changed['deathdate']) { XDB::execute('UPDATE profiles SET deathdate = {?}, deathdate_rec = NOW() diff --git a/templates/profile/general.tpl b/templates/profile/general.tpl index f0ddda7..edcc321 100644 --- a/templates/profile/general.tpl +++ b/templates/profile/general.tpl @@ -147,6 +147,18 @@ + + + Date de naissance de référence + + + {if $birthdate_ref eq 0} + + {else} + {$birthdate_ref} + {/if} + + {/if} -- 2.1.4