prevent multi tracking after registration

This commit is contained in:
Marion Muszynski 2017-07-26 13:21:18 +02:00
parent 3525fdc711
commit 58b3c509b4

View File

@ -234,18 +234,18 @@ class TrackingTag extends Module {
<label>'.$this->l('Tag page auth:').'</label> <label>'.$this->l('Tag page auth:').'</label>
<div class="margin-form"> <div class="margin-form">
<div id="tag_auth" style="float: left;"> <div id="tag_auth" style="float: left;">
<textarea name="tag_auth" style="width: 450px; height: 250px;">'.($this->curtag!==NULL? $this->curtag['tag_auth']: '').'</textarea> <textarea name="tag_auth" style="width: 450px; height: 250px;">'.($this->curtag!==NULL? $this->curtag['tag_auth']: '').'</textarea>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<label>'.$this->l('Version :').'</label> <label>'.$this->l('Version :').'</label>
<div class="margin-form"> <div class="margin-form">
<div id="version" style="float: left;"> <div id="version" style="float: left;">
<select name="version" id="version"> <select name="version" id="version">
<option value="fr" '.($this->curtag!==NULL? ($this->curtag['version'] == 'fr' ? 'selected' : '') : '').'>FR</option> <option value="fr" '.($this->curtag!==NULL? ($this->curtag['version'] == 'fr' ? 'selected' : '') : '').'>FR</option>
<option value="es" '.($this->curtag!==NULL? ($this->curtag['version'] == 'es' ? 'selected' : '') : '').'>ES</option> <option value="es" '.($this->curtag!==NULL? ($this->curtag['version'] == 'es' ? 'selected' : '') : '').'>ES</option>
</select> </select>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
@ -302,6 +302,16 @@ class TrackingTag extends Module {
public function hookAccountValidation($params) { public function hookAccountValidation($params) {
global $cookie, $site_version_front; global $cookie, $site_version_front;
if($cookie->isLogged()) {
$customer = new Customer((int)$cookie->id_customer);
$accountCreationDateTime = new DateTime($customer->date_add);
$nowDateTime = new DateTime();
$maxTrackingDateInterval = new DateInterval('PT8S'); //8 seconds
if ($nowDateTime > $accountCreationDateTime->add($maxTrackingDateInterval)) {
return '';
}
}
$tags = Db::getInstance()->ExecuteS(' $tags = Db::getInstance()->ExecuteS('
SELECT * SELECT *
FROM `'._DB_PREFIX_.'trackingtag` FROM `'._DB_PREFIX_.'trackingtag`
@ -317,6 +327,9 @@ class TrackingTag extends Module {
$output = ''; $output = '';
foreach($tags as $tag) { foreach($tags as $tag) {
if((int)$tag['id_trackingtag'] == 2 && $cookie->id_lang == 3){
continue;
}
$output .= str_replace(array( $output .= str_replace(array(
'{id_customer}', '{id_customer}',
'{email}', '{email}',