- '.($order->appli?'
'.$this->l('Commande faite via l\'appli').'
':'
'.$this->l('Commande faite via le site').'
').'
+ '.$deviceHtml.'
'.Tools::substr($order->payment, 0, 32).' '.($order->module ? '('.$order->module.')' : '').'
'.$this->l('Cart #').sprintf('%06d', $cart->id).'
'.$this->l('Recycled package').'
diff --git a/modules/ant_returnprocess/AdminAntReturnprocess.php b/modules/ant_returnprocess/AdminAntReturnprocess.php
index f564cdcb..f0e3d37a 100644
--- a/modules/ant_returnprocess/AdminAntReturnprocess.php
+++ b/modules/ant_returnprocess/AdminAntReturnprocess.php
@@ -396,7 +396,12 @@ class AdminAntReturnprocess extends AdminTab
HelperFormBootstrap::displayErrors('Le remboursement n\'a pu avoir lieu');
return;
}
- } elseif(Tools::isSubmit('submitCancelProduct') && Tools::getValue('id_order_return') && ($id_order = (int)(Tools::getValue('id_order'))) AND Validate::isLoadedObject($order = new Order($id_order))) {
+ }
+ elseif (Tools::isSubmit('submitCancelProduct')
+ && Tools::getValue('id_order_return')
+ && ($id_order = (int)(Tools::getValue('id_order')))
+ && Validate::isLoadedObject($order = new Order($id_order))) {
+
$_POST['generateCreditSlip'] = 1;
$customer = new Customer($order->id_customer);
@@ -688,7 +693,8 @@ class AdminAntReturnprocess extends AdminTab
}
HelperFormBootstrap::displaySuccess('Remboursement Effectué');
}
- } elseif(Tools::isSubmit('submitResendParcel') && Tools::getValue('id_order_return') && ($id_order = (int)(Tools::getValue('id_order'))) AND Validate::isLoadedObject($order = new Order($id_order))) {
+ }
+ elseif(Tools::isSubmit('submitResendParcel') && Tools::getValue('id_order_return') && ($id_order = (int)(Tools::getValue('id_order'))) AND Validate::isLoadedObject($order = new Order($id_order))) {
$products = Tools::getValue('resendQuantity');
$parcel_carrier = Tools::getValue('parcel_carrier');
diff --git a/modules/braderie/AdminBraderie.php b/modules/braderie/AdminBraderie.php
index bfc4d00e..ca94399e 100644
--- a/modules/braderie/AdminBraderie.php
+++ b/modules/braderie/AdminBraderie.php
@@ -180,8 +180,9 @@ class AdminBraderie extends AdminTab
}
var emplacement = $("#input_storage").val();
-
- if (emplacement.length == 0 || emplacement>505) {
+
+ /* {rack}{etagere} ou {rack}{etagere}{carton} */
+ if (emplacement.length == 0 || emplacement>995) {
$("#error").empty().append("'.$this->l('L\'emplacement n\'est pas renseigné ou est mal renseigné').'");
$("#error").show();
return false;
diff --git a/modules/labelgenerate/AdminLabelGenerate.php b/modules/labelgenerate/AdminLabelGenerate.php
index 36b95c4a..84fde94d 100644
--- a/modules/labelgenerate/AdminLabelGenerate.php
+++ b/modules/labelgenerate/AdminLabelGenerate.php
@@ -1,14 +1,14 @@
printRackPDF($rackCodes);
- if (glob(_PS_MODULE_DIR_.'labelgenerate/img/rack/rack.pdf')) {
+ if (file_exists(_PS_MODULE_DIR_.'labelgenerate/img/rack/rack.pdf')) {
$this->displaySucess('Rack générés :
Télécharger le PDF rack');
}
- } elseif ($current_sale && Tools::getValue('generateRef')) {
+ }
+ elseif ($current_sale && Tools::getValue('generateRef')) {
$sale = new Sale((int)$current_sale);
$big_label = Tools::getValue('big_label');
@@ -86,7 +87,7 @@ class AdminLabelGenerate extends AdminTab {
}
}
}
- if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/reference.pdf')) {
+ if (file_exists(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/reference.pdf')) {
$this->displayWarning('Les références ont déjà été générées
Dernières ref générées :
Télécharger le PDF');
} else {
if($barcode->printPDF($big_label, 'reference')) {
@@ -96,7 +97,8 @@ class AdminLabelGenerate extends AdminTab {
}
}
}
- } elseif ($current_sale && Tools::getValue('deleteEAN')) {
+ }
+ elseif ($current_sale && Tools::getValue('deleteEAN')) {
$sale = new Sale((int)$current_sale);
if(!Validate::isLoadedObject($sale)) {
@@ -113,42 +115,40 @@ class AdminLabelGenerate extends AdminTab {
foreach ($combinations as $key => $combination) {
if (!empty($combination['ean13'])) {
Db::getInstance()->execute('
- UPDATE
- `'._DB_PREFIX_.'product_attribute`
- SET `ean13` = ""
+ UPDATE `'._DB_PREFIX_.'product_attribute`
+ SET `ean13` = ""
WHERE `id_product` = ' . (int)$product->id .'
- AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
+ AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
);
Db::getInstance()->Execute('
- UPDATE
- `'._DB_PREFIX_.'order_detail`
- SET `product_ean13` = ""
+ UPDATE `'._DB_PREFIX_.'order_detail`
+ SET `product_ean13` = ""
WHERE `product_id` = '. (int)$product->id .'
- AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
+ AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
);
}
}
} else {
if (!empty($product->ean13)) {
Db::getInstance()->execute('
- UPDATE
- `'._DB_PREFIX_.'product`
- SET `ean13` = ""
+ UPDATE `'._DB_PREFIX_.'product`
+ SET `ean13` = ""
WHERE `id_product` = ' . (int)$product->id
);
Db::getInstance()->Execute('
- UPDATE
- `'._DB_PREFIX_.'order_detail`
- SET `product_ean13` = ""
+ UPDATE `'._DB_PREFIX_.'order_detail`
+ SET `product_ean13` = ""
WHERE `product_id` = '. (int)$product->id .'
- AND `product_attribute_id` = 0
+ AND `product_attribute_id` = 0
');
}
}
}
$this->_html .= $this->displaySuccess('Suppression terminée');
}
- } elseif ($current_sale && Tools::getValue('generateALLEAN')) {
+ }
+ // Generate ALL EAN (sell quantities)
+ elseif ($current_sale && Tools::getValue('generateALLEAN')) {
$sale = new Sale((int)$current_sale);
$big_label = Tools::getValue('big_label');
@@ -162,7 +162,7 @@ class AdminLabelGenerate extends AdminTab {
$barcode = new GenerateBarcode();
$barcode->id_sale = $sale->id;
$barcode->createFolder($barcode->id_sale);
- $count = 0;
+
foreach ($products as $key => $id_product) {
$product = new Product($id_product, FALSE, (int) $cookie->id_lang);
$attributes = array();
@@ -182,23 +182,20 @@ class AdminLabelGenerate extends AdminTab {
foreach ($result_quantities as $od) {
$quantity += ((int)$od['product_quantity'] - (int)$od['product_quantity_reinjected']);
}
- if($quantity>0){
- $count++;
+ if ($quantity > 0){
if (empty($combination['ean13'])) {
$ean_generate = $barcode->generateBarcode($combination['id_product'], $combination['id_product_attribute'],$product->reference);
Db::getInstance()->execute('
- UPDATE
- `'._DB_PREFIX_.'product_attribute`
- SET `ean13` = '. $ean_generate . '
+ UPDATE `'._DB_PREFIX_.'product_attribute`
+ SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id .'
- AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
+ AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
);
Db::getInstance()->Execute('
- UPDATE
- `'._DB_PREFIX_.'order_detail`
- SET `product_ean13` = "'. pSQL($ean_generate) .'"
+ UPDATE `'._DB_PREFIX_.'order_detail`
+ SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
- AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
+ AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
);
} else {
$ean_generate = $barcode->generateBarcode($combination['id_product'], $combination['id_product_attribute'],$product->reference, $combination['ean13']);
@@ -217,22 +214,19 @@ class AdminLabelGenerate extends AdminTab {
foreach ($result_quantities as $od) {
$quantity += ((int)$od['product_quantity'] - (int)$od['product_quantity_reinjected']);
}
- if($quantity>0){
- $count++;
+ if ($quantity > 0) {
if (empty($product->ean13)) {
$ean_generate = $barcode->generateBarcode($product->id, NULL, $product->reference);
Db::getInstance()->execute('
- UPDATE
- `'._DB_PREFIX_.'product`
- SET `ean13` = '. $ean_generate . '
+ UPDATE `'._DB_PREFIX_.'product`
+ SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id
);
Db::getInstance()->Execute('
- UPDATE
- `'._DB_PREFIX_.'order_detail`
- SET `product_ean13` = "'. pSQL($ean_generate) .'"
+ UPDATE `'._DB_PREFIX_.'order_detail`
+ SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
- AND `product_attribute_id` = 0
+ AND `product_attribute_id` = 0
');
} else {
$ean_generate = $barcode->generateBarcode($product->id, NULL, $product->reference, $product->ean13);
@@ -243,7 +237,7 @@ class AdminLabelGenerate extends AdminTab {
}
if (!empty($ean_generate)) {
- if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all.pdf')) {
+ if (file_exists(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all.pdf')) {
unlink(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all.pdf');
}
if($barcode->printPDF($big_label,'barcode_all')) {
@@ -253,17 +247,19 @@ class AdminLabelGenerate extends AdminTab {
}
} else {
$message = 'Aucun ean trouvé ou généré !';
- if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all.pdf')) {
+ if (file_exists(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all.pdf')) {
$message .= '
Dernières étiquettes générées :
Télécharger le PDF';
}
$this->_html .= $this->displayWarning($message);
}
}
- } elseif ($current_sale && Tools::getValue('generateALLEAN_initial')) {
+ }
+ // Generate ALL EAN (initial quantities)
+ elseif ($current_sale && Tools::getValue('generateALLEAN_initial')) {
$sale = new Sale((int)$current_sale);
$big_label = Tools::getValue('big_label');
- if(!Validate::isLoadedObject($sale)) {
+ if (!Validate::isLoadedObject($sale)) {
throw new Exception('This sale doesnt exist');
} else {
$products = $sale->getProducts();
@@ -296,18 +292,16 @@ class AdminLabelGenerate extends AdminTab {
if (empty($combination['ean13'])) {
$ean_generate = $barcode->generateBarcode($combination['id_product'], $combination['id_product_attribute'],$product->reference);
Db::getInstance()->execute('
- UPDATE
- `'._DB_PREFIX_.'product_attribute`
- SET `ean13` = '. $ean_generate . '
+ UPDATE `'._DB_PREFIX_.'product_attribute`
+ SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id .'
- AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
+ AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
);
Db::getInstance()->Execute('
- UPDATE
- `'._DB_PREFIX_.'order_detail`
- SET `product_ean13` = "'. pSQL($ean_generate) .'"
+ UPDATE `'._DB_PREFIX_.'order_detail`
+ SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
- AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
+ AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
);
} else {
$ean_generate = $barcode->generateBarcode($combination['id_product'], $combination['id_product_attribute'],$product->reference, $combination['ean13']);
@@ -328,17 +322,15 @@ class AdminLabelGenerate extends AdminTab {
if (empty($product->ean13)) {
$ean_generate = $barcode->generateBarcode($product->id, NULL, $product->reference);
Db::getInstance()->execute('
- UPDATE
- `'._DB_PREFIX_.'product`
- SET `ean13` = '. $ean_generate . '
+ UPDATE `'._DB_PREFIX_.'product`
+ SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id
);
Db::getInstance()->Execute('
- UPDATE
- `'._DB_PREFIX_.'order_detail`
- SET `product_ean13` = "'. pSQL($ean_generate) .'"
+ UPDATE `'._DB_PREFIX_.'order_detail`
+ SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
- AND `product_attribute_id` = 0
+ AND `product_attribute_id` = 0
');
} else {
$ean_generate = $barcode->generateBarcode($product->id, NULL, $product->reference, $product->ean13);
@@ -348,7 +340,7 @@ class AdminLabelGenerate extends AdminTab {
}
if (!empty($ean_generate)) {
- if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all_initial.pdf')) {
+ if (file_exists(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all_initial.pdf')) {
unlink(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all_initial.pdf');
}
if($barcode->printPDF($big_label,'barcode_all_initial')) {
@@ -358,19 +350,22 @@ class AdminLabelGenerate extends AdminTab {
}
} else {
$message = 'Aucun ean trouvé ou généré !';
- if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all_initial.pdf')) {
+ if (file_exists(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode_all_initial.pdf')) {
$message .= '
Dernières étiquettes générées :
Télécharger le PDF';
}
$this->_html .= $this->displayWarning($message);
}
}
- } elseif ($current_sale && Tools::getValue('generateEAN')) {
+ }
+ // Generate EAN on missing products
+ elseif ($current_sale && Tools::getValue('generateEAN')) {
$sale = new Sale((int)$current_sale);
$big_label = Tools::getValue('big_label');
if(!Validate::isLoadedObject($sale)) {
throw new Exception('This sale doesnt exist');
- } else {
+ }
+ else {
$products = $sale->getProducts();
$ean_generate = '';
$products_generate = array();
@@ -384,6 +379,7 @@ class AdminLabelGenerate extends AdminTab {
$attributes = array();
$combinations = $product->getAttributeCombinaisons($cookie->id_lang);
+ // Product with attributes
if ($combinations) {
foreach ($combinations as $key => $combination) {
if (empty($combination['ean13'])) {
@@ -399,27 +395,27 @@ class AdminLabelGenerate extends AdminTab {
foreach ($result_quantities as $od) {
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
}
- if ($quantity>0) {
+ if ($quantity > 0) {
$ean_generate = $barcode->generateBarcode($combination['id_product'], $combination['id_product_attribute'],$product->reference);
$barcode->assocProduct($combination['id_product'], $combination['id_product_attribute'], $quantity, $product->reference);
Db::getInstance()->execute('
- UPDATE
- `'._DB_PREFIX_.'product_attribute`
- SET `ean13` = '. $ean_generate . '
+ UPDATE `'._DB_PREFIX_.'product_attribute`
+ SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id .'
- AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
+ AND `id_product_attribute` = ' . (int)$combination['id_product_attribute']
);
Db::getInstance()->Execute('
- UPDATE
- `'._DB_PREFIX_.'order_detail`
- SET `product_ean13` = "'. pSQL($ean_generate) .'"
+ UPDATE `'._DB_PREFIX_.'order_detail`
+ SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
- AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
+ AND `product_attribute_id` = '. (int)$combination['id_product_attribute']
);
}
}
}
- } else {
+ }
+ // Product without attributes
+ else {
if (empty($product->ean13)) {
$result_quantities = Db::getInstance()->executeS('
SELECT od.`product_quantity`,od.`product_quantity_reinjected`
@@ -427,25 +423,25 @@ class AdminLabelGenerate extends AdminTab {
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`)
WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0 AND o.`valid` != 0'
);
+
$quantity = 0;
foreach ($result_quantities as $od) {
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
}
- if ($quantity>0) {
+
+ if ($quantity > 0) {
$ean_generate = $barcode->generateBarcode($product->id, NULL, $product->reference);
$barcode->assocProduct($product->id, NULL, $quantity, $product->reference);
Db::getInstance()->execute('
- UPDATE
- `'._DB_PREFIX_.'product`
- SET `ean13` = '. $ean_generate . '
+ UPDATE `'._DB_PREFIX_.'product`
+ SET `ean13` = '. $ean_generate . '
WHERE `id_product` = ' . (int)$product->id
);
Db::getInstance()->Execute('
- UPDATE
- `'._DB_PREFIX_.'order_detail`
- SET `product_ean13` = "'. pSQL($ean_generate) .'"
+ UPDATE `'._DB_PREFIX_.'order_detail`
+ SET `product_ean13` = "'. pSQL($ean_generate) .'"
WHERE `product_id` = '. (int)$product->id .'
- AND `product_attribute_id` = 0
+ AND `product_attribute_id` = 0
');
}
}
@@ -453,7 +449,7 @@ class AdminLabelGenerate extends AdminTab {
}
if (!empty($ean_generate)) {
- if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode.pdf')) {
+ if (file_exists(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode.pdf')) {
unlink(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode.pdf');
}
if($barcode->printPDF($big_label)) {
@@ -463,7 +459,7 @@ class AdminLabelGenerate extends AdminTab {
}
} else {
$message = 'Tous les produits de la vente ont déjà des EANS';
- if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode.pdf')) {
+ if (file_exists(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/barcode.pdf')) {
$message .= '
Dernières étiquettes générées :
Télécharger le PDF';
}
$this->_html .= $this->displayWarning($message);
@@ -477,8 +473,6 @@ class AdminLabelGenerate extends AdminTab {
$id_sale_options = array();
foreach(Sale::getSalesBack(NULL, NULL, NULL, NULL, FALSE, FALSE, '`date_start` DESC', 500) as $sale) {
-
-
$id_sale_options[(int)$sale->id] = array(
'label' => $sale->id.' - '.$sale->title[(int) $cookie->id_lang],
'value' => (int) $sale->id
diff --git a/modules/logistics/AdminLogistics.php b/modules/logistics/AdminLogistics.php
index cce2cb96..98a8bce8 100644
--- a/modules/logistics/AdminLogistics.php
+++ b/modules/logistics/AdminLogistics.php
@@ -161,11 +161,9 @@ class AdminLogistics extends AdminTab {
public function postProcess() {
global $cookie, $logistics_carriers;
- if((
- (int) $cookie->profile == 1 || (int) $cookie->profile == 9 || (int) $cookie->profile == 7 || (int) $cookie->profile == 14
- ) && (
- $delete_number = Tools::getValue('delete_number')
- )) {
+ if(( in_array((int)$cookie->profile, array(1,9,7,13,14)) )
+ && ( $delete_number = Tools::getValue('delete_number') )) {
+
if($delete = (int) Tools::getValue('delete_laposte')) {
Db::getInstance()->ExecuteS('
DELETE FROM `'._DB_PREFIX_.'lapostews`
@@ -266,7 +264,7 @@ class AdminLogistics extends AdminTab {
// Generate a new shipping number for product sent with many parcels
if( (Tools::isSubmit('submitReprintShip'))
- && ((int) $cookie->profile == 1 || (int) $cookie->profile == 9 || (int) $cookie->profile == 7 || (int) $cookie->profile == 14)
+ && in_array((int)$cookie->profile, array(1,9,7,13,14))
&& (
($id_order = Tools::getValue('id_order_reprint'))
&& ($products = Tools::getValue('products_reprint'))
@@ -804,10 +802,8 @@ class AdminLogistics extends AdminTab {
'.$this->l('Supplier reference').' | \
'.$this->l('Shipping number').' | \
'.$this->l('Carrier').' | \
- '.(((int) $cookie->profile == 1 || (int) $cookie->profile == 9 || (int) $cookie->profile == 7 || (int) $cookie->profile == 14)?
- '
| ': '').'\
- '.(((int) $cookie->profile == 1 || (int) $cookie->profile == 9 || (int) $cookie->profile == 7 || (int) $cookie->profile == 14)?
- '
| ': '').'\
+ '.(( in_array((int)$cookie->profile, array(1,9,7,13,14)) ) ? '
| ': '').'\
+ '.(( in_array((int)$cookie->profile, array(1,9,7,13,14)) ) ? '
| ': '').'\
\
\
\';
@@ -822,10 +818,10 @@ class AdminLogistics extends AdminTab {
\' + loaded.logs[i].product_supplier_reference + \' | \
\' + loaded.logs[i].shipping_number + \' | \
\' + ((loaded.logs[i].carrier == "laposte" || loaded.logs[i].carrier == "mondialrelay") ? carriers[loaded.logs[i].carrier] : loaded.logs[i].carrier) + \' | \
- '.(((int) $cookie->profile == 1 || (int) $cookie->profile == 9 || (int) $cookie->profile == 7 || (int) $cookie->profile == 14)?
- '\' + ((loaded.logs[i].carrier == "laposte" || loaded.logs[i].carrier == "mondialrelay") ?\'x | ': '').'\':"") +\'\
- '.(((int) $cookie->profile == 1 || (int) $cookie->profile == 9 || (int) $cookie->profile == 7 || (int) $cookie->profile == 14)?
- '\' + ((loaded.logs[i].carrier == "laposte" || loaded.logs[i].carrier == "mondialrelay") ?\'") + \'" 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 + \'">+ | ': '').'\':"") +\'\
+ '.(( in_array((int)$cookie->profile, array(1,9,7,13,14)) ) ?
+ '\' + ((loaded.logs[i].carrier == "laposte" || loaded.logs[i].carrier == "mondialrelay") ?\'x | ': '').'\':"") +\'\
+ '.(( in_array((int)$cookie->profile, array(1,9,7,13,14)) ) ?
+ '\' + ((loaded.logs[i].carrier == "laposte" || loaded.logs[i].carrier == "mondialrelay") ?\'") + \'" 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 + \'">+ | ': '').'\':"") +\'\
\';
}
@@ -850,7 +846,7 @@ class AdminLogistics extends AdminTab {
';
- if((int) $cookie->profile == 1 || (int) $cookie->profile == 2 || (int) $cookie->profile == 7 || (int) $cookie->profile == 14) {
+ if(in_array((int)$cookie->profile, array(1,9,7,13,14))) {
$this->_html .= '
content += \'
\';
';
diff --git a/modules/privatesales/Sale.php b/modules/privatesales/Sale.php
index 3fd22d83..e4c63c6c 100755
--- a/modules/privatesales/Sale.php
+++ b/modules/privatesales/Sale.php
@@ -73,14 +73,14 @@ class Sale {
}
public function isFinished($check_enabled=FALSE) {
- if(($check_enabled === TRUE && $this->enabled || $check_enabled === FALSE) && strtotime($this->date_end) < mktime()) {
+ if(($check_enabled === TRUE && $this->enabled || $check_enabled === FALSE) && strtotime($this->date_end) < time()) {
return TRUE;
}
return FALSE;
}
public function isStarted($check_enabled=FALSE) {
- if(($check_enabled === TRUE && $this->enabled || $check_enabled === FALSE) && strtotime($this->date_start) < mktime()) {
+ if(($check_enabled === TRUE && $this->enabled || $check_enabled === FALSE) && strtotime($this->date_start) < time()) {
return TRUE;
}
return FALSE;
diff --git a/override/classes/Cart.php b/override/classes/Cart.php
index c9a2888f..5ea0c4b9 100755
--- a/override/classes/Cart.php
+++ b/override/classes/Cart.php
@@ -142,7 +142,8 @@ class Cart extends CartCore {
return $this->_products;
}
- function getOrderShippingCost($id_carrier=NULL, $useTax=TRUE, $add_carrier_cost = true) {
+ function getOrderShippingCost($id_carrier=NULL, $useTax=TRUE, $add_carrier_cost = true)
+ {
global $defaultCountry;
if ($this->isVirtualCart())
@@ -183,7 +184,7 @@ class Cart extends CartCore {
}
// Get id zone
- if(isset($this->id_address_delivery)
+ if (isset($this->id_address_delivery)
&& $this->id_address_delivery
&& Customer::customerHasAddress($this->id_customer, $this->id_address_delivery)) {
$id_zone = Address::getZoneById((int)($this->id_address_delivery));
@@ -196,19 +197,19 @@ class Cart extends CartCore {
}
// If no carrier, select default one
- if(!$id_carrier) {
+ if (!$id_carrier) {
$id_carrier = $this->id_carrier;
}
- if($id_carrier && !$this->isCarrierInRange($id_carrier, $id_zone)) {
+ if ($id_carrier && !$this->isCarrierInRange($id_carrier, $id_zone)) {
$id_carrier = '';
}
- if(empty($id_carrier) && $this->isCarrierInRange(Configuration::get('PS_CARRIER_DEFAULT'), $id_zone)) {
+ if (empty($id_carrier) && $this->isCarrierInRange(Configuration::get('PS_CARRIER_DEFAULT'), $id_zone)) {
$id_carrier = (int)(Configuration::get('PS_CARRIER_DEFAULT'));
}
- if(empty($id_carrier)) {
+ if (empty($id_carrier)) {
if((int)($this->id_customer)) {
$customer = new Customer((int)($this->id_customer));
$result = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), TRUE, FALSE, (int)($id_zone), $customer->getGroups());
@@ -262,28 +263,28 @@ class Cart extends CartCore {
}
}
- if(empty($id_carrier)) {
+ if (empty($id_carrier)) {
$id_carrier = Configuration::get('PS_CARRIER_DEFAULT');
}
- if(!isset(self::$_carriers[$id_carrier])) {
+ if (!isset(self::$_carriers[$id_carrier])) {
self::$_carriers[$id_carrier] = new Carrier((int)($id_carrier), Configuration::get('PS_LANG_DEFAULT'));
}
$carrier = self::$_carriers[$id_carrier];
if(!Validate::isLoadedObject($carrier)) {
die(Tools::displayError('Fatal error: "no default carrier"'));
}
- if(!$carrier->active) {
+ if (!$carrier->active) {
return $shipping_cost;
}
// Free fees if free carrier
- if($carrier->is_free == 1) {
+ if ($carrier->is_free == 1) {
return 0;
}
// Select carrier tax
- if($useTax && !Tax::excludeTaxeOption()) {
+ if ($useTax && !Tax::excludeTaxeOption()) {
$carrierTax = Tax::getCarrierTaxRate((int)$carrier->id, (int)$this->{Configuration::get('PS_TAX_ADDRESS_TYPE')});
}
@@ -293,23 +294,23 @@ class Cart extends CartCore {
if ($dgv->checkFreeShippingPriceCart($this)) return 0;
// Free fees
$free_fees_price = 0;
- if(isset($configuration['PS_SHIPPING_FREE_PRICE'])) {
+ if (isset($configuration['PS_SHIPPING_FREE_PRICE'])) {
$free_fees_price = Tools::convertPrice((float)($configuration['PS_SHIPPING_FREE_PRICE']), Currency::getCurrencyInstance((int)($this->id_currency)));
}
$orderTotalwithDiscounts = $this->getOrderTotal(TRUE, Cart::BOTH_WITHOUT_SHIPPING);
- if($orderTotalwithDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0) {
+ if ($orderTotalwithDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0) {
return $shipping_cost;
}
- if(isset($configuration['PS_SHIPPING_FREE_WEIGHT']) && $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) && (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0) {
+ if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) && $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) && (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0) {
return $shipping_cost;
}
// Get shipping cost using correct method
- if($carrier->range_behavior) {
+ if ($carrier->range_behavior) {
// Get id zone
if(
isset($this->id_address_delivery)
@@ -337,6 +338,7 @@ class Cart extends CartCore {
$shipping_cost += $carrier->getDeliveryPriceByPrice($order_total, $id_zone, (int)($this->id_currency));
}
}
+
// Adding handling charges
if(isset($configuration['PS_SHIPPING_HANDLING']) && $carrier->shipping_handling) {
$shipping_cost += (float)($configuration['PS_SHIPPING_HANDLING']);
@@ -350,11 +352,11 @@ class Cart extends CartCore {
$shipping_cost = Tools::convertPrice($shipping_cost, Currency::getCurrencyInstance((int)($this->id_currency)));
//get external shipping cost from module
- if($carrier->shipping_external) {
+ if ($carrier->shipping_external) {
$moduleName = $carrier->external_module_name;
$module = Module::getInstanceByName($moduleName);
- if(Validate::isLoadedObject($module)) {
+ if (Validate::isLoadedObject($module)) {
if(array_key_exists('id_carrier', $module)) {
$module->id_carrier = $carrier->id;
}
@@ -373,7 +375,7 @@ class Cart extends CartCore {
}
}
- if(Module::isInstalled('privatesales')) {
+ if (Module::isInstalled('privatesales')) {
$product_cats = array();
foreach($products as $product) {
$product_cats[] = $product['id_category_default'];
@@ -387,72 +389,52 @@ class Cart extends CartCore {
$cpt_sales = count($sales);
- // si consommables forcer à 5euros
- /*if ($cpt_sales==1) {
- foreach ($sales as $key => $sale) {
- if ((int) $sale['id_sale'] == (int) _SHOP_PRIVATESALES_CONSUMABLE) {
- $sale = new Sale((int)$sale['id_sale']);
- $sale_carriers = $sale->getCarriers();
- foreach ($sale_carriers as $id_c) {
- if ((int) $carrier->id == (int) $id_c) {
- $shipping_cost = 5;
- $shipping_cost = Tools::convertPrice($shipping_cost, Currency::getCurrencyInstance((int)($this->id_currency)));
- return $shipping_cost;
- }
- }
- unset($sale_carriers);
+ if ($cpt_sales == 1) {
+ // Set a fix shipping cost
+ $enableFixShippingCost = true;
+ $shipping_cost_fix = 5;
+ if ($enableFixShippingCost) {
+ $cat_shipping_cost_fix = array(8744158);
+ if (in_array($product_cats[0], $cat_shipping_cost_fix)) {
+ $shipping_cost = Tools::convertPrice($shipping_cost_fix, Currency::getCurrencyInstance((int)($this->id_currency)));
+ return $shipping_cost;
}
}
- }*/
-
- // Surcout transporteur classique
- // if ($carrier->id == 33
- // || $carrier->id == 24
- // || $carrier->id == 37
- // || $carrier->id == 45) {
-
- // if ($carrier->id == 28
- // || $carrier->id == 24
- // || $carrier->id == 27)
- // if ($carrier->id == 45
- // || $carrier->id == 46
- // || $carrier->id == 47
- // || $carrier->id == 48) {
-
- if($cpt_sales == 2) {
- $shipping_cost += (float) Configuration::get('PS_SHIPPING_HANDLING_PS_1');
- } elseif($cpt_sales == 3) {
- $shipping_cost += (float) Configuration::get('PS_SHIPPING_HANDLING_PS_2');
- } elseif($cpt_sales == 4) {
- $shipping_cost += (float) Configuration::get('PS_SHIPPING_HANDLING_PS_3');
- } elseif($cpt_sales == 5) {
- $shipping_cost += (float) Configuration::get('PS_SHIPPING_HANDLING_PS_4');
- } elseif($cpt_sales >= 6) {
- $shipping_cost += (float) Configuration::get('PS_SHIPPING_HANDLING_PS_4');
- }
- // }
+ }
+ else if ($cpt_sales == 2) {
+ $shipping_cost += (float) Configuration::get('PS_SHIPPING_HANDLING_PS_1');
+ }
+ elseif ($cpt_sales == 3) {
+ $shipping_cost += (float) Configuration::get('PS_SHIPPING_HANDLING_PS_2');
+ }
+ elseif ($cpt_sales == 4) {
+ $shipping_cost += (float) Configuration::get('PS_SHIPPING_HANDLING_PS_3');
+ }
+ elseif ($cpt_sales == 5) {
+ $shipping_cost += (float) Configuration::get('PS_SHIPPING_HANDLING_PS_4');
+ }
+ elseif ($cpt_sales >= 6) {
+ $shipping_cost += (float) Configuration::get('PS_SHIPPING_HANDLING_PS_4');
+ }
}
-
-
// Apply tax
- if(isset($carrierTax)) {
+ if (isset($carrierTax)) {
$shipping_cost *= 1 + ($carrierTax / 100);
}
- if(Module::isInstalled('privatesales') && $add_carrier_cost) {
-
+ if (Module::isInstalled('privatesales') && $add_carrier_cost) {
if (class_exists('Sale')) {
if (in_array($carrier->id, self::$carrier_special)) {
- if(Configuration::get('PRIVATESALES_CARRIERFENCE') ) {
+ if (Configuration::get('PRIVATESALES_CARRIERFENCE') ) {
$cart_products = $this->getProducts();
- if(count($cart_products) > 0) {
+ if (count($cart_products) > 0) {
$_carriers = array();
foreach ($cart_products as $key => $cart_product) {
$sale = Sale::getSaleFromCategory($cart_product['id_category_default']);
- if($sale) {
+ if ($sale) {
$sale_carriers = $sale->getCarriers();
foreach ($sale_carriers as $carrier_test) {
@@ -496,6 +478,7 @@ class Cart extends CartCore {
}
}
}
+
return (float)(Tools::ps_round((float)($shipping_cost), 2));
}
diff --git a/override/classes/Order.php b/override/classes/Order.php
index dd038f4c..3d854b67 100644
--- a/override/classes/Order.php
+++ b/override/classes/Order.php
@@ -1,7 +1,7 @@
'isPrice',
'shipping_number' => 'isUrl',
'conversion_rate' => 'isFloat',
- 'appli' => 'isBool',
+ 'appli' => 'isUnsignedInt',
);
public function getFields()
diff --git a/override/classes/PaymentModule.php b/override/classes/PaymentModule.php
index c766ea1d..e5e97a9e 100755
--- a/override/classes/PaymentModule.php
+++ b/override/classes/PaymentModule.php
@@ -25,9 +25,9 @@ class PaymentModule extends PaymentModuleCore
$order->appli = 0;
if (Tools::isApi()) {
$order->appli = 1;
- }/* elseif (Tools::isMobile()) {
+ } elseif (Tools::isMobile()) {
$order->appli = 2;
- }*/
+ }
$order->id_carrier = (int)($cart->id_carrier);
$order->id_customer = (int)($cart->id_customer);
$order->id_address_invoice = (int)($cart->id_address_invoice);