fix conflict

This commit is contained in:
Marion Muszynski 2016-12-08 13:28:32 +01:00
commit ce40fc52c7
3 changed files with 60 additions and 48 deletions

View File

@ -1,6 +1,6 @@
<?php
// $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
// $_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
include('../../../config/settings.inc.php');
include('../../../config/config.inc.php');
@ -120,6 +120,9 @@
$id_inactive_carrier = false;
if (isset($data[8]) && $data[8]){
$carrier_name = trim($data[8]);
if($carrier_name == 'COLINT') {
$carrier_name = 'SOCOLMDSS';
}
$carriers = philea_magistor::getCarriersIdByRef($carrier_name);
if ($carriers){
foreach ($carriers as $carrier) {
@ -492,9 +495,9 @@
mkdir($repo_archive);
}
// copy($datFile, $repo_archive . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() ));
// unlink($inFolder.$fileinfo->getFilename());
// unlink($datFile);
copy($datFile, $repo_archive . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() ));
unlink($inFolder.$fileinfo->getFilename());
unlink($datFile);
}
}

View File

@ -1,7 +1,7 @@
<?php
// $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
// $_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
include('../../../config/settings.inc.php');
include('../../../config/config.inc.php');
@ -164,8 +164,8 @@
copy($datFile, $repo_archive . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() ));
// unlink($inFolder.$fileinfo->getFilename());
// unlink($datFile);
unlink($inFolder.$fileinfo->getFilename());
unlink($datFile);
}
}
}

View File

