fix conflict braderie

This commit is contained in:
Marion Muszynski 2016-04-12 16:15:40 +02:00
commit 9a576cd82d
6 changed files with 88 additions and 41 deletions

View File

@ -1692,12 +1692,6 @@ class AdminProducts extends AdminTab
if ($this->delete)
echo '<p><input type="submit" class="button" name="submitDel'.$this->table.'" value="'.$this->l('Delete selection').'" onclick="return confirm(\''.$this->l('Delete selected items?', __CLASS__, TRUE, FALSE).'\');" /></p>';
if((int)$this->_category->id_parent == 1){
echo '<hr>';
echo '<h2>Ordonner les produits</h2>';
echo '<p><input type="submit" class="button" name="reorder'.$this->table.'" value="'.$this->l('Order products').'" /></p>';
}
echo '<hr>';
$languages = Language::getLanguages(FALSE);
@ -1817,6 +1811,13 @@ class AdminProducts extends AdminTab
</form>';
if (isset($this->_includeTab) AND sizeof($this->_includeTab))
echo '<br /><br />';
if((int)$this->_category->id_parent == 1){
echo '<hr>';
echo '<h2>Ordonner les produits</h2>';
echo '<p><input type="submit" class="button" name="reorder'.$this->table.'" value="'.$this->l('Order products').'" /></p>';
echo '<br /><br />';
}
}

View File

@ -157,8 +157,8 @@ if (!defined('_PS_CACHE_ENABLED_'))
/* Consumable */
if (!defined('_SHOP_CATEGORYROOT'))
define('_SHOP_CATEGORYROOT', 8711761);
define('_SHOP_CATEGORYROOT', 8720307);
if (!defined('_SHOP_CATEGORYENABLED'))
define('_SHOP_CATEGORYENABLED', 1);
if (!defined('_SHOP_PRIVATESALES_CONSUMABLE'))
define('_SHOP_PRIVATESALES_CONSUMABLE', 3963);
define('_SHOP_PRIVATESALES_CONSUMABLE', 5158);

View File

