Merge branch 'evo-DBorderCurrentState' into develop

This commit is contained in:
Marion Muszynski 2016-09-08 11:53:06 +02:00
commit 847e13178e
6 changed files with 52 additions and 63 deletions

View File

@ -26,7 +26,7 @@ class html2text {
* @var integer $width
* @access public
*/
var $width = 70;
var $width = 0;
/**
* List of preg* regular expression patterns to search for,

View File

@ -29,22 +29,23 @@ class AdminPhileaMagistor extends AdminTab {
)
');
if (Tools::getValue('force_rec_file')){
// get last sync order form for this sale
$last_order_sync = Db::getInstance()->getRow(
'SELECT * FROM `' . _DB_PREFIX_ . 'philea_supplier_order_sync`
WHERE `id_sale` = ' . (int) $id_sale . '
ORDER BY `date_add` DESC');
// no REC on BBB
// if (Tools::getValue('force_rec_file')){
// // get last sync order form for this sale
// $last_order_sync = Db::getInstance()->getRow(
// 'SELECT * FROM `' . _DB_PREFIX_ . 'philea_supplier_order_sync`
// WHERE `id_sale` = ' . (int) $id_sale . '
// ORDER BY `date_add` DESC');
if ($last_order_sync && isset($last_order_sync['id_order_form'])){
Db::getInstance()->execute('
DELETE FROM `' . _DB_PREFIX_ . 'philea_supplier_order_sync`
WHERE `id_sale` = ' . (int) $id_sale . '
AND `id_order_form` = ' . (int) $last_order_sync['id_order_form'] . '
ORDER BY `date_add` DESC
LIMIT 1');
}
}
// if ($last_order_sync && isset($last_order_sync['id_order_form'])){
// Db::getInstance()->execute('
// DELETE FROM `' . _DB_PREFIX_ . 'philea_supplier_order_sync`
// WHERE `id_sale` = ' . (int) $id_sale . '
// AND `id_order_form` = ' . (int) $last_order_sync['id_order_form'] . '
// ORDER BY `date_add` DESC
// LIMIT 1');
// }
// }
echo '<p class="conf">'.$this->l('Sale added to queue successfully').'</p><br />';
} else {
@ -235,12 +236,12 @@ class AdminPhileaMagistor extends AdminTab {
'filter' => true,
'filter_text' => $this->l('Filter par vente')
),
array(
'type' => 'checkbox',
'name' => 'force_rec_file',
'label' => $this->l('Forcer l\'envoi'),
'text' => $this->l('Force un nouvel envoi du fichier REC.')
)
// array(
// 'type' => 'checkbox',
// 'name' => 'force_rec_file',
// 'label' => $this->l('Forcer l\'envoi'),
// 'text' => $this->l('Force un nouvel envoi du fichier REC.')
// )
),
'actions' => array(
array(
@ -254,38 +255,6 @@ class AdminPhileaMagistor extends AdminTab {
$form .= $helperForm->renderForm(false, NULL, NULL, true);
// $form .= '
// <form action="' . $base_link . '" method="post" class="form"><div class="clear">&nbsp;</div>
// <fieldset><legend>'.$this->l('Philea').'</legend>
// <p class="select">
// <label for="id_sale">'.$this->l('Select a sale').'</label>
// <select name="id_sale" id="id_sale">';
// foreach(Db::getInstance()->ExecuteS('
// SELECT p.`id_sale`, c.`name`
// FROM `'._DB_PREFIX_.'privatesale` p
// LEFT JOIN `'._DB_PREFIX_.'category_lang` c
// ON c.`id_category` = p.`id_category`
// LEFT JOIN `'._DB_PREFIX_.'privatesale_shipping_sale` s
// ON s.`id_sale` = p.`id_sale`
// WHERE c.`id_lang` = 2
// AND s.`id_shipping` = '.(int) self::ID_SHIPPING.'
// AND p.`date_start` > "2015-01-01 00:00:00"
// ORDER BY p.`id_sale` DESC
// ') as $row) {
// $form .= '<option value="'.(int) $row['id_sale'].'">'.(int) $row['id_sale'].' - '.$row['name'].'</option>';
// }
// $form .= '</select>
// </p>
// <p class="center submit">
// <input type="submit" class="button" title="'.$this->l('Envoi des fichiers ART et REC').'" value="'.$this->l('Envoyer à Philea').'" name="submitPhilea" />
// </p>
// </fieldset></form>';
// &nbsp;&nbsp;&nbsp;&nbsp;
// <input type="submit" class="button" title="'.$this->l('Programmer l\'export automatique ART et REC').'" value="'.$this->l('Export automatique').'" name="submitPhileaAutoExport" />
$CRR_list = $this->getCRRList();
$form .= '
@ -300,7 +269,7 @@ class AdminPhileaMagistor extends AdminTab {
<tr>
<th colspan="2">' . $this->l('ID sale') . '</th>
<th width="250">' . $this->l('Name') . '</th>
<th>' . $this->l('Date envoi (ART + REC)') . '</th>
<th>' . $this->l('Date envoi (ART)') . '</th>
<th>' . $this->l('Télécharger le CRR') . '</th>
<th>' . $this->l('Date Reçu CRR') . '</th>
<th>' . $this->l('Envoyer la commande') . '</th>
@ -321,7 +290,7 @@ class AdminPhileaMagistor extends AdminTab {
$dl_link = $dowload_link . $Y . '/' . $m . '/' . $CRR['filename'];
$dl_csv = $base_link . '&getCsv&id_sale='.(int) $CRR['id_sale'].'&filename='.$CRR['filename'];
$dl_link = '<a class="button" target="_blank" href="' . $dl_link . '" title="'.$this->l('Download CRR file').'"><img src="../img/admin/import.gif"/>'.$this->l('.DAT').'</a>&nbsp;&nbsp;&nbsp;';
$dl_link .= '<a class="button" target="_blank" href="' . $dl_csv . '" title="'.$this->l('Download CRR file').'"><img src="../img/admin/import.gif"/>'.$this->l('.CSV').'</a>';
//$dl_link .= '<a class="button" target="_blank" href="' . $dl_csv . '" title="'.$this->l('Download CRR file').'"><img src="../img/admin/import.gif"/>'.$this->l('.CSV').'</a>';
}
else{
$CRR['recep_date'] = '--';

View File

@ -1,5 +1,5 @@
<?php
//$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
include dirname(__FILE__).'/../../config/config.inc.php';
if(isset($_SERVER['REMOTE_ADDR'])) {

View File

@ -20,7 +20,7 @@ function getName($id_product, $id_lang, $id_product_attribute = FALSE) {
');
if($id_product_attribute) {
foreach(Db::getInstance()->ExecuteQ('
foreach(Db::getInstance()->ExecuteS('
SELECT agl.`name` AS group_name, al.`name` AS attribute_name
FROM `'._DB_PREFIX_.'product_attribute_combination` pac
LEFT JOIN `'._DB_PREFIX_.'attribute` a
@ -94,7 +94,7 @@ if($magistorModule->active) {
$ids = (int) $product['id_product'] . '-' . (int) $cover;
$img_link = 'http://'.$link->getImageLink($product['link_rewrite'], $ids, 'thickbox');
$attributes = $db->ExecuteQ('
$attributes = $db->ExecuteS('
SELECT *
FROM `'._DB_PREFIX_.'product_attribute`
WHERE `id_product` = '.$product['id_product'].'
@ -109,7 +109,7 @@ if($magistorModule->active) {
$data .= str_pad('ART01', 10, ' ', STR_PAD_RIGHT);
$data .= str_pad($code_societe, 20, ' ', STR_PAD_RIGHT);
$data .= str_pad(substr(utf8_decode(str_replace(array("\r", "\n"), '', $ean)), 0, 50), 50, ' ', STR_PAD_RIGHT);
$data .= str_pad(substr(utf8_decode(str_replace(array("\r", "\n"), '', $product['id_product'].'_'.$attribute['id_product_attribute'])), 0, 50), 50, ' ', STR_PAD_RIGHT);
$data .= str_pad(substr(utf8_decode(str_replace(array("\r", "\n"), '', getName($product['id_product'], Configuration::get('PS_LANG_DEFAULT'), $attribute['id_product_attribute']))), 0,80), 80, ' ', STR_PAD_RIGHT);
$data .= str_pad(1, 10, '0', STR_PAD_LEFT);
$data .= str_pad(str_replace(array("\r", "\n"), '', $attribute['ean13']), 14, ' ', STR_PAD_LEFT);
@ -127,7 +127,7 @@ if($magistorModule->active) {
$data .= str_pad('ART01', 10, ' ', STR_PAD_RIGHT);
$data .= str_pad($code_societe, 20, ' ', STR_PAD_RIGHT);
$data .= str_pad(str_replace(array("\r", "\n"), '', $ean), 50, ' ', STR_PAD_RIGHT);
$data .= str_pad(str_replace(array("\r", "\n"), '', $product['id_product']), 50, ' ', STR_PAD_RIGHT);
$data .= str_pad(substr(utf8_decode(str_replace(array("\r", "\n"), '', $product['name'])), 0, 80), 80, ' ', STR_PAD_RIGHT);
$data .= str_pad(1, 10, '0', STR_PAD_LEFT);
$data .= str_pad(str_replace(array("\r", "\n"), '', $product['ean13']), 14, ' ', STR_PAD_LEFT);

View File

@ -97,7 +97,7 @@ if($magistorModule->active) {
$code_societe = (int)(Configuration::get('PHILEA_MAGISTOR_CODE_STE'));
}
$delai_livraison = (int)(Configuration::get('PHILEA_MAGISTOR_DELAI_LIVRAISON'));
$delai_livraison = 2; //(int)(Configuration::get('PHILEA_MAGISTOR_DELAI_LIVRAISON'));
//@TODO rendre configurable le champs "reference" entre "reference" et "ean13"
$referenceField = 'reference';//Configuration::get('PHILEA_MAGISTOR_REF_FIELD');
@ -172,7 +172,7 @@ if($magistorModule->active) {
}
if(!$carrier_value) {
$carrier_value = $tab_conversion_carrier[$order->id_carrier];
$carrier_value = $tab_conversion_carrier[$order->id_carrier.':'];
}

View File

@ -1,5 +1,25 @@
<?php
class OrderHistory extends OrderHistoryCore {
public function add($autodate = TRUE, $nullValues = FALSE) {
if($result = parent::add($autodate, $nullValues)) {
Db::getInstance()->ExecuteS('
INSERT INTO `'._DB_PREFIX_.'order_state_current`
VALUES (
'.(int) $this->id_order.',
'.(int) $this->id_order_state.',
NOW()
)
ON DUPLICATE KEY UPDATE
`id_order_state` = '.(int) $this->id_order_state.',
`date_upd` = NOW()
');
return $result;
}
return FALSE;
}
public function addWithemail($autodate = true, $templateVars = false) {
$lastOrderState = $this->getLastOrderState($this->id_order);