}
unset($tel['removed']);
}
+ $address['checked'] = $this->bool->value($page, 'checked', $address['checked'], $s);
$address['secondaire'] = $this->bool->value($page, 'secondaire', $address['secondaire'], $s);
$address['mail'] = $this->bool->value($page, 'mail', $address['mail'], $s);
$address['temporary'] = $this->bool->value($page, 'temporary', $address['temporary'], $s);
if ($address['current']) {
$flags[] = 'active';
}
+ if ($address['checked']) {
+ $flags[] = 'coord-checked';
+ }
$flags = implode(',', $flags);
XDB::execute("INSERT INTO adresses (adr1, adr2, adr3,
postcode, city, cityid,
UNIX_TIMESTAMP(a.datemaj) AS datemaj,
a.postcode, a.city, a.cityid, a.region, a.regiontxt,
a.pub, a.country, gp.pays AS countrytxt, gp.display,
+ FIND_IN_SET('coord-checked', a.statut) AS checked,
FIND_IN_SET('res-secondaire', a.statut) AS secondaire,
FIND_IN_SET('courrier', a.statut) AS mail,
FIND_IN_SET('temporaire', a.statut) AS temporary,
private $mail;
private $web;
private $tel;
+ private $bool;
private $checks;
public function __construct()
$this->mail = new ProfileEmail();
$this->web = new ProfileWeb();
$this->tel = new ProfileTel();
+ $this->bool = new ProfileBool();
$this->checks = array('web' => array('web'),
'mail' => array('email'),
'tel' => array('tel', 'fax', 'mobile'),
}
}
}
+ $job['adr']['pub'] = $this->pub->value($page, 'adr_pub', @$job['adr']['pub'], $s);
+ $job['adr']['checked'] = $this->bool->value($page, 'adr_checked', @$job['adr']['checked'], $s);
unset($job['removed']);
unset($job['new']);
unset($job['adr']['changed']);
fonction, poste, adr1, adr2, adr3, postcode,
city, cityid, country, region, regiontxt,
tel, fax, mobile, email, web,
- pub, adr_pub, tel_pub, email_pub)
+ pub, adr_pub, tel_pub, email_pub, flags)
VALUES ({?}, {?}, {?}, {?}, {?},
{?}, {?}, {?}, {?}, {?}, {?},
{?}, {?}, {?}, {?}, {?},
{?}, {?}, {?}, {?}, {?},
- {?}, {?}, {?}, {?})",
+ {?}, {?}, {?}, {?}, {?})",
S::i('uid'), $i++, $job['name'], $job['secteur'], $job['ss_secteur'],
$job['fonction'], $job['poste'], $job['adr']['adr1'], $job['adr']['adr2'], $job['adr']['adr3'],
$job['adr']['postcode'],
$job['adr']['city'], $job['adr']['cityid'], $job['adr']['country'], $job['adr']['region'],
$job['adr']['regiontxt'],
$job['tel'], $job['fax'], $job['mobile'], $job['email'], $job['web'],
- $job['pub'], $job['adr']['pub'], $job['tel_pub'], $job['email_pub']);
+ $job['pub'], $job['adr']['pub'], $job['tel_pub'], $job['email_pub'],
+ $job['adr']['checked'] ? 'geoloc' : '');
}
}
}
e.fonction, e.poste, e.adr1, e.adr2, e.adr3,
e.postcode, e.city, e.cityid, e.region, e.regiontxt,
e.country, gp.pays, gp.display,
+ FIND_IN_SET('geoloc', flags),
e.tel, e.fax, e.mobile, e.email, e.web, e.pub,
e.adr_pub, e.tel_pub, e.email_pub
FROM entreprises AS e
while (list($name, $secteur, $ss_secteur, $fonction, $poste,
$adr1, $adr2, $adr3, $postcode, $city, $cityid,
$region, $regiontxt, $country, $countrytxt, $display,
- $tel, $fax, $mobile, $email, $web,
+ $checked, $tel, $fax, $mobile, $email, $web,
$pub, $adr_pub, $tel_pub, $email_pub) = $res->next()) {
$this->values['jobs'][] = array('name' => $name,
'secteur' => $secteur,
'country' => $country,
'countrytxt' => $countrytxt,
'display' => $display,
- 'pub' => $adr_pub),
+ 'pub' => $adr_pub,
+ 'checked' => $checked),
'tel' => $tel,
'fax' => $fax,
'mobile' => $mobile,
if (compare_addresses_text(@$address['text'], $geotxt = get_address_text($new))
|| (@$address['parsevalid'] && @$address['cityid'])) {
$address = array_merge($address, $new);
+ $address['checked'] = true;
} else if (@$address['parsevalid']) {
$address = array_merge($address, cut_address(@$address['text']));
- } else {
+ $address['checked'] = true;
+ $mailer = new PlMailer('geoloc/mail_geoloc.tpl');
+ $mailer->assign('text', get_address_text($address));
+ $mailer->assign('geoloc', $geotxt);
+ $mailer->send();
+ } else if (@$address['changed'] || !@$address['checked']) {
$success = false;
$address = array_merge($address, cut_address(@$address['text']));
+ $address['checked'] = false;
$address['geoloc'] = $geotxt;
$address['geoloc_cityid'] = $new['cityid'];
+ } else {
+ $address = array_merge($address, cut_address(@$address['text']));
+ $address['checked'] = true;
}
}
$address['text'] = get_address_text($address);
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2007 Polytechnique.org *}
+{* http://opensource.polytechnique.org/ *}
+{* *}
+{* This program is free software; you can redistribute it and/or modify *}
+{* it under the terms of the GNU General Public License as published by *}
+{* the Free Software Foundation; either version 2 of the License, or *}
+{* (at your option) any later version. *}
+{* *}
+{* This program is distributed in the hope that it will be useful, *}
+{* but WITHOUT ANY WARRANTY; without even the implied warranty of *}
+{* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *}
+{* GNU General Public License for more details. *}
+{* *}
+{* You should have received a copy of the GNU General Public License *}
+{* along with this program; if not, write to the Free Software *}
+{* Foundation, Inc., *}
+{* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *}
+{* *}
+{**************************************************************************}
+
+{config_load file="mails.conf" section="geoloc_error"}
+{if $mail_part eq 'head'}
+{from full=#from#}
+{to addr=#to#}
+{subject text="Adresse impossible à geolocaliser"}
+{elseif $mail_part eq 'wiki'}
+Un camarade {$smarty.session.forlife} a forcé l'utilisation de l'adresse entrée
+à la main et a refusé la version geolocalisée :
+
+'''Version utilisateur (validée) :'''\\
+{$text|replace:"\n":"\\\\\n"}
+
+'''Version geoloc (refusée) :'''\\
+{$geoloc|replace:"\n":"\\\\\n"}
+
+-- \\
+Webmaster de Polytechnique.org
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2: *}