divers ticket

This commit is contained in:
Srv Bebeboutik 2016-01-27 15:59:19 +01:00
parent e9d8e2942a
commit b7fc35d3ae
4 changed files with 1420 additions and 1284 deletions

View File

@ -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'));

File diff suppressed because it is too large Load Diff

View File

@ -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">

View File

@ -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);