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

This commit is contained in:
root 2017-05-15 14:43:13 +02:00
commit 4800e60ce9

View File

@ -577,7 +577,15 @@ class AdminAntReturnprocess extends AdminTab
FROM `'._DB_PREFIX_.'customer_thread`
WHERE id_customer ='.(int)$order->id_customer.' AND id_order = '.(int)$order->id.'
');
if($query_thread) {
if(!$query_thread) {
$query_thread = Db::getInstance()->getValue('
SELECT `id_customer_thread`
FROM `'._DB_PREFIX_.'customer_thread`
WHERE id_customer ='.(int)$order->id_customer.'
ORDER BY `date_upd` ASC
');
}
if($query_thread){
$thread = new CustomerThread((int)$query_thread);
$last_message = Db::getInstance()->getRow('
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
@ -945,36 +953,38 @@ class AdminAntReturnprocess extends AdminTab
<div class="row">
<div class="col-md-12">';
if(isset($thread)){
$products = Db::getInstance()->ExecuteS('
SELECT spc.*, pl.`name`
FROM `'._DB_PREFIX_.'support_product_customerthread` spc
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = spc.`id_product`)
WHERE spc.`id_customer_thread` = '.(int)$thread->id.'
AND pl.`id_lang` = 2'
);
if($products && !empty($products)) {
$html .='<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">Produit(s) Concerné(s)</h5>';
foreach ($products as $product) {
$img_path = '';
$img = Db::getInstance()->getRow('
SELECT id_image
FROM `'._DB_PREFIX_.'image` i
WHERE i.`id_product` = '.(int)$product['id_product'].'
AND i.`cover` = 1'
);
if (isset($img['id_image']) && !empty($img['id_image'])) {
$image_obj = new Image((int)$img['id_image']);
$img_path = (isset($image_obj)?$image_obj->getExistingImgPath():'');
if($thread->id_order == $orderReturn->id_order) {
$products = Db::getInstance()->ExecuteS('
SELECT spc.*, pl.`name`
FROM `'._DB_PREFIX_.'support_product_customerthread` spc
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = spc.`id_product`)
WHERE spc.`id_customer_thread` = '.(int)$thread->id.'
AND pl.`id_lang` = 2'
);
if($products && !empty($products)) {
$html .='<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">Produit(s) Concerné(s)</h5>';
foreach ($products as $product) {
$img_path = '';
$img = Db::getInstance()->getRow('
SELECT id_image
FROM `'._DB_PREFIX_.'image` i
WHERE i.`id_product` = '.(int)$product['id_product'].'
AND i.`cover` = 1'
);
if (isset($img['id_image']) && !empty($img['id_image'])) {
$image_obj = new Image((int)$img['id_image']);
$img_path = (isset($image_obj)?$image_obj->getExistingImgPath():'');
}
$html .='
<a style="background:#EFEFEF;padding:5px;display: block;color:#444;" target="_blank" href="index.php?tab=AdminCatalog&id_product='.(int)($product['id_product']).'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" title="'.$this->l('View product').'">
<img style="display:inline-block;" width="62" src="'.(isset($img_path)?_THEME_PROD_DIR_.$img_path.'-small.jpg':'').'"/><span style="font-weight:bold;display:inline-block;margin-left:5px;width:210px;vertical-align:middle;">'.mb_strimwidth($product['name'], 0, 55, "...").'</span>
<div class="clearfix"></div>
</a>';
}
$html .='
<a style="background:#EFEFEF;padding:5px;display: block;color:#444;" target="_blank" href="index.php?tab=AdminCatalog&id_product='.(int)($product['id_product']).'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" title="'.$this->l('View product').'">
<img style="display:inline-block;" width="62" src="'.(isset($img_path)?_THEME_PROD_DIR_.$img_path.'-small.jpg':'').'"/><span style="font-weight:bold;display:inline-block;margin-left:5px;width:210px;vertical-align:middle;">'.mb_strimwidth($product['name'], 0, 55, "...").'</span>
<div class="clearfix"></div>
</a>';
}
}
if($last_message){
$html .='<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">Dernier Message</h5>';
$html .='<h5 style="background:#504D8B;color:#fff;padding:5px; text-align:center;">Dernier Message '.($thread->id_order != $orderReturn->id_order?'<br/><i>(Ne concerne pas cette commande)</i>':'').'</h5>';
$last_message['message'] = preg_replace('/(https?:\/\/[a-z0-9#%&_=\(\)\.\? \+\-@\/]{6,1000})([\s\n<])/Uui', '<a href="\1">\1</a>\2', html_entity_decode($last_message['message'], ENT_NOQUOTES, 'UTF-8'));
if(!empty($last_message['employee_name'])) {