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

This commit is contained in:
Christophe Latour 2017-10-11 13:30:05 +02:00
commit 3aabcd7210
4 changed files with 69 additions and 25 deletions

View File

@ -1214,10 +1214,16 @@ class AdminOrders extends AdminTab
FROM '._DB_PREFIX_.'mondialrelay_parcel mrp
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = mrp.`id_order_detail`)
WHERE od.`id_order` ='. $order->id;
$sql5 = 'SELECT drp.`shipping_number`, drp.`date_add`, drp.`link`
FROM '._DB_PREFIX_.'ant_dropshipping_parcel drp
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON (od.`id_order_detail` = drp.`id_order_detail`)
WHERE od.`id_order` ='. $order->id.'
GROUP BY drp.`shipping_number`';
$numbers = Db::getInstance()->ExecuteS($sql);
$numbers2 = Db::getInstance()->ExecuteS($sql2);
$numbers3 = Db::getInstance()->ExecuteS($sql3);
$numbers4 = Db::getInstance()->ExecuteS($sql4);
$numbers5 = Db::getInstance()->ExecuteS($sql5);
echo '
<fieldset style="width:400px">';
if(count($numbers) > 0){
@ -1244,6 +1250,15 @@ class AdminOrders extends AdminTab
echo '<p><b>Numéro de suivi </b> : '. $number['shipping_number'] .' ajouté le '. $date->format('d m Y') .'</p>';
}
}
if(count($numbers5) > 0){
foreach ($numbers5 as $key => $number) {
$date = new DateTime($number['date_add']);
if(!preg_match('/http/i', $number['link'])){
$number['link'] = 'http://'.$number['link'];
}
echo '<p><b>Numéro de suivi </b> : '. $number['shipping_number'] .' ajouté le '. $date->format('d m Y') .' - <a target="_blank" href="'.$number['link'].'"><b>Lien</b></a></p>';
}
}
// assign delay to Products
if (Module::isInstalled('privatesales_delay')) {
@ -1754,13 +1769,13 @@ class AdminOrders extends AdminTab
require_once(_PS_MODULE_DIR_.'ant_supplierdemand/models/SupplierDemand.php');
}
$supplierDemands = SupplierDemand::getDemands(array(),'sd.id_order='.$order->id);
$alreadyDemand = array();
echo '<br/>
<fieldset style="width: 400px;">
<legend><img src="../img/admin/return.gif" alt="'.$this->l('Supplier demands').'" />'.$this->l('Supplier demands').'</legend>';
if (!sizeof($supplierDemands)) {
echo $this->l('No Supplier demands for this order.');
} else {
$alreadyDemand = array();
$demand_product = 0;
foreach ($supplierDemands as $demand) {
$alreadyDemand[] = $demand['id_order_detail'];

View File

@ -7,8 +7,22 @@ require_once(PS_ADMIN_DIR . '/helpers/HelperFormBootstrap.php');
class AdminAntDropshippingtracking extends AdminTab
{
public function postProcess() {
protected $_html;
public function __construct($config_tab = true)
{
parent::__construct();
$this->controller = 'AdminModules';
$this->module_name = 'ant_dropshippingtracking';
$this->config_tab = (bool)$config_tab;
if ($config_tab) {
$this->controller = 'AdminAntDropshippingtracking';
}
}
public function _postProcess() {
if(Tools::isSubmit('submitOrderTracking') && Tools::getValue('id_sale')){
$errors = 0;
$id_sale = (int)Tools::getValue('id_sale');
$sale_names = array();
foreach(Db::getInstance()->ExecuteS('
@ -205,18 +219,9 @@ class AdminAntDropshippingtracking extends AdminTab
global $_LANGMAIL;
$subject = 'Package in transit';
Mail::Send(
intval($order->id_lang),
'in_transit_dropshipping',
(
(is_array($_LANGMAIL) && key_exists($subject, $_LANGMAIL))
? $_LANGMAIL[$subject]
: $subject
),
$templateVars,
$customer->email,
$customer->firstname.' '.$customer->lastname
);
if(!Mail::Send(intval($order->id_lang), 'in_transit_dropshipping', ((is_array($_LANGMAIL) && key_exists($subject, $_LANGMAIL)) ? $_LANGMAIL[$subject] : $subject), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname)){
$errors++;
}
}
if(!isset($_COOKIE['logistics_sales'])){
setcookie('logistics_sales', $id_sale, 0, __PS_BASE_URI__);
@ -227,7 +232,16 @@ class AdminAntDropshippingtracking extends AdminTab
}
setcookie('logistics_sales', implode('-', $sales), 0, __PS_BASE_URI__);
}
if($errors==0){
$this->_html .= HelperFormBootstrap::displaySuccess($this->l('Fichier importé avec succes !'));
} else {
$this->_html .= HelperFormBootstrap::displayErrors($this->l($errors.' mails n\'ont pas pu être envoyé'));
}
} else {
$this->_html .= HelperFormBootstrap::displayErrors($this->l('Aucune commande trouvé, verifier votre fichier'));
}
} else {
$this->_html .= HelperFormBootstrap::displayErrors($this->l('Fichier manquant !'));
}
}
}
@ -235,7 +249,9 @@ class AdminAntDropshippingtracking extends AdminTab
public function display() {
global $cookie, $currentIndex;
$base_link = $currentIndex . '&token='.Tools::getAdminTokenLite('AdminAntDropshippingtracking');
$form = '';
$this->_html = '';
$this->_postProcess();
$id_category_options = array();
foreach(Db::getInstance()->ExecuteS('
@ -258,9 +274,9 @@ class AdminAntDropshippingtracking extends AdminTab
$helperForm = new HelperFormBootstrap();
$helperForm->_select2 = true;
$form .= $helperForm->renderStyle();
$this->_html .= $helperForm->renderStyle();
$form .= '
$this->_html .= '
<div class="row">
<div class="col-md-12">
<div class="panel">
@ -283,15 +299,15 @@ class AdminAntDropshippingtracking extends AdminTab
'name' => 'id_sale',
'options' => $id_category_options,
);
$form .= '<div class="clearfix"></div>'.$helperForm->generateInput($input);
$this->_html .= '<div class="clearfix"></div>'.$helperForm->generateInput($input);
$input = array(
'type' => 'file',
'label' => $this->l('File:'),
'name' => 'csvfile',
'html' => $help
);
$form .= $helperForm->generateInput($input);
$form .= '
$this->_html .= $helperForm->generateInput($input);
$this->_html .= '
</div>
<div class="clearfix"></div>
<div class="ln_solid"></div>
@ -304,9 +320,9 @@ class AdminAntDropshippingtracking extends AdminTab
</div>
</div>';
$form .= $helperForm->renderScript();
$this->_html .= $helperForm->renderScript();
echo $form;
echo $this->_html;
}
}

View File

@ -819,11 +819,11 @@ class AdminLogistics extends AdminTab {
<td>\' + loaded.logs[i].product_reference + \'</td>\
<td>\' + loaded.logs[i].product_supplier_reference + \'</td>\
<td>\' + loaded.logs[i].shipping_number + \'</td>\
<td>\' + carriers[loaded.logs[i].carrier] + \'</td>\
<td>\' + ((loaded.logs[i].carrier== "laposte" || loaded.logs[i].carrier == "mondialrelay") ? carriers[loaded.logs[i].carrier] : loaded.logs[i].carrier) + \'</td>\
'.(((int) $cookie->profile == 1 || (int) $cookie->profile == 9 || (int) $cookie->profile == 7 || (int) $cookie->profile == 14)?
'<td><a href="/adm/index.php?tab=AdminLogistics&token='.Tools::getAdminTokenLite('AdminLogistics').'&id_order=\' + loaded.order.id + \'&delete_\' + loaded.logs[i].carrier + \'=\' + loaded.logs[i].id_order_detail + \'&delete_number=\' + loaded.logs[i].shipping_number + \'">x</a></td>': '').'\
'\' + ((loaded.logs[i].carrier== "laposte" || loaded.logs[i].carrier == "mondialrelay") ?\'<td><a href="/adm/index.php?tab=AdminLogistics&token='.Tools::getAdminTokenLite('AdminLogistics').'&id_order=\' + loaded.order.id + \'&delete_\' + loaded.logs[i].carrier + \'=\' + loaded.logs[i].id_order_detail + \'&delete_number=\' + loaded.logs[i].shipping_number + \'">x</a></td>': '').'\':"") +\'\
'.(((int) $cookie->profile == 1 || (int) $cookie->profile == 9 || (int) $cookie->profile == 7 || (int) $cookie->profile == 14)?
'<td><a title="Re print" class="reprint ui-icon ui-icon-arrowthickstop-1-s" data-product="\' + loaded.logs[i].product_name.replace(" - ", "<br />") + \'" data-weight="\' + loaded.logs[i].weight + \'" data-ref="\' + loaded.logs[i].product_reference + \'" data-id_order="\' + loaded.order.id + \'" data-carrier="\' + loaded.logs[i].carrier + \'" data-id_order_detail="\' + loaded.logs[i].id_order_detail + \'">+</a></td>': '').'\
'\' + ((loaded.logs[i].carrier== "laposte" || loaded.logs[i].carrier == "mondialrelay") ?\'<td><a title="Re print" class="reprint ui-icon ui-icon-arrowthickstop-1-s" data-product="\' + loaded.logs[i].product_name.replace(" - ", "<br />") + \'" data-weight="\' + loaded.logs[i].weight + \'" data-ref="\' + loaded.logs[i].product_reference + \'" data-id_order="\' + loaded.order.id + \'" data-carrier="\' + loaded.logs[i].carrier + \'" data-id_order_detail="\' + loaded.logs[i].id_order_detail + \'">+</a></td>': '').'\':"") +\'\
</tr>\';
}

View File

@ -414,6 +414,19 @@ if(($id_order = (int) Tools::getValue('id_order'))
')) {
$logs = array_merge($logs, $l);
}
/*
* @Override Dropshipping
*/
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, "Drop" as firstname, "shipping" as lastname
FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` l
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
AND l.`quantity` > 0
ORDER BY l.`date_add` DESC
')) {
$logs = array_merge($logs, $l);
}
} else {
$logs = array();
}