@ -120,7 +120,8 @@ class AdminBraderie extends AdminTab
$("#hidden_attribute_id").val(0);
}
$("#hidden_product_id").val($product_id);
$("#error").empty()
$("#error").empty();
$("#input_storage").focus();
},
error: function(xhr) {
$("#ean_from_product").empty();
@ -145,6 +146,52 @@ class AdminBraderie extends AdminTab
return false;
});
$("#input_storage").change(function(event) {
event.preventDefault();
if ($product_id == undefined || $product_id == 0) {
$("#error").empty().append("'.$this->l('Aucun produit n\'a été trouvé. Vérifier le code EAN').'");
return false;
}
var emplacement = $("#input_storage").val();
if (emplacement.length == 0 || emplacement>205) {
$("#error").empty().append("'.$this->l('L\'emplacement n\'est pas renseigné ou est mal renseigné').'");
return false;
}
if ($("#input_quantity").val().length == 0) {
$("#error").empty().append("'.$this->l('La quantité n\'est pas renseignée').'");
return false;
}
$("#hidden_product_id").val($product_id);
$.ajax({
type: \'POST\',
url: \''._MODULE_DIR_.'braderie/ajax.php?action=addToSellout'.'\',
dataType: \'json\',
data: {
parent_category: $("#sale").val(),
category: $("#category").val(),
storage: $("#input_storage").val(),
product: $("#hidden_product_id").val(),
quantity: $("#input_quantity").val(),
attribute: $("#hidden_attribute_id").val()
},
success: function(response) {
$("#error").empty().append(response);
$("#input_ean, #input_storage").val("");
$("#ean_from_product").empty();
$("#input_ean").focus();
},
error: function(xhr) {
$("#error").empty().append(JSON.parse(xhr.responseText));
}
});
return false;
});
$("#add_button").click(function(event) {
event.preventDefault();
if ($product_id == undefined || $product_id == 0) {

View File

@ -20,7 +20,7 @@ class AdminLabelGenerate extends AdminTab {
$barcode = new GenerateBarcode();
$barcode->createRackFolder();
$rackCodes = array();
for ($i=1;$i<21;$i++) {
for ($i=0;$i<21;$i++) {
for ($j=1;$j<6;$j++) {
$name = $i.$j;
$barcode->generateRack($name);

View File

@ -2,7 +2,6 @@
include_once(_PS_ROOT_DIR_.'/modules/privatesales/Sale.php');
class AdminPrivateSalesSales extends AdminTab {
private $imagelist;
public function __construct() {
@ -232,7 +231,7 @@ class AdminPrivateSalesSales extends AdminTab {
</div>
<div class="clear"></div>
</div>';
echo '<label>'.$this->l('Public sale:').'</label>
<div class="margin-form">
@ -242,7 +241,7 @@ class AdminPrivateSalesSales extends AdminTab {
</div>
<div class="clear"></div>
</div>';
echo '<label>'.$this->l('Braderie :').'</label>
<div class="margin-form">
<div id="public" style="float: left;">
@ -273,10 +272,10 @@ class AdminPrivateSalesSales extends AdminTab {
<div class="clear"></div>
</div>';
echo '<label>'.$this->l('Nouveau :').'</label>
<div class="margin-form">
<div id="new" style="float: left;">
<div id="new" style="float: left;">
<input name="new" type="radio" value="0"'.($this->cursale!==NULL? ($this->cursale->new==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'&nbsp;&nbsp;&nbsp;<input name="new" type="radio" value="1"'.($this->cursale!==NULL && $this->cursale->new==1?' checked="checked"': '').' /> '.$this->l('Oui').'
<sup> *</sup>
</div>
@ -286,7 +285,7 @@ class AdminPrivateSalesSales extends AdminTab {
echo '<label>'.$this->l('Mise en avant newsletter :').'</label>
<div class="margin-form">
<div id="forward_news" style="float: left;">
<div id="forward_news" style="float: left;">
<input name="forward_news" type="radio" value="0"'.($this->cursale!==NULL? ($this->cursale->forward_news==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'&nbsp;&nbsp;&nbsp;<input name="forward_news" type="radio" value="1"'.($this->cursale!==NULL && $this->cursale->forward_news==1?' checked="checked"': '').' /> '.$this->l('Oui').'
<sup> *</sup>
</div>
@ -428,19 +427,19 @@ class AdminPrivateSalesSales extends AdminTab {
// echo '<label>'.$this->l('Sale type:').'</label>
// <div class="margin-form">
// <div id="carriers" style="float: left;">
// <div id="carriers" style="float: left;">
// '.$this->l('SALETYPE1').' <input '. (isset($this->cursale->sale_type) && in_array(1,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="1">
// '.$this->l('SALETYPE2').' <input '. (isset($this->cursale->sale_type) && in_array(2,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="2">
// '.$this->l('SALETYPE3').' <input '. (isset($this->cursale->sale_type) && in_array(3,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="3">
// </div>
// </div>';
echo '<label>'.$this->l('Description:').'</label>
<div class="margin-form">';
foreach($this->_languages as $language) {
echo '<div id="description_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
<textarea style="width: 500px; height: 150px;" name="description_'.$language['id_lang'].'">';
if($this->cursale !== NULL) {
if($this->cursale !== NULL) {
echo htmlentities($this->cursale->description[$language['id_lang']]);
// echo htmlentities(utf8_decode($this->cursale->description[$language['id_lang']]));
}
@ -480,7 +479,7 @@ class AdminPrivateSalesSales extends AdminTab {
echo '<div class="clear"></div>
</div>';
}
Module::hookExec('privatesales_edit', array('sale' => $this->cursale));
echo '<br class="clear" />
@ -498,14 +497,14 @@ class AdminPrivateSalesSales extends AdminTab {
global $cookie, $currentIndex;
$this->cursale = NULL;
if($id = Tools::getValue('id')) {
$this->cursale = new Sale($id);
$this->cursale = new Sale($id);
if($this->cursale->id === NULL) {
Tools::redirectAdmin($currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales'));
}
}
// // ANTADIS INSERT TYPE
// $ventes = Sale::getSales(NULL, NULL, NULL, NULL , FALSE, FALSE, 'position ASC');
// $ventes = Sale::getSales(NULL, NULL, NULL, NULL , FALSE, FALSE, 'position ASC');
// foreach ($ventes as $key => $vente) {
// global $cookie;
// if($cookie->id_employee == 1){
@ -515,7 +514,7 @@ class AdminPrivateSalesSales extends AdminTab {
// ), 'INSERT');
// }
// }
$this->displayForm();
$export = Module::isInstalled('exports');
@ -527,7 +526,7 @@ class AdminPrivateSalesSales extends AdminTab {
') as $row) {
$employees[(int) $row['id_employee']] = $row['firstname'].' '.$row['lastname'];
}
//ANTADIS
echo '<fieldset style="margin-top:15px">';
echo '<legend>Tri des ventes</legend>';
@ -535,7 +534,7 @@ class AdminPrivateSalesSales extends AdminTab {
echo '<input type="submit" value="Ventes terminées" name="finished" class="tri button">';
echo '<input type="submit" value="Toutes les ventes" name="all" class="tri button">';
echo '</fieldset>';
?>
<script>
jQuery( document ).ready(function( $ ) {
@ -547,10 +546,10 @@ class AdminPrivateSalesSales extends AdminTab {
button.removeClass('active');
$(this).addClass('active');
$('.list_vente').empty();
var loader = "<p class='text-align:center'><img src='../img/loader.gif' /></p>";
$('.list_vente').html(loader);
$.ajax({
url: "ajax_vp.php",
type: 'GET',
@ -564,10 +563,10 @@ class AdminPrivateSalesSales extends AdminTab {
});
$(".updatePosition").live( "click", function(e) {
e.preventDefault();
e.preventDefault();
var position = $(this).attr('data-position');
var way = $(this).attr('data-way');
$.ajax({
url: "ajax_vp.php",
type: 'GET',
@ -582,7 +581,7 @@ class AdminPrivateSalesSales extends AdminTab {
$('.list_vente').empty();
$('.list_vente').html(html);
}
});
});
}
});
@ -676,8 +675,8 @@ class AdminPrivateSalesSales extends AdminTab {
$ids[] = $sale->id;
}
$extrafields = PrivateSales_ExtraFields::getFieldsForSale($ids);
foreach($sales as $key => $sale) {
foreach($sales as $key => $sale) {
echo '<tr id="item_'.$sale->id. '" class="sale_'.($key%2).'">
<td>'.$sale->id.'</td>
<td><strong>'.$sale->title[intval($cookie->id_lang)].'</strong><br/><span style="color:#666; font-style:italic">'.$extrafields[$sale->id][1].'</span></td>
@ -695,7 +694,7 @@ class AdminPrivateSalesSales extends AdminTab {
else if($sale->new == 3){
echo "<td>".$this->l('Non défini')."</td>";
}
echo '<td>'.((int) $sale->id_employee != 0? $employees[(int) $sale->id_employee]: '--').'</td>
<td '.(in_array('fr', $sale->versions) ? 'class="green"' : 'class="red"').'>FR</td>
<td '.(in_array('es', $sale->versions) ? 'class="green"' : 'class="red"').'>ES</td>
@ -709,12 +708,12 @@ class AdminPrivateSalesSales extends AdminTab {
if($key + 1 != count($sales)){
echo '<a href="" class="updatePosition" data-way="1" data-position='. $sale->position .'><img title="Bas" alt="Bas" src="../img/admin/down.gif"></a>';
}
$category_link = Link::getCategoryLink($sale->id_category);
$category_link = Link::getCategoryLink($sale->id_category);
echo '</td>
<td>
'.($export? '<a onclick="window.open(this.href); return false;" href="'.__PS_BASE_URI__.'modules/exports/exports/privatesales.php?id_sale='.$sale->id.'&amp;adtoken='.Tools::encrypt('PrivateSalesDirectExtract'.$sale->id).'"><img style="cursor: pointer;" title="Exporter cette vente" alt="" src="../img/admin/export.gif"></a>': '').'
<img style="cursor: pointer;" onclick="itemEdition('.$sale->id.')" title="Éditer cette vente" alt="" src="../img/admin/edit.gif">
<img style="cursor: pointer;" onclick="itemDeletion('.$sale->id.')" title="Supprimer cette vente" alt="" src="../img/admin/delete.gif">
<img style="cursor: pointer;" onclick="itemDeletion('.$sale->id.')" title="Supprimer cette vente" alt="" src="../img/admin/delete.gif">
<a href="'.$category_link.'" target="_blank">
<img style="cursor: pointer;" title="Voir cette vente" alt="" src="../img/admin/details.gif">
</a>
@ -754,7 +753,7 @@ class AdminPrivateSalesSales extends AdminTab {
if (Sale::getSaleFromCategory(Tools::getValue('id_category'))) {
return false;
}
$sql_position = 'SELECT MAX(position) FROM '. _DB_PREFIX_.'privatesale';
$position = Db::getInstance()->getValue($sql_position);
@ -777,7 +776,7 @@ class AdminPrivateSalesSales extends AdminTab {
foreach(Tools::getValue('sale_type', array()) as $sale_type) {
$sale->sale_type[] = (int) $sale_type;
}
foreach(Language::getLanguages(FALSE) as $language) {
if($description = Tools::getValue('description_'.$language['id_lang'])) {
$sale->description[$language['id_lang']] = $description;
@ -809,7 +808,7 @@ class AdminPrivateSalesSales extends AdminTab {
$sale->save();
$sale->buildCategoryCache();
if( empty($sale->carriers)) {
mail('valentin@bebeboutik.com', 'Vente sans transporteur',
'La vente '. $sale->id.' est sans transporteur',
@ -879,7 +878,7 @@ class AdminPrivateSalesSales extends AdminTab {
echo '<div class="error alert">'.Tools::displayError($this->l('Impossible d\'éditer une vente sans transporteur.')).'</div>';
exit;
}
$sale->save();
$sale->buildCategoryCache();

View File

@ -411,7 +411,7 @@ class Sale {
return $orders;
}
public function getMultiForStats($orders = array(), $nb_sale, $strict = false)
public function getMultiForStats($orders = array(), $nb_sale, $strict = false)
{
$products = $this->getProducts();