From 646a45825d19a33e2fcafe7ad5ddd773eea0df46 Mon Sep 17 00:00:00 2001 From: Guillaume Bandet Date: Tue, 3 Jun 2008 15:34:25 +0200 Subject: [PATCH] Adds a comment for addresses --- include/user.func.inc.php | 2 +- modules/profile/addresses.inc.php | 9 +++++---- plugins/function.display_address.php | 18 ++++++++++++++++-- templates/profile/adresses.address.tpl | 4 ++++ upgrade/fusionax-0.0.1/01_addrcomment.sql | 2 ++ 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 upgrade/fusionax-0.0.1/01_addrcomment.sql diff --git a/include/user.func.inc.php b/include/user.func.inc.php index b903654..c866ef9 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -347,7 +347,7 @@ function get_user_details_adr($uid, $view = 'private') { gp.pays AS countrytxt,a.region, a.regiontxt, FIND_IN_SET('active', a.statut) AS active, a.adrid, FIND_IN_SET('res-secondaire', a.statut) AS secondaire, - a.pub, gp.display + a.pub, gp.display, a.comment FROM adresses AS a LEFT JOIN geoloc_pays AS gp ON (gp.a2=a.country) WHERE uid= {?} AND NOT FIND_IN_SET('pro',a.statut) diff --git a/modules/profile/addresses.inc.php b/modules/profile/addresses.inc.php index 2fe7a8d..1e518aa 100644 --- a/modules/profile/addresses.inc.php +++ b/modules/profile/addresses.inc.php @@ -138,17 +138,17 @@ class ProfileAddress extends ProfileGeoloc postcode, city, cityid, country, region, regiontxt, pub, datemaj, statut, - uid, adrid, glat, glng) + uid, adrid, glat, glng, comment) VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, FROM_UNIXTIME({?}), {?}, - {?}, {?}, {?}, {?})", + {?}, {?}, {?}, {?}, {?})", $address['adr1'], $address['adr2'], $address['adr3'], $address['postcode'], $address['city'], $address['cityid'], $address['country'], $address['region'], $address['regiontxt'], $address['pub'], $address['datemaj'], $flags, - S::i('uid'), $adrid, $address['precise_lat'], $address['precise_lon']); + S::i('uid'), $adrid, $address['precise_lat'], $address['precise_lon'], $address['comment']); foreach ($address['tel'] as $telid=>&$tel) { $this->saveTel($adrid, $telid, $tel); } @@ -191,7 +191,8 @@ class ProfileAddresses extends ProfilePage FIND_IN_SET('courrier', a.statut) AS mail, FIND_IN_SET('temporaire', a.statut) AS temporary, FIND_IN_SET('active', a.statut) AS current, - a.glat AS precise_lat, a.glng AS precise_lon + a.glat AS precise_lat, a.glng AS precise_lon, + a.comment FROM adresses AS a INNER JOIN geoloc_pays AS gp ON(gp.a2 = a.country) WHERE uid = {?} AND NOT FIND_IN_SET('pro', statut) diff --git a/plugins/function.display_address.php b/plugins/function.display_address.php index 07ce7c3..98dfdef 100644 --- a/plugins/function.display_address.php +++ b/plugins/function.display_address.php @@ -61,15 +61,29 @@ function smarty_function_display_address($param, &$smarty) $map = "\"Google"; + $comment = ""; + if ($param['adr']['comment'] != "") + { + $commentHtml = str_replace(array('&', '"'), array('&', '"'), $param['adr']['comment']); + $commentJs = str_replace(array('\\', '\''), array('\\\\', '\\\''), $commentHtml); + $comment = "\"Commentaire\""; + } if ($restore) { array_unshift($lines, $idt); } if ($param['titre']) { if ($param['titre_div']) - $txthtml .= "
".pl_entity_decode($param['titre'])." ".$map."
\n"; + $txthtml .= "
".pl_entity_decode($param['titre'])." ".$map.$comment."
\n"; else - $txthtml .= "".pl_entity_decode($param['titre'])." ".$map."
\n"; + $txthtml .= "".pl_entity_decode($param['titre'])." ".$map.$comment."
\n"; } foreach ($lines as $line) { diff --git a/templates/profile/adresses.address.tpl b/templates/profile/adresses.address.tpl index c0b7287..46d9dec 100644 --- a/templates/profile/adresses.address.tpl +++ b/templates/profile/adresses.address.tpl @@ -73,6 +73,10 @@ {if $adr.mail}checked="checked"{/if} /> +
+ + +
diff --git a/upgrade/fusionax-0.0.1/01_addrcomment.sql b/upgrade/fusionax-0.0.1/01_addrcomment.sql new file mode 100644 index 0000000..7de4690 --- /dev/null +++ b/upgrade/fusionax-0.0.1/01_addrcomment.sql @@ -0,0 +1,2 @@ +ALTER TABLE `adresses` ADD `comment` varchar(100) NOT NULL; + -- 2.1.4