Merge branch 'develop' of gitlab.antadis.net:dev-antadis/bebeboutik into develop

This commit is contained in:
root 2017-06-19 12:19:09 +02:00
commit b59ee0d6ec
8 changed files with 176 additions and 186 deletions

View File

@ -377,8 +377,8 @@ class AdminCategories extends AdminTab
$this->getList((int)($cookie->id_lang), !$cookie->__get($this->table.'Orderby') ? 'position' : NULL, !$cookie->__get($this->table.'Orderway') ? 'ASC' : NULL);
echo '<h3>'.(!$this->_listTotal ? ($this->l('There are no subcategories')) : ($this->_listTotal.' '.($this->_listTotal > 1 ? $this->l('subcategories') : $this->l('subcategory')))).' '.$this->l('in category').' "'.stripslashes($this->_category->getName()).'"</h3>';
if ($this->tabAccess['add'] === '1')
echo '<a href="'.__PS_BASE_URI__.substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)).'?tab=AdminCatalog&add'.$this->table.'&id_parent='.Tools::getValue('id_category', 1).'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new subcategory').'</a>';
// if ($this->tabAccess['add'] === '1')
// echo '<a href="'.__PS_BASE_URI__.substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)).'?tab=AdminCatalog&add'.$this->table.'&id_parent='.Tools::getValue('id_category', 1).'&token='.($token!=NULL ? $token : $this->token).'"><img src="../img/admin/add.gif" border="0" /> '.$this->l('Add a new subcategory').'</a>';
echo '<div style="margin:10px;">';
/**

View File

@ -329,7 +329,7 @@ class AdminAntConfigurations extends AdminTab
WHERE c.`id_lang` = '.$cookie->id_lang.'
AND p.`date_start` > "2017-01-01 00:00:00"
ORDER BY p.`id_sale` DESC
LIMIT 800
LIMIT 1200
') as $row) {
$extrafields = Category::getSalesInfos(array((int) $row['id_category']));
$id_sale_options[] = array(

View File

@ -1835,6 +1835,8 @@ class AdminBulkUpdate extends AdminTab {
fclose($f);
$output .= '<p class="conf">'.$this->l('Export complete.').' <a onclick="window.open(this.href); return false;" href="http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/bulkupdate/'.$fname.'">'.$this->l('Click here to download the file').'</a></p>';
}
} elseif(Tools::isSubmit('submitExportProducts')) {
HelperFormBootstrap::displayWarning($this->l('En cours de developpement...'));
} elseif(Tools::isSubmit('submitExportPositions')) {
set_time_limit(300);
if($id_category = (int) Tools::getValue('category')) {
@ -1933,6 +1935,7 @@ class AdminBulkUpdate extends AdminTab {
WHERE l.`id_lang` = '.(int) $cookie->id_lang.'
AND c.`id_parent` = 1
ORDER BY id_category DESC
'.((Tools::getIsset('nolimit') && Tools::getValue('nolimit')==1)?'':'LIMIT 1200').'
') as $row) {
$extrafields = Category::getSalesInfosWithDate(array((int) $row['id_category']));
$option_sales[] = array(
@ -1946,11 +1949,11 @@ class AdminBulkUpdate extends AdminTab {
$helperForm->_inputSwitch = true;
$helperForm->_inputMask = true;
$output = $helperForm->renderStyle();
$output .= '<h2>Mise à jour groupée</h2>';
// Categories
$output .= '<div class="row">
<div class="col-md-12">
<h2>Mise à jour groupée</h2>
<div class="panel">
<ul class="nav nav-tabs nav-justified">
<li role="presentation" class="active">
@ -2302,136 +2305,169 @@ class AdminBulkUpdate extends AdminTab {
// Sale Export
$output .= '
<div class="col-md-12">
<h2>Exports</h2>
<div class="panel">
<div class="panel-title">
<h2><span class="text-rose anticon anticon-upload"></span> '.$this->l('Export').'</h2>
<div class="clearfix"></div>
</div>
<div class="panel-content">
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
<br>
<div class="col-md-5">';
$input = array(
'type' => 'select2',
'name' => 'category',
'id' => 'category',
'label' => $this->l('Select a category to export:'),
'label-class' => 'col-md-12',
'input-class' => 'col-md-12',
'select-class' => 'col-md-12',
'options' => $option_sales
);
$output .= $helperForm->generateInput($input).
'</div>';
<ul class="nav nav-tabs nav-justified">
<li role="presentation" class="active">
<a href="#exportSales" aria-controls="exportSales" role="tab" data-toggle="tab"><span class="text-rose anticon anticon-upload"></span> '.$this->l('Export Ventes').'</a>
</li>
<li role="presentation">
<a href="#exportDEB" aria-controls="exportDEB" role="tab" data-toggle="tab"><span class="text-rose anticon anticon-upload"></span> '.$this->l('Export DEB').'</a>
</li>
<li role="presentation">
<a href="#exportProducts" aria-controls="exportProducts" role="tab" data-toggle="tab"><span class="text-rose anticon anticon-upload"></span> '.$this->l('Export Produits').'</a>
</li>
</ul>
$output .='<div class="col-md-2 text-center"><span class="lateral-delimiter"></span></div>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="exportSales">
<div class="panel-content">
<h3 class="">'.$this->l('Export Ventes').'</h3>
<br>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
<br>
<div class="col-md-5">';
$input = array(
'type' => 'select2',
'name' => 'category',
'id' => 'category',
'label' => $this->l('Select a category to export:'),
'label-class' => 'col-md-12',
'input-class' => 'col-md-12',
'select-class' => 'col-md-12',
'options' => $option_sales
);
$output .= $helperForm->generateInput($input).
'</div>';
<div class="col-md-5">';
$input = array(
'type' => 'simpleDate',
'period' => true,
'class-from' => 'col-md-6',
'class-to' => 'col-md-6',
'label' => 'Du :',
'label-to' => 'Au :',
'id' => 'date_start',
'id-to' => 'date_end',
'name' => 'date_start',
'name-to' => 'date_end',
'before' => '<span class="glyphicon glyphicon-calendar"></span>',
'before-to' => '<span class="glyphicon glyphicon-calendar"></span>',
);
$output .= $helperForm->generateInput($input).
'<p class="text-center help-block">Format : AAAA-MM-JJ</p>
$output .='<div class="col-md-2 text-center"><span class="lateral-delimiter"></span></div>
<div class="col-md-5">';
$input = array(
'type' => 'simpleDate',
'period' => true,
'class-from' => 'col-md-6',
'class-to' => 'col-md-6',
'label' => 'Du :',
'label-to' => 'Au :',
'id' => 'date_start',
'id-to' => 'date_end',
'name' => 'date_start',
'name-to' => 'date_end',
'before' => '<span class="glyphicon glyphicon-calendar"></span>',
'before-to' => '<span class="glyphicon glyphicon-calendar"></span>',
);
$output .= $helperForm->generateInput($input).
'<p class="text-center help-block">Format : AAAA-MM-JJ</p>
</div>
<div class="clearfix"></div>
<br>
<div class="col-md-4 col-md-offset-4 text-center">';
$input = array(
'type' => 'select',
'name' => 'id_lang',
'id' => 'id_lang',
'label' => $this->l('Select a language:'),
'label-class' => 'col-md-12 text-center',
'input-class' => 'col-md-12',
'options' => $option_select_langs
);
$output .= $helperForm->generateInput($input).
'</div>';
$output .= '
<div class="clearfix"></div>
<div class="ln_solid"></div>
<div class="form-group text-right">
<a class="btn btn-default" href="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'&nolimit=1">'.$this->l('Charger toutes les catégories').'</a>
<button type="submit" class="btn btn-primary" name="submitExport">'.$this->l('Exporter').'</button>
</div>
</form>
</div>
<div class="clearfix"></div>
<br>
<div class="col-md-4 col-md-offset-4 text-center">';
$input = array(
'type' => 'select',
'name' => 'id_lang',
'id' => 'id_lang',
'label' => $this->l('Select a language:'),
'label-class' => 'col-md-12 text-center',
'input-class' => 'col-md-12',
'options' => $option_select_langs
);
$output .= $helperForm->generateInput($input).
'</div>';
$output .= '</div>
<div class="clearfix"></div>
<div class="ln_solid"></div>
<div class="form-group text-right">
<button type="submit" class="btn btn-primary" name="submitExport">'.$this->l('Upload').'</button>
</div>
</form>
</div>
</div>';
</div>';
// Export Sale DEB
$output .= '
<div class="col-md-12">
<div class="panel">
<div class="panel-title">
<h2><span class="text-rose anticon anticon-upload"></span> '.$this->l('Export DEB').'</h2>
<div class="clearfix"></div>
</div>
<div class="panel-content">
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
<div class="col-md-5 col-md-offset-4">';
<div role="tabpanel" class="tab-pane" id="exportDEB">
<div class="panel-content">
<h3 class="">'.$this->l('Export DEB').'</h3>
<br>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
<div class="col-md-5 col-md-offset-4">';
$input = array(
'type' => 'select',
'name' => 'deb',
'id' => 'deb',
'label' => $this->l('Select a DEB:'),
'label-class' => 'col-md-12',
'input-class' => 'col-md-12',
'options' => array(
array(
'value' => 1,
'label' => 'DEB introduction'
),
array(
'value' => 2,
'label' => 'DEB expedition'
$input = array(
'type' => 'select',
'name' => 'deb',
'id' => 'deb',
'label' => $this->l('Select a DEB:'),
'label-class' => 'col-md-12',
'input-class' => 'col-md-12',
'options' => array(
array(
'value' => 1,
'label' => 'DEB introduction'
),
array(
'value' => 2,
'label' => 'DEB expedition'
)
)
)
);
$output .= $helperForm->generateInput($input).
'<div class="clearfix"></div><br>
<div class="col-md-12">
<p class="text-left help-block">Introduction : Selon date des ventes</p>
<p class="text-left help-block">Expedition : Selon date des commandes</p>
);
$output .= $helperForm->generateInput($input).
'<div class="clearfix"></div><br>
<div class="col-md-12">
<p class="text-left help-block">Introduction : Selon date des ventes</p>
<p class="text-left help-block">Expedition : Selon date des commandes</p>
</div>
<div class="clearfix"></div><br>';
$input = array(
'type' => 'simpleDate',
'period' => true,
'class-from' => 'col-md-6',
'class-to' => 'col-md-6',
'label' => 'Du :',
'label-to' => 'Au :',
'id' => 'date_start_deb',
'id-to' => 'date_end_deb',
'name' => 'date_start',
'name-to' => 'date_end',
'before' => '<span class="glyphicon glyphicon-calendar"></span>',
'before-to' => '<span class="glyphicon glyphicon-calendar"></span>',
);
$output .= $helperForm->generateInput($input).
'<p class="text-center help-block">Format : AAAA-MM-JJ</p>';
$output .= '</div>
<div class="clearfix"></div>
<div class="ln_solid"></div>
<div class="form-group text-right">
<button type="submit" class="btn btn-primary" name="submitExportDeb">'.$this->l('Exporter').'</button>
</div>
<div class="clearfix"></div><br>';
</form>
</div>
</div>';
$input = array(
'type' => 'simpleDate',
'period' => true,
'class-from' => 'col-md-6',
'class-to' => 'col-md-6',
'label' => 'Du :',
'label-to' => 'Au :',
'id' => 'date_start_deb',
'id-to' => 'date_end_deb',
'name' => 'date_start',
'name-to' => 'date_end',
'before' => '<span class="glyphicon glyphicon-calendar"></span>',
'before-to' => '<span class="glyphicon glyphicon-calendar"></span>',
);
$output .= $helperForm->generateInput($input).
'<p class="text-center help-block">Format : AAAA-MM-JJ</p>';
$output .= '</div>
<div class="clearfix"></div>
<div class="ln_solid"></div>
<div class="form-group text-right">
<button type="submit" class="btn btn-primary" name="submitExportDeb">'.$this->l('Upload').'</button>
</div>
</form>
// Export Products
$output .= '
<div role="tabpanel" class="tab-pane" id="exportProducts">
<div class="panel-content">
<h3 class="">'.$this->l('Export Base Produit').'</h3>
<br>
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
<div class="col-md-5 col-md-offset-4">
<p class="text-center">'.$this->l('En cours de developpement...').'</p>
<p class="text-center">'.$this->l('Export de la base produit totale générée toutes les semaines.').'</p>
</div>
<div class="clearfix"></div>
<div class="ln_solid"></div>
<div class="form-group text-right">
<button type="submit" class="btn btn-primary" name="submitExportProducts">'.$this->l('Exporter').'</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>';

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');