Merge branch 'ticket-13324-pixelFB' into develop

This commit is contained in:
Marion Muszynski 2017-06-19 11:06:04 +02:00
commit 77f3034f5f
5 changed files with 18 additions and 64 deletions

View File

@ -88,7 +88,6 @@ class AdminStatsLogistic extends AdminTab {
$result[(int)$sale['id_sale']]['nb_pole_4'] = 0;
$result[(int)$sale['id_sale']]['nb_pole_5'] = 0;
$result[(int)$sale['id_sale']]['nb_pole_6'] = 0;
$result[(int)$sale['id_sale']]['nb_pole_philea'] = 0;
foreach($products as $row) {
if (!in_array((int)$row['id_order'],$id_orders)) {
@ -167,9 +166,6 @@ class AdminStatsLogistic extends AdminTab {
foreach ($shipping_numbers as $id_employee => $value) {
$nb_package += count($value);
switch ($id_employee) {
case '999':
$result[(int)$sale['id_sale']]['nb_pole_philea'] += count($value);
break;
case '52':
$result[(int)$sale['id_sale']]['nb_pole_1'] += count($value);
break;
@ -202,7 +198,6 @@ class AdminStatsLogistic extends AdminTab {
$result[(int)$sale['id_sale']]['nb_pole_4'] = number_format(($result[(int)$sale['id_sale']]['nb_pole_4'] / $nb_package)*100,2);
$result[(int)$sale['id_sale']]['nb_pole_5'] = number_format(($result[(int)$sale['id_sale']]['nb_pole_5'] / $nb_package)*100,2);
$result[(int)$sale['id_sale']]['nb_pole_6'] = number_format(($result[(int)$sale['id_sale']]['nb_pole_6'] / $nb_package)*100,2);
$result[(int)$sale['id_sale']]['nb_pole_philea'] = number_format(($result[(int)$sale['id_sale']]['nb_pole_philea'] / $nb_package)*100,2);
}
}
if ($result) {
@ -329,7 +324,7 @@ class AdminStatsLogistic extends AdminTab {
$stats = $this->getStats();
$poles = array();
for ($i=0; $i < 7; $i++) {
for ($i=0; $i < 6; $i++) {
$poles[] = array(
'recap' => array(
'quantity' => 0,
@ -344,18 +339,12 @@ class AdminStatsLogistic extends AdminTab {
$poles[3]['name'] = 'Pôle 4 : Postes complementaires';
$poles[4]['name'] = 'Pôle 5 : Multi';
$poles[5]['name'] = 'Pôle 6 : Autre';
$poles[6]['name'] = 'Pôle Philea';
$total_quantity = 0;
foreach ($stats as $key => $stat) {
if (!isset($stat['id_employee'])) {
continue;
}
switch ((int)$stat['id_employee']) {
case '999':
$poles[6]['recap']['quantity'] += $stat['quantity'];
$poles[6]['recap']['nb_package'] += $stat['nb_package'];
$poles[6]['employee'][] = $stat;
break;
case '52':
$poles[0]['recap']['quantity'] += $stat['quantity'];
$poles[0]['recap']['nb_package'] += $stat['nb_package'];
@ -420,7 +409,7 @@ class AdminStatsLogistic extends AdminTab {
</tr>';
foreach ($pole['employee'] as $key => $stat) {
echo '<tr>
<td>'.($stat['id_employee']==999?"Expe Philéa":$stat['id_employee']).'</td>
<td>'.$stat['id_employee'].'</td>
<td>'.(isset($stat['firstname'])?$stat['firstname']:"").'</td>
<td>'.(isset($stat['lastname'])?$stat['lastname']:"").'</td>
<td>'.(isset($stat['email'])?$stat['email']:"").'</td>
@ -540,7 +529,6 @@ class AdminStatsLogistic extends AdminTab {
.'<input type="hidden" name="tab" value="'.__CLASS__.'" />'
.'<input type="submit" class="button" name="submitExportExpLP" value="Expé La Poste" />'
.'<input type="submit" class="button" name="submitExportExpMR" value="Expé Mondial Relay" />'
.'<input type="submit" class="button" name="submitExportExpPH" value="Expé Philéa" />'
.'</form>
</fieldset>'
;
@ -548,7 +536,7 @@ class AdminStatsLogistic extends AdminTab {
}
public function getStats() {
$query1 = Db::getInstance()->executeS('
return Db::getInstance()->executeS('
SELECT
e.`id_employee`,
e.`email`,
@ -563,18 +551,6 @@ class AdminStatsLogistic extends AdminTab {
AND e.`id_employee` IS NOT NULL
GROUP BY s.`id_employee`
');
$query2 = Db::getInstance()->executeS('
SELECT
`id_employee`,
SUM(s.`nb_product`) AS `nb_product`,
SUM(s.`quantity`) AS `quantity`,
SUM(s.`nb_package`) AS `nb_package`
FROM `'._DB_PREFIX_.'stats_logistic` s
WHERE s.`date` BETWEEN "'.pSQL($this->date_begin).'" AND "'.pSQL($this->date_end).'"
AND s.`id_employee` = 999
GROUP BY s.`id_employee`
');
return array_merge($query1,$query2);
}
public function getTotalColis() {
@ -628,18 +604,7 @@ class AdminStatsLogistic extends AdminTab {
AND mrp.id_order_detail IS NOT NULL
ORDER BY rr.`id_reason`
');
$sale_details_ph = Db::getInstance()->ExecuteS('
SELECT od.*, rr.`id_reason`, "999" AS `id_employee`, ph.`shipping_number`,
ROUND(((od.`product_price` * (1 - od.`reduction_percent` / 100) - od.`reduction_amount`) * (1 - od.`group_reduction` / 100) * (1 + od.`tax_rate` / 100)), 6) AS `price`
FROM `'._DB_PREFIX_.'order_detail` od
LEFT JOIN `'._DB_PREFIX_.'order_slip` os ON (os.`id_order` = od.`id_order`)
LEFT JOIN `'._DB_PREFIX_.'philea_parcel` ph ON (ph.`id_order_detail` = od.`id_order_detail`)
LEFT JOIN `'._DB_PREFIX_.'refundreason` rr ON (rr.`id_order_slip` = os.`id_order_slip`)
WHERE od.`product_id` IN ('.implode(',', $product_ids).')
AND ph.id_order_detail IS NOT NULL
ORDER BY rr.`id_reason`
');
$sale_details = array_merge($sale_details_lpw, $sale_details_mr,$sale_details_ph);
$sale_details = array_merge($sale_details_lpw, $sale_details_mr);
return $sale_details;
}
@ -839,8 +804,7 @@ class AdminStatsLogistic extends AdminTab {
"% colis Pole 3",
"% colis Pole 4",
"% colis Pole 5",
"% colis Pole 6",
"% colis Pole Philea"
"% colis Pole 6"
)
);
fputcsv ($fp,$row_1,$delim);

View File

@ -30,26 +30,6 @@ $query = '
';
Db::getInstance()->execute($query);
// philea
$query = '
INSERT INTO `'._DB_PREFIX_.'stats_logistic`
SELECT
NULL AS `id`,
"999" AS `id_employee`,
`date_add` AS `date`,
COUNT(`id_order_detail`) AS `nb_product`,
SUM(`quantity`) AS `quantity`,
COUNT(DISTINCT `shipping_number`) AS `nb_package`
FROM `'._DB_PREFIX_.'philea_parcel`
WHERE DATE(`date_add`) = "'.pSQL($date).'"
GROUP BY `id_employee` , DATE(`date_add`)
ON DUPLICATE KEY UPDATE
`nb_product` = VALUES(`nb_product`),
`quantity` = VALUES(`quantity`),
`nb_package` = VALUES(`nb_package`)
';
Db::getInstance()->execute($query);
// Mondial relay
$query = '
INSERT INTO `'._DB_PREFIX_.'stats_logistic`

View File

@ -228,6 +228,17 @@ class FrontController extends FrontControllerCore {
$display_tax_label = $country->display_tax_label;
}
// @Override Antadis - prevent double fb tracking on registration if customer already exists
if ($cookie->isLogged()) {
$customer = new Customer((int)$cookie->id_customer);
$accountCreationDateTime = new DateTime($customer->date_add);
$nowDateTime = new DateTime();
$maxTrackingDateInterval = new DateInterval('PT5S'); //5 seconds
if ($nowDateTime < $accountCreationDateTime->add($maxTrackingDateInterval)) {
$smarty->assign(array('facebook_validation' => true));
}
}
$smarty->assign(array(
'link' => $link,
'cart' => $cart,

View File

@ -399,8 +399,7 @@
});
</script>
{/literal}
{if isset($smarty.get.validation)}
{if isset($facebook_validation) && $facebook_validation}
{literal}
<script>
fbq('track', 'CompleteRegistration');

View File

@ -380,7 +380,7 @@
</script>
{/literal}
{if isset($smarty.get.validation)}
{if isset($facebook_validation) && $facebook_validation}
{literal}
<script>
fbq('track', 'CompleteRegistration');