divers ticket
This commit is contained in:
parent
e9d8e2942a
commit
b7fc35d3ae
@ -38,16 +38,19 @@ class AdminCarts extends AdminTab
|
|||||||
$this->view = true;
|
$this->view = true;
|
||||||
$this->delete = true;
|
$this->delete = true;
|
||||||
|
|
||||||
$this->_select = 'CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) `customer`, a.id_cart total, ca.name carrier, o.id_order ';
|
$this->_select = 'CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) `customer`, a.id_cart total, ca.name carrier, o.id_order, IFNULL(ci.`version`, "fr") AS `version`';
|
||||||
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'customer c ON (c.id_customer = a.id_customer)
|
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'customer c ON (c.id_customer = a.id_customer)
|
||||||
LEFT JOIN '._DB_PREFIX_.'currency cu ON (cu.id_currency = a.id_currency)
|
LEFT JOIN '._DB_PREFIX_.'currency cu ON (cu.id_currency = a.id_currency)
|
||||||
LEFT JOIN '._DB_PREFIX_.'carrier ca ON (ca.id_carrier = a.id_carrier)
|
LEFT JOIN '._DB_PREFIX_.'carrier ca ON (ca.id_carrier = a.id_carrier)
|
||||||
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_cart = a.id_cart) ';
|
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_cart = a.id_cart)
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'customer_version` ci ON (ci.`id_customer` = a.`id_customer`)';
|
||||||
|
|
||||||
|
$versions = array('fr' => 'FR', 'es' => 'ES');
|
||||||
$this->fieldsDisplay = array(
|
$this->fieldsDisplay = array(
|
||||||
'id_cart' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
'id_cart' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||||
'id_order' => array('title' => $this->l('ID Order'), 'align' => 'center', 'width' => 25),
|
'id_order' => array('title' => $this->l('ID Order'), 'align' => 'center', 'width' => 25),
|
||||||
'customer' => array('title' => $this->l('Customer'), 'width' => 80, 'filter_key' => 'c!lastname'),
|
'customer' => array('title' => $this->l('Customer'), 'width' => 80, 'filter_key' => 'c!lastname'),
|
||||||
|
'version' => array('title' => $this->l('Version'), 'callback' => 'printVersion', 'type' => 'select', 'select' => $versions, 'orderby' => false, 'filter_key' => 'ci!version'),
|
||||||
'total' => array('title' => $this->l('Total'), 'callback' => 'getOrderTotalUsingTaxCalculationMethod', 'orderby' => false, 'search' => false, 'width' => 50, 'align' => 'right', 'prefix' => '<b>', 'suffix' => '</b>', 'currency' => true),
|
'total' => array('title' => $this->l('Total'), 'callback' => 'getOrderTotalUsingTaxCalculationMethod', 'orderby' => false, 'search' => false, 'width' => 50, 'align' => 'right', 'prefix' => '<b>', 'suffix' => '</b>', 'currency' => true),
|
||||||
'carrier' => array('title' => $this->l('Carrier'), 'width' => 25, 'align' => 'center', 'callback' => 'replaceZeroByShopName', 'filter_key' => 'ca!name'),
|
'carrier' => array('title' => $this->l('Carrier'), 'width' => 25, 'align' => 'center', 'callback' => 'replaceZeroByShopName', 'filter_key' => 'ca!name'),
|
||||||
'date_add' => array('title' => $this->l('Date'), 'width' => 90, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'));
|
'date_add' => array('title' => $this->l('Date'), 'width' => 90, 'align' => 'right', 'type' => 'datetime', 'filter_key' => 'a!date_add'));
|
||||||
|
@ -304,11 +304,15 @@ class AdminBulkUpdate extends AdminTab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach($products as $id_product => $urls) {
|
foreach($products as $id_product => $urls) {
|
||||||
foreach($urls as $url) {
|
foreach($urls as $key => $url) {
|
||||||
$image = new Image();
|
$image = new Image();
|
||||||
$image->id_product = $id_product;
|
$image->id_product = $id_product;
|
||||||
$image->position = Image::getHighestPosition($id_product) + 1;
|
$image->position = Image::getHighestPosition($id_product) + 1;
|
||||||
|
if ($key == 0 && Tools::getValue('image_process') == 1) {
|
||||||
|
$image->cover = true;
|
||||||
|
} else {
|
||||||
$image->cover = FALSE;
|
$image->cover = FALSE;
|
||||||
|
}
|
||||||
$image->legend = self::createMultiLangField(Db::getInstance()->getValue('
|
$image->legend = self::createMultiLangField(Db::getInstance()->getValue('
|
||||||
SELECT `name`
|
SELECT `name`
|
||||||
FROM `'._DB_PREFIX_.'product_lang`
|
FROM `'._DB_PREFIX_.'product_lang`
|
||||||
@ -519,6 +523,34 @@ class AdminBulkUpdate extends AdminTab {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$output .= '<p class="conf">'.$this->l('Products updated').'</p>';
|
||||||
|
} elseif(Tools::isSubmit('submitUploadProductDescriptions')) {
|
||||||
|
$id_lang = Tools::getValue('description_process');
|
||||||
|
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
|
||||||
|
fgetcsv($f, 0, ';');
|
||||||
|
|
||||||
|
$products = array();
|
||||||
|
|
||||||
|
while($line = fgetcsv($f, 0, ';')) {
|
||||||
|
if($line[0] == '' || $line[1] == '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$products[] = $line;
|
||||||
|
}
|
||||||
|
foreach($products as $line) {
|
||||||
|
$result = Db::getInstance()->ExecuteS('
|
||||||
|
UPDATE `'._DB_PREFIX_.'product_lang`
|
||||||
|
SET `description` = "'. pSQL($line[1],true) .'"
|
||||||
|
WHERE `id_product` ='. (int) $line[0].'
|
||||||
|
AND `id_lang` = '.(int) $id_lang.'
|
||||||
|
');
|
||||||
|
/*if (!$result) {
|
||||||
|
$output .= '<p class="error">ligne non traitée, id_product: '.$line[0].'</p>';
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($f);
|
||||||
$output .= '<p class="conf">'.$this->l('Products updated').'</p>';
|
$output .= '<p class="conf">'.$this->l('Products updated').'</p>';
|
||||||
} elseif(Tools::isSubmit('submitUploadCombinations')) {
|
} elseif(Tools::isSubmit('submitUploadCombinations')) {
|
||||||
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
|
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
|
||||||
@ -1148,6 +1180,32 @@ class AdminBulkUpdate extends AdminTab {
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</form>';
|
</form>';
|
||||||
|
|
||||||
|
$langs = Language::getLanguages(false);
|
||||||
|
$output .= '
|
||||||
|
<p><br /></p>
|
||||||
|
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
|
||||||
|
<fieldset><legend><img src="/modules/bulkupdate/logo.gif" alt="" title="" />'.$this->l('Update product descriptions').'</legend>
|
||||||
|
<label>'.$this->l('Description process:').'</label>
|
||||||
|
<div class="margin-form">';
|
||||||
|
foreach ($langs as $key => $value) {
|
||||||
|
if ($value['id_lang'] == 2) {
|
||||||
|
$output .= '<input type="radio" id="description_process_'.$value['id_lang'].'" name="description_process" value="'.$value['id_lang'].'" checked/> <label style="float: none;" for="description_process_'.$value['id_lang'].'">'.$value['iso_code'].'</label>';
|
||||||
|
} else {
|
||||||
|
$output .= '<input type="radio" id="description_process_'.$value['id_lang'].'" name="description_process" value="'.$value['id_lang'].'"/> <label style="float: none;" for="description_process_'.$value['id_lang'].'">'.$value['iso_code'].'</label>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$output .= '</div>
|
||||||
|
<p> </p>
|
||||||
|
<label>'.$this->l('File:').'</label>
|
||||||
|
<div class="margin-form">
|
||||||
|
<input type="file" name="csvfile" />
|
||||||
|
<p>'.$this->l('Format: id_product;description; the subsequent columns and the first line are ignored').'</p>
|
||||||
|
</div>
|
||||||
|
<p> </p>
|
||||||
|
<center><input type="submit" name="submitUploadProductDescriptions" value="'.$this->l('Upload').'" class="button" /></center>
|
||||||
|
</fieldset>
|
||||||
|
</form>';
|
||||||
|
|
||||||
// $output .= '
|
// $output .= '
|
||||||
// <p><br /></p>
|
// <p><br /></p>
|
||||||
// <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
|
// <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
|
||||||
@ -1310,7 +1368,8 @@ class AdminBulkUpdate extends AdminTab {
|
|||||||
AND c.`id_parent` = 1
|
AND c.`id_parent` = 1
|
||||||
ORDER BY id_category DESC
|
ORDER BY id_category DESC
|
||||||
') as $row) {
|
') as $row) {
|
||||||
$output .= '<option value="'.$row['id_category'].'">'.$row['id_category'].' - '.$row['name'].'</option>';
|
$extrafields = Category::getSalesInfos(array((int) $row['id_category']));
|
||||||
|
$output .= '<option value="'.$row['id_category'].'">'.$row['id_category'].' - '.$row['name'].' - '.$extrafields[(int) $row['id_category']]['sales'][1].'</option>';
|
||||||
}
|
}
|
||||||
$output .= '</select>
|
$output .= '</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -874,6 +874,34 @@ class BulkUpdate extends Module {
|
|||||||
fclose($f);
|
fclose($f);
|
||||||
$output .= '<p class="conf">'.$this->l('Export complete.').' <a onclick="window.open(this.href); return false;" href="http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/bulkupdate/'.$fname.'">'.$this->l('Click here to download the file').'</a></p>';
|
$output .= '<p class="conf">'.$this->l('Export complete.').' <a onclick="window.open(this.href); return false;" href="http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__.'modules/bulkupdate/'.$fname.'">'.$this->l('Click here to download the file').'</a></p>';
|
||||||
}
|
}
|
||||||
|
} elseif(Tools::isSubmit('submitUploadProductDescriptions')) {
|
||||||
|
$id_lang = Tools::getValue('description_process');
|
||||||
|
$f = fopen($_FILES['csvfile']['tmp_name'], 'r');
|
||||||
|
fgetcsv($f, 0, ';');
|
||||||
|
|
||||||
|
$products = array();
|
||||||
|
|
||||||
|
while($line = fgetcsv($f, 0, ';')) {
|
||||||
|
if($line[0] == '' || $line[1] == '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$products[] = $line;
|
||||||
|
}
|
||||||
|
foreach($products as $line) {
|
||||||
|
$result = Db::getInstance()->ExecuteS('
|
||||||
|
UPDATE `'._DB_PREFIX_.'product_lang`
|
||||||
|
SET `description` = '. pSQL($line[1],true) .'"
|
||||||
|
WHERE `id_product` ='. (int) $line[0].'
|
||||||
|
AND `id_lang` = '.(int) $id_lang.'
|
||||||
|
');
|
||||||
|
if (!$result) {
|
||||||
|
$output .= '<p class="error">ligne non traitée, id_product: '.$line[0].'</p>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($f);
|
||||||
|
$output .= '<p class="conf">'.$this->l('Products updated').'</p>';
|
||||||
} elseif(Tools::isSubmit('submitExportPositions')) {
|
} elseif(Tools::isSubmit('submitExportPositions')) {
|
||||||
set_time_limit(300);
|
set_time_limit(300);
|
||||||
if($id_category = (int) Tools::getValue('category')) {
|
if($id_category = (int) Tools::getValue('category')) {
|
||||||
@ -1045,6 +1073,27 @@ class BulkUpdate extends Module {
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
</form>';
|
</form>';
|
||||||
|
|
||||||
|
$output .= '
|
||||||
|
<p><br /></p>
|
||||||
|
<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
|
||||||
|
<fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Update product descriptions').'</legend>
|
||||||
|
<label>'.$this->l('Description process:').'</label>
|
||||||
|
<div class="margin-form">
|
||||||
|
<input type="radio" id="description_process_0" name="description_process" value="0" /> <label style="float: none;" for="description_process_0">'.$this->l('Fr').'</label>
|
||||||
|
<input type="radio" id="description_process_1" name="description_process" value="1" /> <label style="float: none;" for="description_process_1">'.$this->l('Es').'</label>
|
||||||
|
</div>
|
||||||
|
<p> </p>
|
||||||
|
<label>'.$this->l('File:').'</label>
|
||||||
|
<div class="margin-form">
|
||||||
|
<input type="file" name="csvfile" />
|
||||||
|
<p>'.$this->l('Format: id_product;description; the subsequent columns and the first line are ignored').'</p>
|
||||||
|
</div>
|
||||||
|
<p> </p>
|
||||||
|
<center><input type="submit" name="submitUploadProductDescriptions" value="'.$this->l('Upload').'" class="button" /></center>
|
||||||
|
</fieldset>
|
||||||
|
</form>';
|
||||||
|
|
||||||
|
|
||||||
// $output .= '
|
// $output .= '
|
||||||
// <p><br /></p>
|
// <p><br /></p>
|
||||||
// <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
|
// <form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post" enctype="multipart/form-data">
|
||||||
|
@ -34,6 +34,7 @@ class FraudCore {
|
|||||||
$this->fraudConnexion();
|
$this->fraudConnexion();
|
||||||
$this->fraudCountData();
|
$this->fraudCountData();
|
||||||
$this->fraudInvite();
|
$this->fraudInvite();
|
||||||
|
$this->alreadyInFraud();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFraudScore() {
|
public function getFraudScore() {
|
||||||
@ -229,6 +230,30 @@ class FraudCore {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function alreadyInFraud()
|
||||||
|
{
|
||||||
|
$already_fraud = Db::getInstance()->getValue('
|
||||||
|
SELECT COUNT(h.`id_order`)
|
||||||
|
FROM `'._DB_PREFIX_.'order_history` h
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'orders` o on h.`id_order` = o.`id_order`
|
||||||
|
WHERE o.`id_customer` = '.(int) $this->customer->id.'
|
||||||
|
AND `id_order_state` IN (15,16,18)
|
||||||
|
');
|
||||||
|
|
||||||
|
$already_suspect = Db::getInstance()->getValue('
|
||||||
|
SELECT COUNT(rep.`id_cart`)
|
||||||
|
FROM `'._DB_PREFIX_.'order_reputation` rep
|
||||||
|
LEFT JOIN `'._DB_PREFIX_.'cart` c ON c.`id_cart` = rep.`id_cart`
|
||||||
|
WHERE c.`id_customer` = '.(int) $this->customer->id.'
|
||||||
|
AND rep.`score` > 100
|
||||||
|
');
|
||||||
|
|
||||||
|
if ($already_suspect || $already_fraud) {
|
||||||
|
$this->fraud_score += 200;
|
||||||
|
$this->fraud_report[] = 'Compte avec des commandes en suspicion de fraude, fraude non détectée ou commandes frauduleuses (+200)';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function getReputationOrder($id_order) {
|
public static function getReputationOrder($id_order) {
|
||||||
$id_cart = Order::getCartIdStatic($id_order);
|
$id_cart = Order::getCartIdStatic($id_order);
|
||||||
|
Loading…
Reference in New Issue
Block a user