Merge branch 'evo-philea-Destock' into develop

This commit is contained in:
Marion Muszynski 2017-01-02 11:34:32 +01:00
commit fee10ec7af
12 changed files with 1214 additions and 61 deletions

View File

@ -16,6 +16,7 @@ class HelperFormBootstrap{
public $_select2;
public $_inputMask;
public $_inputSwitch;
public $_inputWizard;
public $_inputTag;
public $_dateTime;
@ -30,6 +31,7 @@ class HelperFormBootstrap{
$this->_select2 = false;
$this->_inputMask = false;
$this->_inputSwitch = false;
$this->_inputWizard = false;
$this->_inputTag = false;
$this->_dateTime = false;
}
@ -63,6 +65,9 @@ class HelperFormBootstrap{
if ($this->_inputSwitch) {
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/switchery.min.js"></script>';
}
if ($this->_inputWizard) {
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/jquery.smartWizard.js"></script>';
}
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/js/custom.js"></script>';
$this->_script .= $this->_js;
return $this->_script;
@ -584,13 +589,21 @@ class HelperFormBootstrap{
}
public function inputButton($p = array()){
public function inputButtonLink($p = array()){
$css = isset($p['css']) && $p['css'] ? $p['css'] : false;
$class = isset($p['css']) && $p['css'] ? $p['css'] : false;
$this->_html .= '
<a '.($css ? 'style="'.$css.'"' : '').' href="'.$p['action'].'" class="button" name="'.$p['name'].'">'.$p['label'].'</a>
';
}
public function inputButton($p = array()){
$label = isset($p['label']) && $p['label'] ? $p['label'] : false;
$css = isset($p['css']) && $p['css'] ? $p['css'] : false;
$class = isset($p['class']) && $p['class'] ? $p['class'] : false;
$this->_html .= '
<button '.($css ? 'style="'.$css.'"' : '').' type="submit" class="btn '.($class ? $class : '').'" name="'.$p['name'].'">'.$p['value'].'</button>
';
}
public function inputSubmit($p = array()){
$label = isset($p['label']) && $p['label'] ? $p['label'] : false;
$css = isset($p['css']) && $p['css'] ? $p['css'] : false;

View File

@ -36,27 +36,53 @@ ul#menu li a {
.row {
background: none;
}
/* button */
a, a:hover{
text-decoration: none;
}
a,
a:visited,
a:focus,
a:active,
:visited,
:focus,
:active,
.btn:focus,
.btn:active:focus,
.btn.active:focus,
.btn.focus,
.btn:active.focus,
.btn.active.focus{
outline: 0;
}
.btn-primary {
background: #504d8b;
border-color: #504d8b;
}
border-color: #504d8b;}
.btn-primary:hover {
background: #796dc7;
border-color: #796dc7;
}
border-color: #796dc7;}
.btn-primary.active,
.btn-primary:active,
.open>.dropdown-toggle.btn-primary {
.open .dropdown-toggle.btn-primary {
color: #fff;
background: #796dc7;
border-color: #796dc7;
}
border-color: #796dc7;}
.btn-primary.focus,
.btn-primary:focus {
color: #fff;
background: #504d8b;
border-color: #504d8b;
}
border-color: #504d8b;}
.btn-success {
background: #26B99A;
border: 1px solid #169F85;}
.btn-success:hover,
.btn-success:focus,
.btn-success:active,
.btn-success.active,
.open .dropdown-toggle.btn-success {
background: #169F85;}
h2 {
font-size: 18px;
@ -80,7 +106,6 @@ form label{
/*background: rgba(86,84,133,1);
color: #fff;*/
}
.panel {
position: relative;
width: 100%;
@ -123,6 +148,16 @@ form label{
.panel-title h2 small {
margin-left: 10px;
}
.navbar-right {margin-right:-5px;}
.panel-toolbox>li>a {
cursor: pointer;
padding: 8px;
color: #C5C7CB;
font-size: 14px;
}
.panel-toolbox>li>a:hover {
background: #F5F7FA;
}
.panel-content {
padding: 0 5px;
position: relative;
@ -184,11 +219,35 @@ div.tagsinput span.tag a {
border: 1px solid transparent;
border-radius: 4px;
}
#content .alert-custom {
padding: 5px;
}
#content .alert-custom span.text-alert{
display: inline-block;
vertical-align: middle;
width: calc(100% - 55px);
}
#content .alert-custom i.glyphicon,
#content .alert-custom span.glyphicon,
#content .alert-custom i.anticon,
#content .alert-custom span.anticon{
display: inline-block;
margin-right: 5px;
vertical-align: middle;
font-size: 45px;
opacity: 0.3;
}
#content .alert-success {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
#content .alert-ok{
color: #fff;
background-color: #1ABB9C;
border: 1px solid #169F85;
}
/* form */
.form-control {
@ -246,6 +305,9 @@ table.table tr th {
background: #504d8b;
color: #fff;
}
.table tr td {
color: #000;
}
/* Select2 */
.select2-results ul li{
@ -254,4 +316,90 @@ table.table tr th {
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #504d8b;
color: white;
}
}
/* Smart Wizar */
.form_wizard .stepContainer {
display: block;
position: relative;
margin: 0;
padding: 0;
border: 0 solid #CCC;
overflow-x: hidden; }
.wizard_horizontal ul.wizard_steps {
display: table;
list-style: none;
position: relative;
width: 100%;
margin: 0 0 20px;
padding:0; }
.wizard_horizontal ul.wizard_steps li {
display: table-cell;
text-align: center; }
.wizard_horizontal ul.wizard_steps li a,
.wizard_horizontal ul.wizard_steps li:hover {
display: block;
position: relative;
-moz-opacity: 1;
filter: alpha(opacity=100);
opacity: 1;
color: #666; }
.wizard_horizontal ul.wizard_steps li a:before {
content: "";
position: absolute;
height: 4px;
background: #ccc;
top: 20px;
width: 100%;
z-index: 4;
left: 0; }
.wizard_horizontal ul.wizard_steps li a.disabled .step_no {
background: #ccc; }
.wizard_horizontal ul.wizard_steps li a .step_no {
width: 40px;
height: 40px;
line-height: 40px;
border-radius: 100px;
display: block;
margin: 0 auto 5px;
font-size: 16px;
text-align: center;
position: relative;
z-index: 5; }
.wizard_horizontal ul.wizard_steps li a.selected:before,
.step_no {
background: #504d8b;
color: #fff; }
.wizard_horizontal ul.wizard_steps li a.done:before,
.wizard_horizontal ul.wizard_steps li a.done .step_no {
background: #1ABB9C;
color: #fff; }
.wizard_horizontal ul.wizard_steps li:first-child a:before {
left: 50%; }
.wizard_horizontal ul.wizard_steps li:last-child a:before {
right: 50%;
width: 50%;
left: auto; }
.form_wizard h2.StepTitle{
text-align:center;
color: #504d8b;
text-transform: uppercase;
}
.actionBar {
width: 100%;
border-top: 1px solid #ddd;
padding: 10px 5px;
text-align: right;
margin-top: 10px; }
.actionBar .buttonDisabled {
cursor: not-allowed;
pointer-events: none;
opacity: .65;
filter: alpha(opacity=65);
box-shadow: none; }
.actionBar a {
margin: 0 3px; }
.form_wizard .loader {
display: none; }
.form_wizard .msgBox {
display: none; }

View File

@ -0,0 +1,459 @@
/*
* SmartWizard 3.3.1 plugin
* jQuery Wizard control Plugin
* by Dipu
*
* Refactored and extended:
* https://github.com/mstratman/jQuery-Smart-Wizard
*
* Original URLs:
* http://www.techlaboratory.net
* http://tech-laboratory.blogspot.com
*/
function SmartWizard(target, options) {
this.target = target;
this.options = options;
this.curStepIdx = options.selected;
this.steps = $(target).children("ul").children("li").children("a"); // Get all anchors
this.contentWidth = 0;
this.msgBox = $('<div class="msgBox"><div class="content"></div><a href="#" class="close">X</a></div>');
this.elmStepContainer = $('<div></div>').addClass("stepContainer");
this.loader = $('<div class="text-center"><img src="../img/loader_payment.gif" /></div>').addClass("loader");
this.buttons = {
next : $('<a>'+options.labelNext+'</a>').attr("href","#").addClass("buttonNext btn btn-primary"),
previous : $('<a>'+options.labelPrevious+'</a>').attr("href","#").addClass("buttonPrevious btn btn-success"),
finish : $('<a>'+options.labelFinish+'</a>').attr("href","#").addClass("buttonFinish btn btn-default")
};
/*
* Private functions
*/
var _init = function($this) {
var elmActionBar = $('<div></div>').addClass("actionBar");
elmActionBar.append($this.msgBox);
$('.close',$this.msgBox).click(function() {
$this.msgBox.fadeOut("normal");
return false;
});
var allDivs = $this.target.children('div');
$this.target.children('ul').addClass("anchor");
allDivs.addClass("content");
// highlight steps with errors
if($this.options.errorSteps && $this.options.errorSteps.length>0){
$.each($this.options.errorSteps, function(i, n){
$this.setError({ stepnum: n, iserror:true });
});
}
$this.elmStepContainer.append(allDivs).append($this.loader);
$this.target.append($this.elmStepContainer);
elmActionBar.append($this.buttons.previous)
.append($this.buttons.next)
.append($this.buttons.finish);
$this.target.append(elmActionBar);
this.contentWidth = $this.elmStepContainer.width();
$($this.buttons.next).click(function() {
$this.goForward();
return false;
});
$($this.buttons.previous).click(function() {
$this.goBackward();
return false;
});
$($this.buttons.finish).click(function() {
if(!$(this).hasClass('buttonDisabled')){
if($.isFunction($this.options.onFinish)) {
var context = { fromStep: $this.curStepIdx + 1 };
if(!$this.options.onFinish.call(this,$($this.steps), context)){
return false;
}
}else{
var frm = $this.target.parents('form');
if(frm && frm.length){
frm.submit();
}
}
}
return false;
});
$($this.steps).bind("click", function(e){
if($this.steps.index(this) == $this.curStepIdx){
return false;
}
var nextStepIdx = $this.steps.index(this);
var isDone = $this.steps.eq(nextStepIdx).attr("isDone") - 0;
if(isDone == 1){
_loadContent($this, nextStepIdx);
}
return false;
});
// Enable keyboard navigation
if($this.options.keyNavigation){
$(document).keyup(function(e){
if(e.which==39){ // Right Arrow
$this.goForward();
}else if(e.which==37){ // Left Arrow
$this.goBackward();
}
});
}
// Prepare the steps
_prepareSteps($this);
// Show the first selected step
_loadContent($this, $this.curStepIdx);
};
var _prepareSteps = function($this) {
if(! $this.options.enableAllSteps){
$($this.steps, $this.target).removeClass("selected").removeClass("done").addClass("disabled");
$($this.steps, $this.target).attr("isDone",0);
}else{
$($this.steps, $this.target).removeClass("selected").removeClass("disabled").addClass("done");
$($this.steps, $this.target).attr("isDone",1);
}
$($this.steps, $this.target).each(function(i){
$($(this).attr("href").replace(/^.+#/, '#'), $this.target).hide();
$(this).attr("rel",i+1);
});
};
var _step = function ($this, selStep) {
return $(
$(selStep, $this.target).attr("href").replace(/^.+#/, '#'),
$this.target
);
};
var _loadContent = function($this, stepIdx) {
var curStep = $this.steps.eq($this.curStepIdx);
if(stepIdx != $this.curStepIdx){
if($.isFunction($this.options.beforeLoadContent)) {
var context = { fromStep: $this.curStepIdx+1, toStep: stepIdx+1 };
if (! $this.options.beforeLoadContent.call($this,$(curStep), context)){
return false;
}
}
}
var selStep = $this.steps.eq(stepIdx);
var ajaxurl = $this.options.contentURL;
var ajaxurl_data = $this.options.contentURLData;
var hasContent = selStep.data('hasContent');
var stepNum = stepIdx+1;
$this.options.ajaxData.step_number = stepNum;
var datas = $this.options.ajaxData;
if (ajaxurl && ajaxurl.length>0) {
if ($this.options.contentCache && hasContent) {
_showStep($this, stepIdx);
} else {
var ajax_args = {
url: ajaxurl,
type: "POST",
data: datas,
dataType: "text",
beforeSend: function(){
$this.loader.show();
},
error: function(){
$this.loader.hide();
},
success: function(res){
$this.loader.hide();
if(res && res.length>0){
selStep.data('hasContent',true);
_step($this, selStep).html(res);
_showStep($this, stepIdx);
}
}
};
if (ajaxurl_data) {
ajax_args = $.extend(ajax_args, ajaxurl_data(stepNum));
}
$.ajax(ajax_args);
}
}else{
_showStep($this,stepIdx);
}
};
var _showStep = function($this, stepIdx) {
var selStep = $this.steps.eq(stepIdx);
var curStep = $this.steps.eq($this.curStepIdx);
if(stepIdx != $this.curStepIdx){
if($.isFunction($this.options.onLeaveStep)) {
var context = { fromStep: $this.curStepIdx+1, toStep: stepIdx+1 };
if (! $this.options.onLeaveStep.call($this,$(curStep), context)){
return false;
}
}
}
$this.elmStepContainer.height(_step($this, selStep).outerHeight());
var prevCurStepIdx = $this.curStepIdx;
$this.curStepIdx = stepIdx;
if ($this.options.transitionEffect == 'slide'){
_step($this, curStep).slideUp("fast",function(e){
_step($this, selStep).slideDown("fast");
_setupStep($this,curStep,selStep);
});
} else if ($this.options.transitionEffect == 'fade'){
_step($this, curStep).fadeOut("fast",function(e){
_step($this, selStep).fadeIn("fast");
_setupStep($this,curStep,selStep);
});
} else if ($this.options.transitionEffect == 'slideleft'){
var nextElmLeft = 0;
var nextElmLeft1 = null;
var nextElmLeft = null;
var curElementLeft = 0;
if(stepIdx > prevCurStepIdx){
nextElmLeft1 = $this.contentWidth + 10;
nextElmLeft2 = 0;
curElementLeft = 0 - _step($this, curStep).outerWidth();
} else {
nextElmLeft1 = 0 - _step($this, selStep).outerWidth() + 20;
nextElmLeft2 = 0;
curElementLeft = 10 + _step($this, curStep).outerWidth();
}
if (stepIdx == prevCurStepIdx) {
nextElmLeft1 = $($(selStep, $this.target).attr("href"), $this.target).outerWidth() + 20;
nextElmLeft2 = 0;
curElementLeft = 0 - $($(curStep, $this.target).attr("href"), $this.target).outerWidth();
} else {
$($(curStep, $this.target).attr("href"), $this.target).animate({left:curElementLeft},"fast",function(e){
$($(curStep, $this.target).attr("href"), $this.target).hide();
});
}
_step($this, selStep).css("left",nextElmLeft1).show().animate({left:nextElmLeft2},"fast",function(e){
_setupStep($this,curStep,selStep);
});
} else {
_step($this, curStep).hide();
_step($this, selStep).show();
_setupStep($this,curStep,selStep);
}
return true;
};
var _setupStep = function($this, curStep, selStep) {
$(curStep, $this.target).removeClass("selected");
$(curStep, $this.target).addClass("done");
$(selStep, $this.target).removeClass("disabled");
$(selStep, $this.target).removeClass("done");
$(selStep, $this.target).addClass("selected");
$(selStep, $this.target).attr("isDone",1);
_adjustButton($this);
if($.isFunction($this.options.onShowStep)) {
var context = { fromStep: parseInt($(curStep).attr('rel')), toStep: parseInt($(selStep).attr('rel')) };
if(! $this.options.onShowStep.call(this,$(selStep),context)){
return false;
}
}
if ($this.options.noForwardJumping) {
// +2 == +1 (for index to step num) +1 (for next step)
for (var i = $this.curStepIdx + 2; i <= $this.steps.length; i++) {
$this.disableStep(i);
}
}
};
var _adjustButton = function($this) {
if (! $this.options.cycleSteps){
if (0 >= $this.curStepIdx) {
$($this.buttons.previous).addClass("buttonDisabled");
if ($this.options.hideButtonsOnDisabled) {
$($this.buttons.previous).hide();
}
}else{
$($this.buttons.previous).removeClass("buttonDisabled");
if ($this.options.hideButtonsOnDisabled) {
$($this.buttons.previous).show();
}
}
if (($this.steps.length-1) <= $this.curStepIdx){
$($this.buttons.next).addClass("buttonDisabled");
if ($this.options.hideButtonsOnDisabled) {
$($this.buttons.next).hide();
}
}else{
$($this.buttons.next).removeClass("buttonDisabled");
if ($this.options.hideButtonsOnDisabled) {
$($this.buttons.next).show();
}
}
}
// Finish Button
if (! $this.steps.hasClass('disabled') || $this.options.enableFinishButton){
$($this.buttons.finish).removeClass("buttonDisabled");
if ($this.options.hideButtonsOnDisabled) {
$($this.buttons.finish).show();
}
}else{
$($this.buttons.finish).addClass("buttonDisabled");
if ($this.options.hideButtonsOnDisabled) {
$($this.buttons.finish).hide();
}
}
};
/*
* Public methods
*/
SmartWizard.prototype.goForward = function(){
var nextStepIdx = this.curStepIdx + 1;
if (this.steps.length <= nextStepIdx){
if (! this.options.cycleSteps){
return false;
}
nextStepIdx = 0;
}
_loadContent(this, nextStepIdx);
};
SmartWizard.prototype.goBackward = function(){
var nextStepIdx = this.curStepIdx-1;
if (0 > nextStepIdx){
if (! this.options.cycleSteps){
return false;
}
nextStepIdx = this.steps.length - 1;
}
_loadContent(this, nextStepIdx);
};
SmartWizard.prototype.goToStep = function(stepNum){
var stepIdx = stepNum - 1;
if (stepIdx >= 0 && stepIdx < this.steps.length) {
_loadContent(this, stepIdx);
}
};
SmartWizard.prototype.enableStep = function(stepNum) {
var stepIdx = stepNum - 1;
if (stepIdx == this.curStepIdx || stepIdx < 0 || stepIdx >= this.steps.length) {
return false;
}
var step = this.steps.eq(stepIdx);
$(step, this.target).attr("isDone",1);
$(step, this.target).removeClass("disabled").removeClass("selected").addClass("done");
}
SmartWizard.prototype.disableStep = function(stepNum) {
var stepIdx = stepNum - 1;
if (stepIdx == this.curStepIdx || stepIdx < 0 || stepIdx >= this.steps.length) {
return false;
}
var step = this.steps.eq(stepIdx);
$(step, this.target).attr("isDone",0);
$(step, this.target).removeClass("done").removeClass("selected").addClass("disabled");
}
SmartWizard.prototype.currentStep = function() {
return this.curStepIdx + 1;
}
SmartWizard.prototype.showMessage = function (msg) {
$('.content', this.msgBox).html(msg);
this.msgBox.show();
}
SmartWizard.prototype.hideMessage = function () {
this.msgBox.fadeOut("normal");
}
SmartWizard.prototype.showError = function(stepnum) {
this.setError(stepnum, true);
}
SmartWizard.prototype.hideError = function(stepnum) {
this.setError(stepnum, false);
}
SmartWizard.prototype.setError = function(stepnum,iserror) {
if (typeof stepnum == "object") {
iserror = stepnum.iserror;
stepnum = stepnum.stepnum;
}
if (iserror){
$(this.steps.eq(stepnum-1), this.target).addClass('error')
}else{
$(this.steps.eq(stepnum-1), this.target).removeClass("error");
}
}
SmartWizard.prototype.fixHeight = function(){
var height = 0;
var selStep = this.steps.eq(this.curStepIdx);
var stepContainer = _step(this, selStep);
stepContainer.children().each(function() {
height += $(this).outerHeight();
});
// These values (5 and 20) are experimentally chosen.
stepContainer.height(height + 5);
this.elmStepContainer.height(height + 20);
}
_init(this);
};
(function($){
$.fn.smartWizard = function(method) {
var args = arguments;
var rv = undefined;
var allObjs = this.each(function() {
var wiz = $(this).data('smartWizard');
if (typeof method == 'object' || ! method || ! wiz) {
var options = $.extend({}, $.fn.smartWizard.defaults, method || {});
if (! wiz) {
wiz = new SmartWizard($(this), options);
$(this).data('smartWizard', wiz);
}
} else {
if (typeof SmartWizard.prototype[method] == "function") {
rv = SmartWizard.prototype[method].apply(wiz, Array.prototype.slice.call(args, 1));
return rv;
} else {
$.error('Method ' + method + ' does not exist on jQuery.smartWizard');
}
}
});
if (rv === undefined) {
return allObjs;
} else {
return rv;
}
};
// Default Properties and Events
$.fn.smartWizard.defaults = {
selected: 0, // Selected Step, 0 = first step
keyNavigation: true, // Enable/Disable key navigation(left and right keys are used if enabled)
enableAllSteps: false,
transitionEffect: 'fade', // Effect on navigation, none/fade/slide/slideleft
contentURL:null, // content url, Enables Ajax content loading
contentCache:true, // cache step contents, if false content is fetched always from ajax url
cycleSteps: false, // cycle step navigation
enableFinishButton: false, // make finish button enabled always
hideButtonsOnDisabled: false, // when the previous/next/finish buttons are disabled, hide them instead?
errorSteps:[], // Array Steps with errors
labelNext:'Next',
labelPrevious:'Previous',
labelFinish:'Finish',
noForwardJumping: false,
onLeaveStep: null, // triggers when leaving a step
onShowStep: null, // triggers when showing a step
onFinish: null // triggers when Finish button is clicked
};
})(jQuery);

View File

@ -81,6 +81,55 @@ class AdminAntConfigurations extends AdminTab
} elseif(Tools::isSubmit('submitUpdateLoyaltyOrders') && $cookie->id_employee == 1) {
$nb_credits = $this->updateLoyaltyOrders();
HelperFormBootstrap::echoConfirmation($this->l('Credit fidélité mis à jour : ').$nb_credits);
} elseif(
(Tools::isSubmit('submitUpdateCacheSale') || Tools::isSubmit('submitShowProductCacheSale'))
&& $cookie->id_employee == 1)
{
$id_category = Tools::getValue('id_category');
if($id_category) {
$products_ids = array();
foreach(Db::getInstance()->ExecuteS('
SELECT p.id_product
FROM `ps_product` p
WHERE p.`id_category_default` = '.$id_category.'
') as $row) {
$products_ids[(int)$row['id_product']] = (int)$row['id_product'];
}
if(count($products_ids)>0) {
if(Tools::isSubmit('submitShowProductCacheSale')) {
// show product
$result = implode(', ',$products_ids);
HelperFormBootstrap::echoConfirmation($this->l('Produits concernés ').'('.count($products_ids).') :<br />'.wordwrap($result, 100, "<br />"));
} elseif(Tools::isSubmit('submitUpdateCacheSale')) {
// update product_ps_cache
Db::getInstance()->ExecuteS('
DELETE FROM `'._DB_PREFIX_.'product_ps_cache`
WHERE `id_product` IN ('.implode(',',$products_ids).')
');
Db::getInstance()->ExecuteS('
INSERT IGNORE INTO `'._DB_PREFIX_.'product_ps_cache` (
SELECT p.id_product, IFNULL(
(
SELECT s.id_sale
FROM `'._DB_PREFIX_.'privatesale_category` s
WHERE s.`id_category` = p.`id_category_default`
LIMIT 1)
, 0
)
FROM `ps_product` p
WHERE p.`id_category_default` = '.$id_category.'
)
');
HelperFormBootstrap::echoConfirmation($this->l('Association vente produit mise à jour: #').$id_category);
}
} else{
HelperFormBootstrap::echoError($this->l('Pas de produits trouvés dans cette catégorie :#').$id_category);
}
} else {
HelperFormBootstrap::echoError($this->l('Veuillez choisir une categorie'));
}
}
}
@ -131,6 +180,7 @@ class AdminAntConfigurations extends AdminTab
</style>';
$id_sale_options = array();
$id_category_options = array();
foreach(Db::getInstance()->ExecuteS('
SELECT p.`id_sale`, c.`name`, c.`id_category`
FROM `'._DB_PREFIX_.'privatesale` p
@ -144,6 +194,10 @@ class AdminAntConfigurations extends AdminTab
'label' => (int) $row['id_sale'].' - '.$row['name'].(empty($extrafields[(int) $row['id_category']]['sales'][1])?'':' - '.$extrafields[(int) $row['id_category']]['sales'][1]) ,
'value' => (int) $row['id_sale']
);
$id_category_options[] = array(
'label' => (int) $row['id_sale'].' (#'.(int) $row['id_category'].') - '.$row['name'].(empty($extrafields[(int) $row['id_category']]['sales'][1])?'':' - '.$extrafields[(int) $row['id_category']]['sales'][1]) ,
'value' => (int) $row['id_category']
);
}
$helperForm = new HelperFormBootstrap();
@ -209,7 +263,7 @@ class AdminAntConfigurations extends AdminTab
'sections' => array(
array(
'class' => 'col-md-6',
//'title' => $this->l('Mettre à jour les crédit fidélité'),
'title' => $this->l('Actions diverses'),
'inputs' => array(
array(
'type' => 'submit',
@ -220,6 +274,34 @@ class AdminAntConfigurations extends AdminTab
),
),
),
array(
'class' => 'col-md-6',
'title' => $this->l('Mettre à jour PS Cache'),
'inputs' => array(
array(
'label' => $this->l('PS Cache : '),
'type' => 'select2',
'class-select' => '',
'name' => 'id_category',
'options' => $id_category_options,
),
),
'actions' => array(
array(
'type' => 'submit',
'class' => 'btn-default',
'name' => 'submitShowProductCacheSale',
'value' => $this->l('Voir'),
),
array(
'type' => 'submit',
'class' => 'btn-primary',
'name' => 'submitUpdateCacheSale',
'value' => $this->l('Ré-Associer'),
),
),
'actions-class' => 'text-right',
),
),
);
}

View File

@ -3,9 +3,9 @@ if(!defined('_PS_VERSION_')) {
exit;
}
include_once(_PS_ROOT_DIR_.'/modules/privatesales/Sale.php');
include_once(_PS_ROOT_DIR_.'/modules/categoryfamily/models/CategoryFamily.php');
require_once(PS_ADMIN_DIR . '/helpers/HelperFormBootstrap.php');
require_once(PS_ADMIN_DIR . '/helpers/HelperList.php');
require_once(_PS_ROOT_DIR_.'/modules/categoryfamily/models/CategoryFamily.php');
class AdminAntCreationcategories extends AdminTab
{

View File

@ -1,5 +1,5 @@
<?php
require dirname(__FILE__).'/models/CategoryFamily.php';
require_once dirname(__FILE__).'/models/CategoryFamily.php';
class CategoryFamily extends Module {

View File

@ -32,6 +32,62 @@ class AdminLabelGenerate extends AdminTab {
if (glob(_PS_MODULE_DIR_.'labelgenerate/img/rack/rack.pdf')) {
$this->_html .= '<p class="conf">Rack générés : <a target="_blank" href="/modules/labelgenerate/img/rack/rack.pdf">Télécharger le PDF rack</a></p>';
}
} elseif ($current_sale && Tools::getValue('generateRef')) {
$sale = new Sale((int)$current_sale);
if(!Validate::isLoadedObject($sale)) {
throw new Exception('This sale doesnt exist');
} else {
$products = $sale->getProducts();
$products_generate = array();
$barcode = new GenerateBarcode();
$barcode->id_sale = $sale->id;
$barcode->createFolder($barcode->id_sale);
foreach ($products as $key => $id_product) {
$product = new Product($id_product, FALSE, (int) $cookie->id_lang);
$attributes = array();
$combinations = $product->getAttributeCombinaisons($cookie->id_lang);
if ($combinations) {
foreach ($combinations as $key => $combination) {
$result_quantities = Db::getInstance()->executeS('
SELECT od.`product_quantity`,od.`product_quantity_reinjected`
FROM '._DB_PREFIX_.'order_detail od
WHERE od.`product_id` = ' . (int)$combination['id_product'] .'
AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute']
);
$quantity = 0;
foreach ($result_quantities as $od) {
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
}
if ($quantity>0) {
$barcode->assocProduct($combination['id_product'], $combination['id_product_attribute'], $quantity, $product->reference);
}
}
} else {
$result_quantities = Db::getInstance()->executeS('
SELECT od.`product_quantity`,od.`product_quantity_reinjected`
FROM '._DB_PREFIX_.'order_detail od
WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0'
);
$quantity = 0;
foreach ($result_quantities as $od) {
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
}
if ($quantity>0) {
$barcode->assocProduct($product->id, NULL, $quantity, $product->reference);
}
}
}
if (glob(_PS_MODULE_DIR_.'labelgenerate/img/'.$barcode->id_sale.'/reference.pdf')) {
$this->_html .= '<p class="conf">Dernières ref générées : <a target="_blank" href="/modules/labelgenerate/img/'.$barcode->id_sale.'/reference.pdf">Télécharger le PDF</a></p>';
} else {
$barcode->printPDF(true);
$this->_html .= '<p class="conf">Génération terminée : <a target="_blank" href="/modules/labelgenerate/img/'.$barcode->id_sale.'/reference.pdf">Télécharger le PDF</a></p>';
}
}
} elseif ($current_sale && Tools::getValue('deleteEAN')) {
$sale = new Sale((int)$current_sale);
@ -267,6 +323,10 @@ class AdminLabelGenerate extends AdminTab {
</select>
<br class="clear"/>
<br class="clear"/>
<div style="text-align:center">
<button class="button" id="generateRef" style="display:inline-block">Générer les Ref pour tous les produits vendus</button>
</div>
<br class="clear"/>
<div style="text-align:center">
<button class="button" id="generateEAN" style="display:inline-block">Générer les EANs pour produits vendus</button>
</div>
@ -307,7 +367,7 @@ class AdminLabelGenerate extends AdminTab {
);
$(".chosen-select").chosen().change( function() {});
$("#generateEAN").click(function(){
if ($(".chosen-select").val() != 999999) {
$(\'#category_selector\').hide();
@ -315,6 +375,13 @@ class AdminLabelGenerate extends AdminTab {
}
});
$("#generateRef").click(function(){
if ($(".chosen-select").val() != 999999) {
$(\'#category_selector\').hide();
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&generateRef=1&id_sale=\' + $(".chosen-select").val();
}
});
$("#generateALLEAN").click(function(){
if ($(".chosen-select").val() != 999999) {
$(\'#category_selector\').hide();
@ -324,7 +391,7 @@ class AdminLabelGenerate extends AdminTab {
$("#deleteEAN").click(function(){
ok = confirm("Êtes vous sur de vouloir supprimer les eans de cette vente ?")
if (ok == true){
if (ok == true){
if ($(".chosen-select").val() != 999999) {
document.location.href=\'index.php?tab=AdminLabelGenerate&token='.Tools::getAdminTokenLite('AdminLabelGenerate').'&deleteEAN=1&id_sale=\' + $(".chosen-select").val();
}

View File

@ -127,7 +127,8 @@ class GenerateBarcode {
$this->products[] = array(
'key' => ($id_product.'-'.$id_product_attribute),
'label' => ($name_combination . ' ' . $p['name']),
'ref' => $ref
'ref' => $ref,
'decli' => substr($name_combination,0,-1)
);
}
} else {
@ -135,41 +136,76 @@ class GenerateBarcode {
$this->products[] = array(
'key' => $id_product.'-0',
'label' => $p['name'],
'ref' => $ref
'ref' => $ref,
'decli' => ''
);
}
}
//$this->products[] = array();
}
public function printPDF() {
public function printPDF($generate_ref = false) {
global $cookie;
// données test
/*for ($i=0; $i < 30; $i++) {
$this->products[$i] = array(
'key' => "125415-322",
'label' => "03 mois (62 cm)- Lot de 2 bodies Ri",
"ref" => "FIX-06-86763"
);
}
for ($i=31; $i < 80; $i++) {
$this->products[$i] = array(
'key' => "125416-332",
'label' => "03 mois (62 cm)- Ensemble grenouill",
"ref" => "FIX-04-86763"
);
}*/
// for ($i=0; $i < 60; $i++) {
// $this->products[$i] = array(
// 'key' => "125415-323",
// 'label' => "06 mois (68 cm)- Lot de 2 bodies Ri",
// "ref" => "FIX-06-86763",
// "decli" => '06 mois (68 cm)'
// );
// }
// for ($i=61; $i < 80; $i++) {
// $this->products[$i] = array(
// 'key' => "125416-332",
// 'label' => "03 mois (62 cm) - Ensemble grenouill",
// "ref" => "FIX-04-86763",
// "decli" => '03 mois (62 cm)'
// );
// }
// for ($i=81; $i < 100; $i++) {
// $this->products[$i] = array(
// 'key' => "125415-322",
// 'label' => "03 mois (62 cm) - Ensemble grenouill",
// "ref" => "FIX-06-86763",
// "decli" => '03 mois (62 cm)'
// );
// }
// for ($i=101; $i < 145; $i++) {
// $this->products[$i] = array(
// 'key' => "125417-325",
// 'label' => "06 mois (68 cm) - Ensemble grenouill",
// "ref" => "FIX-18-32094",
// "decli" => '06 mois (68 cm)'
// );
// }
// for ($i=146; $i < 206; $i++) {
// $this->products[$i] = array(
// 'key' => "125417",
// 'label' => "06 mois (68 cm) - Ensemble grenouill",
// "ref" => "FIX-16-32094",
// "decli" => '06 mois (68 cm)'
// );
// }
if (empty($this->products)) {
die('Tous les produits ont déjà un EAN');
die('Pas de produits à générer !');
}
if($generate_ref){
$this->products = $this->_multiSortProduct($this->products);
} else {
$this->products = $this->_sortProducts($this->products, 'ref');
}
$this->products = $this->_sortProducts($this->products, 'ref');
ob_start();
$pdf = new FPDF('P', 'mm', 'A4');
$nb_per_page = 0;
$pdf->SetMargins(9,12,9);
if($generate_ref) {
$pdf->SetMargins(9,13,9);
} else {
$pdf->SetMargins(9,12,9);
}
$pdf->SetAutoPageBreak(FALSE);
$pdf->AddPage();
$pdf->SetFont('Arial','',14);
@ -191,26 +227,44 @@ class GenerateBarcode {
foreach ($product_per_line as $key => $product) {
if (empty($product)) {
$pdf->Cell(48, 4, '', 0,0, 'C');
} elseif($generate_ref) {
$pdf->SetFont('Arial', '', 7);
$pdf->Cell(48, 8, substr(utf8_decode($product['decli']), 0, 35), 0,0, 'C');
} else {
$this->_printLabel($pdf, $product['label'], 1);
}
}
$pdf->Ln(4);
if($generate_ref) {
$pdf->Ln(8);
} else {
$pdf->Ln(4);
}
foreach ($product_per_line as $key => $product) {
if (empty($product)) {
$pdf->Cell(48, 10, '', 0,0, 'C');
} elseif($generate_ref) {
$pdf->SetFont('Arial', '', 7);
$pdf->Cell(48, 8, $product['ref'], 0,0, 'C');
} else {
$ean_image = $this->directory.'/ean-'.$product['key'].'.gif';
$this->_printEAN($pdf, $ean_image, 1);
}
}
$pdf->Ln(13);
if($generate_ref) {
$pdf->Ln(9);
} else {
$pdf->Ln(13);
}
$nb_per_page += 1;
}
}
$pdf->Output($this->directory.'/barcode.pdf', 'F');
if($generate_ref){
$pdf->Output($this->directory.'/reference.pdf', 'F');
} else {
$pdf->Output($this->directory.'/barcode.pdf', 'F');
}
ob_clean();
return TRUE;
}
@ -228,6 +282,32 @@ class GenerateBarcode {
}
}
private function _multiSortProduct($products = array()){
if (!empty($products)) {
$ref = array();
$decli = array();
foreach ($products as $key => $row) {
$ref[$key] = $row['ref'];
$decli[$key] = $row['decli'];
}
array_multisort($ref, SORT_ASC, $decli, SORT_ASC, $products);
$ref = '';
$result = array();
foreach ($products as $k => $v) {
if ($ref !== $v['ref'] && !empty($ref)) {
$result[] = array();
$result[] = $v;
$ref = $v['ref'];
continue;
}
$result[] = $v;
$ref = $v['ref'];
}
}
return $result;
}
private function _sortProducts($array = array(), $field, $order=SORT_ASC) {
$new_array = array();
$sortable_array = array();

View File

@ -450,11 +450,15 @@ class AdminPhileaMagistor extends AdminTab {
$philea_sales = array();
foreach(Db::getInstance()->ExecuteS('
SELECT `id_sale`
FROM `'._DB_PREFIX_.'philea_sync`
SELECT p.`id_sale`, c.`name`, c.`id_category`
FROM `'._DB_PREFIX_.'philea_sync` p
Left JOIN `'._DB_PREFIX_.'privatesale` ps ON (ps.`id_sale` = p.`id_sale`)
LEFT JOIN `'._DB_PREFIX_.'category_lang` c ON (c.`id_category` = ps.`id_category`)
WHERE c.`id_lang` = '.$cookie->id_lang.'
ORDER BY p.`id_sale` DESC
') as $row) {
$philea_sales[] = $row['id_sale'];
}
}
$id_sale_options = array();
foreach(Db::getInstance()->ExecuteS('
SELECT p.`id_sale`, c.`name`, c.`id_category`
@ -477,6 +481,7 @@ class AdminPhileaMagistor extends AdminTab {
$helperForm = new HelperFormBootstrap();
$helperForm->_select2 = true;
$helperForm->_inputMask = true;
$helperForm->_inputWizard = true;
$helperForm->_forms = array(
array(
@ -798,11 +803,146 @@ class AdminPhileaMagistor extends AdminTab {
';
$form .= $this->displayDestockForm();
$form .= $this->displayArchives();
$helperForm->_js .= '
<script>
$(document).ready(function() {
var wizardform = $(\'#wizard\').smartWizard({
labelNext:\'Suivant\',
labelPrevious:\'Précedent\',
labelFinish:\'Reset\',
reverseButtonsOrder:true,
contentURL:\'../modules/philea_magistor/ajax.php?action=destock\',
ajaxData : {},
beforeLoadContent: beforeLoadContentCallback,
onShowStep : onShowStepCallback,
onFinish: onFinishCallback,
contentURLData:null,
enableFinishButton: true,
});
$(\'#wizard_reset\').click(function(e){
e.preventDefault;
resetWizard();
});
function beforeLoadContentCallback(obj, context){
var data = {};
if (context.fromStep == 1) {
data = {
id_category: $(\'#wizard_id_category\').val(),
id_sale : $("option:selected", $(\'#wizard_id_category\')).data(\'id_sale\')
};
this.options.ajaxData = data;
} else if(context.fromStep == 2) {
data = {
id_products: $(\'#wizard_product_ids\').val(),
id_sale: $(\'#wizard_id_sale\').val(),
id_category: $(\'#wizard_id_category\').val(),
};
this.options.ajaxData = data;
} else if(context.fromStep == 3){
data = {
id_sale: $(\'#wizard_id_sale\').val()
};
this.options.ajaxData = data;
}
this.options.ajaxData = data;
return true;
}
function onShowStepCallback(obj, context){
if(context.fromStep != 1 && context.toStep == 1) {
var allAnchors = $(\'#wizard\').children("ul").children("li").children("a");
allAnchors.addClass(\'disabled\');
allAnchors.removeClass(\'done\');
allAnchors.data(\'isdone\',0);
obj.removeClass(\'disabled\');
obj.data(\'isdone\',1);
}
}
function onFinishCallback(objs, context){
resetWizard();
}
function resetWizard(){
var allDivs = $(\'.stepContainer\').children(\'div\');
var allAnchors = $(\'#wizard\').children("ul").children("li").children("a");
allAnchors.data(\'hasContent\',false);
allDivs.empty();
$(\'#wizard\').smartWizard(\'goToStep\',1);
}
});
</script>';
$form .= $helperForm->renderScript();
echo $form;
}
public function displayDestockForm() {
$form ='
<div class="panel">
<div class="panel-title">
<h2>Remise en vente</h2>
<ul class="nav navbar-right panel-toolbox">
<li><a id="wizard_reset" class="collapse-link"><i class="glyphicon glyphicon-repeat"></i></a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="panel-content">
<div id="wizard" class="form_wizard wizard_horizontal">
<ul class="wizard_steps anchor">
<li>
<a href="#step-1" class="selected" isdone="1" rel="1">
<span class="step_no">1</span>
<span class="step_descr">
Step 1<br>
<small>Choisir une Catégorie</small>
</span>
</a>
</li>
<li>
<a href="#step-2" class="done" isdone="1" rel="2">
<span class="step_no">2</span>
<span class="step_descr">
Step 2<br>
<small>Voir les produits</small>
</span>
</a>
</li>
<li>
<a href="#step-3" class="disabled" isdone="0" rel="3">
<span class="step_no">3</span>
<span class="step_descr">
Step 3<br>
<small>Réassocier</small>
</span>
</a>
</li>
<li>
<a href="#step-4" class="disabled" isdone="0" rel="4">
<span class="step_no">3</span>
<span class="step_descr">
Step 4<br>
<small>Activer la synchro Philéa</small>
</span>
</a>
</li>
</ul>
<div id="step-1"></div>
<div id="step-2"></div>
<div id="step-3"></div>
<div id="step-4"></div>
</div>
</div>
</div>';
return $form;
}
/**
* Get CRR files for not sent sales
*/
@ -979,6 +1119,7 @@ class AdminPhileaMagistor extends AdminTab {
'title' => $this->l('Archives'),
'icon' => '<span class="glyphicon glyphicon-level-up"></span> ',
'class' => 'form-horizontal',
'class_div' => '',
'sections' => array(
array(
'inputs' => array(
@ -986,7 +1127,7 @@ class AdminPhileaMagistor extends AdminTab {
'type' => 'select2',
'class-select' => '',
'name' => 'id_sale_unarchive',
'label' => $this->l('Choisir une vente'),
'label' => $this->l('Vente'),
'options' => $archives_options,
),
),

View File

@ -3,26 +3,182 @@
require_once(dirname(__FILE__).'../../../config/config.inc.php');
require_once(dirname(__FILE__).'../../../init.php');
header('Content-Type: application/json');
if(Tools::getValue('action') != 'getReport') {
if(Tools::getValue('action') == 'getReport') {
header('Content-Type: application/json');
switch (Tools::getValue('type')) {
case 'ART':
die(getReport('ART'));
break;
case 'CDC':
die(getReport('CDC'));
break;
case 'CRP':
die(getReport('CRP'));
break;
default:
http_response_code(418);
die(json_encode('I\'m a teapot'));
break;
}
} elseif(Tools::getValue('action') == 'destock') {
getStepDestock();
} else {
http_response_code(418);
die('I\'m a teapot');
}
switch (Tools::getValue('type')) {
case 'ART':
die(getReport('ART'));
break;
case 'CDC':
die(getReport('CDC'));
break;
case 'CRP':
die(getReport('CRP'));
break;
default:
http_response_code(418);
die(json_encode('I\'m a teapot'));
break;
function getStepDestock(){
$step = $_REQUEST["step_number"];
$html = '';
if($step == 1) {
$html.='<h2 class="StepTitle">Choisir La nouvelle vente</h2>
<div class="form-group col-sm-4 col-sm-offset-4">
<select class="form-control" name="id_category" id="wizard_id_category" tabindex="-1">';
foreach(Db::getInstance()->ExecuteS('
SELECT p.`id_sale`, c.`name`, c.`id_category`
FROM `'._DB_PREFIX_.'philea_sync` p
Left JOIN `'._DB_PREFIX_.'privatesale` ps ON (ps.`id_sale` = p.`id_sale`)
LEFT JOIN `'._DB_PREFIX_.'category_lang` c ON (c.`id_category` = ps.`id_category`)
WHERE c.`id_lang` = 2
ORDER BY p.`id_sale` DESC
') as $row) {
$extrafields = Category::getSalesInfos(array((int) $row['id_category']));
$html .= '<option data-id_sale="'.(int) $row['id_sale'].'" id="id_category_'.(int)$row['id_category'].'" value="'.(int)$row['id_category'].'">'.(int) $row['id_sale'].' (#'.(int) $row['id_category'].') - '.$row['name'].(empty($extrafields[(int) $row['id_category']]['sales'][1])?'':' - '.$extrafields[(int) $row['id_category']]['sales'][1]).'</option>';
}
$html .='</select>
</div>
<div class="clearfix"></div>
<div class="form-group col-sm-4 col-sm-offset-4">
<p class="text-center">Les produits doivent déjà se trouver dans la nouvelle catégorie (vente).</p>
</div>
<script>
$(document).ready(function() {
$("#wizard_id_category").select2({
placeholder: "",
allowClear: true,
width: \'100%\'
});
});
</script>';
} elseif($step == 2) {
$html .= '<h2 class="StepTitle">Les produits de la catégorie</h2>';
if(Tools::getValue('id_category')) {
$id_category = Tools::getValue('id_category');
$id_sale = Tools::getValue('id_sale');
$product_ids = array();
$sale_ids = array();
$products = Db::getInstance()->ExecuteS('
SELECT p.`id_product`, ps.`id_sale`
FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` ps ON (p.`id_product` = ps.`id_product`)
WHERE p.`id_category_default` = '.(int)$id_category.'
');
foreach($products as $row) {
$product_ids[(int)$row['id_product']] = (int)$row['id_product'];
$sale_ids[(int)$row['id_sale']] = (int)$row['id_sale'];
}
if(count($product_ids)>0) {
$html .= '<div>
<p class="text-center">Produits Concernés ('.count($product_ids).') :</p>
<div class="col-sm-4 col-sm-offset-4">
<table class="table">
<thead>
<tr>
<th align="center">ID Produit</th>
<th align="center">ID Vente (old)</th>
</tr>
</thead>
<tbody>';
foreach ($products as $product) {
$html .= '<tr>
<td align="center">'.$product['id_product'].'</td>
<td align="center">'.$product['id_sale'].'</td>
</tr>';
}
$html .= '</tbody>
</table>
<p class="text-center">Cliquer sur suivant pour réassocier les produits à la nouvelle vente</p>
</div>
</div>
<input type="hidden" id="wizard_product_ids" value="'.implode(',',$product_ids).'"/>
<input type="hidden" id="wizard_id_sale" value="'.$id_sale.'"/>
<input type="hidden" id="wizard_id_category" value="'.$id_category.'"/>';
} else {
$html .= '<div><p class="text-center">Pas de produits trouvés dans cette catégorie</p></div>';
}
} else {
$html .= '<div><p class="text-center">Vous devez choisir une catégorie</p></div>';
}
} elseif($step == 3) {
if(Tools::getValue('id_products')) {
$products_ids = Tools::getValue('id_products');
$id_category = Tools::getValue('id_category');
$id_sale = Tools::getValue('id_sale');
Db::getInstance()->ExecuteS('
DELETE FROM `'._DB_PREFIX_.'product_ps_cache`
WHERE `id_product` IN ('.$products_ids.')
');
Db::getInstance()->ExecuteS('
INSERT IGNORE INTO `'._DB_PREFIX_.'product_ps_cache` (
SELECT p.id_product, IFNULL(
(
SELECT s.id_sale
FROM `'._DB_PREFIX_.'privatesale_category` s
WHERE s.`id_category` = p.`id_category_default`
LIMIT 1)
, 0
)
FROM `ps_product` p
WHERE p.`id_category_default` = '.(int)$id_category.'
)
');
$html .= '<h2 class="StepTitle">Réassociation Réussie</h2>
<div class="col-sm-6 col-sm-offset-3">
<p class="text-center">Vous devez maintenant activer la vente pour que la synchronisation vers Philéa se fasse.</p>
<p class="text-center">(Pensez bien à vérifier vos stocks avec Philéa, la synchronisation ne s\'en charge pas)</p>
</div>
<input type="hidden" id="wizard_id_sale" value="'.$id_sale.'"/>';
} else {
$html .= '<div><p class="text-center">Pas de produits à associer</p></div>';
}
} elseif($step == 4) {
$id_sale = Tools::getValue('id_sale');
if($id_sale) {
$sql = '
UPDATE `'._DB_PREFIX_.'philea_sync` SET
`status` = 2,
`products` = 2
WHERE `id_sale` = '.(int)$id_sale;
if(Db::getInstance()->execute($sql)){
$sql = '
INSERT INTO `'._DB_PREFIX_.'philea_auto_sync`
VALUES (
'.(int) $id_sale.',
1,
"0000-00-00 00:00:00"
)
ON DUPLICATE KEY
UPDATE `active` = 1';
if(Db::getInstance()->execute($sql)){
$html .= '<h2 class="StepTitle">Activation de la synchronisation Philéa</h2>
<div class="col-sm-4 col-sm-offset-4 alert-custom alert-ok">
<i class="glyphicon glyphicon-ok"></i> <span class="text-alert">La vente est activée et automatiquement synchronisée</span>
</div>';
} else {
$html .= '<div><p class="text-center">La synchronisation auto n\'a pas pu se faire (faites appel à votre maintenance)</p></div>';
}
} else {
$html .= '<div><p class="text-center">L\'acitvation n\'a pas pu se faire (faites appel à votre maintenance)</p></div>';
}
} else {
$html .= '<div><p class="text-center">Une erreur est survenue</p></div>';
}
}
echo $html;
}
function getReport($type) {

View File

@ -98,7 +98,7 @@ if($magistorModule->active) {
$orders = $db->ExecuteS('
SELECT * FROM `'._DB_PREFIX_.'orders`
WHERE `date_add` > "2016-09-30 00:00:00"
WHERE `date_add` > "2016-12-20 00:00:00"
'.(count($exclude_orders) > 0? 'AND `id_order` NOT IN ('.implode(', ', $exclude_orders).')': '').'
'.(count($include_orders) > 0? 'AND `id_order` IN ('.implode(', ', $include_orders).')': '').'
');

View File

@ -816,6 +816,13 @@ if(Tools::getValue('action') == 'getOrderForm' && ( ( $id_category = Tools::getV
case '4':
foreach($lines2 as $k => $lines_attributes)
{
$ref = array();
$decli = array();
foreach ($lines_attributes as $key => $row) {
$ref[$key] = $row['line']['product_reference'];
$decli[$key] = $row['line']['product_attribute_name_base'];
}
array_multisort($ref, SORT_ASC, $decli, SORT_ASC, $lines_attributes);
foreach($lines_attributes as $key => $values)
{
// si le produit n'apparait pas dans une commande, on affiche pas la ligne