@ -1,6 +1,6 @@
<?php
//$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
//$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
//include(dirname(__FILE__) . '/../../../config/settings.inc.php');
include(dirname(__FILE__) . '/../../../config/config.inc.php');
@ -9,6 +9,7 @@ include( dirname(__FILE__) . '/../philea_magistor.php');
ini_set('memory_limit', '4G');
$id_sale = (int) $argv[1];
$_id_shipping = 1; // philea
if($id_sale == 0) {
@ -23,14 +24,15 @@ $id_lang = Configuration::get('PS_LANG_DEFAULT');
$tab_conversion_carrier = philea_magistor::getTabState();
$socol_to_magistor = array(
'DOM' => 'SOCOLMDSS', // Livraison à domicile
'DOS' => 'SOCOLMDS',
'RDV' => 'SOCOLMRDV', // Livraison sur Rendez-vous
'CIT' => 'SOCOLCITY', // Livraison en Cityssimo
'BPR' => 'SOCOLMBP', // Livraison en Bureau de Poste
'CDI' => 'SOCOLMBP', // Centre de distribution
'A2P' => 'SOCOLMC', // Livraison Commerce de proximité
'ACP' => 'SOCOLMBP', // Agence ColiPoste
'DOMINTER' => 'COLINT', // Livraison internationnale à domicile
'DOM' => 'SOCOLMDSS', // Livraison à domicile
'DOS' => 'SOCOLMDS',
'RDV' => 'SOCOLMRDV', // Livraison sur Rendez-vous
'CIT' => 'SOCOLCITY', // Livraison en Cityssimo
'BPR' => 'SOCOLMBP', // Livraison en Bureau de Poste
'CDI' => 'SOCOLMBP', // Centre de distribution
'A2P' => 'SOCOLMC', // Livraison Commerce de proximité
'ACP' => 'SOCOLMBP', // Agence ColiPoste
);
$mr_to_magistor = array(
@ -197,13 +199,21 @@ if($magistorModule->active) {
');
if($delivery_info) {
$carrier_value = $socol_to_magistor[$delivery_info['delivery_mode']];
if($delivery_info['cecountry'] != 'FR') {
$carrier_value = $socol_to_magistor['DOMINTER'];
} else {
$carrier_value = $socol_to_magistor[$delivery_info['delivery_mode']];
}
$prid = $delivery_info['prid'];
}
}
if(!$carrier_value) {
$carrier_value = $tab_conversion_carrier[$order->id_carrier.':'];
if((int)$address_delivery->id_country == 8) {
$carrier_value = $tab_conversion_carrier[$order->id_carrier.':'];
} else {
$carrier_value = $socol_to_magistor['DOMINTER'];
}
}
@ -331,28 +341,31 @@ if($magistorModule->active) {
$ean = !empty($pack_item['ean13'])? $pack_item['ean13']: $pack_item['supplier_reference'];
$ref = $pack_item['id_product'];
$p_key = (int) $pack_item['id_product'];
if (!isset($product_packs[$p_key])) {
$product_packs[$p_key] = array(
$p_key = $pack_item['id_product'];
if (!isset($product_rows[$p_key])) {
$product_rows[$p_key] = array(
str_replace(array("\r", "\n"), '', $ref),
0,
substr(utf8_decode(cleanChar($pack_item['name'])),0,50),
str_replace(array("\r", "\n"), "", $ean)
);
}
$product_packs[$p_key][1] += max($product['product_quantity'] - max($product['product_quantity_return'], $product['product_quantity_refunded']), 0) * $pack_item['pack_quantity'];
$product_rows[$p_key][1] += (max($product['product_quantity'] - max($product['product_quantity_return'], $product['product_quantity_refunded']), 0) * $pack_item['pack_quantity']);
}
} else {
$ean = !empty($product['product_ean13'])? $product['product_ean13']: $product['product_supplier_reference'];
$ref = ($product['product_attribute_id']?$product['product_id'].'_'.$product['product_attribute_id']:$product['product_id']);
$p_key = ($product['product_attribute_id']?$product['product_id'].'_'.$product['product_attribute_id']:$product['product_id']);
$product_rows[(int) $p_key] = array(
str_replace(array("\r", "\n"), '', $ref),
max($product['product_quantity'] - max($product['product_quantity_return'], $product['product_quantity_refunded']), 0),
substr(utf8_decode(cleanChar($product['product_name'])),0,50),
str_replace(array("\r", "\n"), "", $ean),
);
if (!isset($product_rows[$p_key])) {
$product_rows[$p_key] = array(
str_replace(array("\r", "\n"), '', $ref),
0,
substr(utf8_decode(cleanChar($product['product_name'])),0,50),
str_replace(array("\r", "\n"), "", $ean),
);
}
$product_rows[$p_key][1] += max($product['product_quantity'] - max($product['product_quantity_return'], $product['product_quantity_refunded']), 0);
}
}
@ -371,18 +384,18 @@ if($magistorModule->active) {
$data .= PHP_EOL;
}
// Add pack items to data
foreach ($product_packs as $product) {
$nb_ligne ++;
// foreach ($product_packs as $product) {
// $nb_ligne ++;
$data .= str_pad( 'L01', 10, ' ', STR_PAD_RIGHT );
$data .= str_pad( 'OP'.(int) $id_sale.'-'.$order->id, 50, ' ', STR_PAD_RIGHT );
$data .= str_pad( $nb_ligne, 4, '0', STR_PAD_LEFT );
$data .= str_pad( $product[0], 50, ' ', STR_PAD_RIGHT ); // ref
$data .= str_pad( $product[1], 8, '0', STR_PAD_LEFT ); // quantity
$data .= str_pad( $product[2], 50, ' ', STR_PAD_RIGHT ); // product name
$data .= str_pad( $product[3], 14, ' ', STR_PAD_LEFT ); // ean
$data .= PHP_EOL;
}
// $data .= str_pad( 'L01', 10, ' ', STR_PAD_RIGHT );
// $data .= str_pad( 'OP'.(int) $id_sale.'-'.$order->id, 50, ' ', STR_PAD_RIGHT );
// $data .= str_pad( $nb_ligne, 4, '0', STR_PAD_LEFT );
// $data .= str_pad( $product[0], 50, ' ', STR_PAD_RIGHT ); // ref
// $data .= str_pad( $product[1], 8, '0', STR_PAD_LEFT ); // quantity
// $data .= str_pad( $product[2], 50, ' ', STR_PAD_RIGHT ); // product name
// $data .= str_pad( $product[3], 14, ' ', STR_PAD_LEFT ); // ean
// $data .= PHP_EOL;
// }
foreach ($sales as $key => $sale_id) {
Db::getInstance()->ExecuteS('
@ -413,17 +426,13 @@ if($magistorModule->active) {
NOW()
)
');
if (!empty($multi)) {
mail('marion@antadis.com', '[BBB] Philea - Send command with multi', 'multi : '.implode(',',$multi).' - file : '.$file); // log multi
} else {
mail('marion@antadis.com', '[BBB] Philea - Send command without multi', 'Pas de multi - file : '.$file); // log multi
}
//mail('marion@antadis.com', '[BBB] Philea - Send command', ' file : '.$file); // log
file_put_contents($fileName . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
file_put_contents($fileName . '.BAL', '');
file_put_contents($fileArchive . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
//require_once('connection_ftp.php');
require_once('connection_ftp.php');
}
}