Skip to content

Commit

Permalink
Merge pull request PrestaShop#21096 from sowbiba/merge177xintodevelop
Browse files Browse the repository at this point in the history
Merge 177x into develop 22/09/2020
  • Loading branch information
Progi1984 authored Sep 24, 2020
2 parents 4ea9db8 + 73b22be commit 1a54871
Show file tree
Hide file tree
Showing 58 changed files with 1,605 additions and 174 deletions.
3 changes: 1 addition & 2 deletions admin-dev/themes/default/sass/partials/_nav.sass
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
&.expanded
display: block
margin-left: 0
overflow-y: scroll

.onboarding-navbar
display: none
Expand Down Expand Up @@ -345,7 +344,7 @@
padding-right: .8rem

.nav-bar
overflow: visible!important;
overflow: visible !important
width: $size-navbar-width-mini

&-overflow
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
&.expanded {
display: block;
margin-left: 0;
overflow-y: scroll;
}
.onboarding-navbar {
display: none;
Expand Down
19 changes: 17 additions & 2 deletions classes/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class ToolsCore
protected static $request;
protected static $cldr_cache = [];
protected static $colorBrightnessCalculator;
protected static $fallbackParameters = [];

public static $round_mode = null;

Expand Down Expand Up @@ -524,8 +525,14 @@ public static function getValue($key, $default_value = false)

if (getenv('kernel.environment') === 'test' && self::$request instanceof Request) {
$value = self::$request->request->get($key, self::$request->query->get($key, $default_value));
} else {
$value = (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? $_GET[$key] : $default_value));
} elseif (isset($_POST[$key]) || isset($_GET[$key])) {
$value = isset($_POST[$key]) ? $_POST[$key] : $_GET[$key];
} elseif (isset(static::$fallbackParameters[$key])) {
$value = static::$fallbackParameters[$key];
}

if (!isset($value)) {
$value = $default_value;
}

if (is_string($value)) {
Expand Down Expand Up @@ -4439,6 +4446,14 @@ public static function redirectToInstall()
}
exit;
}

/**
* @param array $fallbackParameters
*/
public static function setFallbackParameters(array $fallbackParameters): void
{
static::$fallbackParameters = $fallbackParameters;
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion classes/controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2664,7 +2664,7 @@ public function setMedia($isNewTheme = false)
$this->addJs(_PS_JS_DIR_ . 'jquery/jquery-migrate-3.1.0.min.js');
// implement $.browser object and live method, that has been removed since jquery 1.9
$this->addJs(_PS_JS_DIR_ . 'jquery/jquery.browser-0.1.0.min.js');
$this->addJs(_PS_JS_DIR_ . 'jquery/jquery.live-polyfill-1.1.1.min.js');
$this->addJs(_PS_JS_DIR_ . 'jquery/jquery.live-polyfill-1.1.2.min.js');

$this->addJqueryPlugin(['scrollTo', 'alerts', 'chosen', 'autosize', 'fancybox']);
$this->addJqueryPlugin('growl', null, false);
Expand Down
2 changes: 1 addition & 1 deletion controllers/admin/AdminCarriersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public function postProcess()
// Delete from the reference_id and not from the carrier id
$carrier = new Carrier((int) $id);
Warehouse::removeCarrier($carrier->id_reference);
} elseif (Tools::isSubmit($this->table . 'Box') && count(Tools::isSubmit($this->table . 'Box')) > 0) {
} elseif (Tools::isSubmit($this->table . 'Box') && count(Tools::getValue($this->table . 'Box', [])) > 0) {
$ids = Tools::getValue($this->table . 'Box');
array_walk($ids, 'intval');
foreach ($ids as $id) {
Expand Down
2 changes: 1 addition & 1 deletion controllers/admin/AdminFeaturesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public function initContent()
public function initProcess()
{
// Are we working on feature values?
if (Tools::getValue('id_feature_value')
if ((Tools::getValue('id_feature_value') && !Tools::getValue('id_feature'))
|| Tools::isSubmit('deletefeature_value')
|| Tools::isSubmit('submitAddfeature_value')
|| Tools::isSubmit('addfeature_value')
Expand Down
6 changes: 3 additions & 3 deletions install-dev/fixtures/fashion/data/store.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<field name="active"/>
</fields>
<entities>
<store id="Dade_County" id_country="US" id_state="FL" postcode=" 33135" latitude="25.76500500" longitude="-80.24379700" phone="" fax="" active="1">
<store id="Dade_County" id_country="US" id_state="FL" postcode="33135" latitude="25.76500500" longitude="-80.24379700" phone="" fax="" active="1">
<name>Dade County</name>
<address1>3030 SW 8th St Miami</address1>
<address2/>
Expand All @@ -27,7 +27,7 @@
<email/>
<note/>
</store>
<store id="E_Fort_Lauderdale" id_country="US" id_state="FL" postcode=" 33304" latitude="26.13793600" longitude="-80.13943500" phone="" fax="" active="1">
<store id="E_Fort_Lauderdale" id_country="US" id_state="FL" postcode="33304" latitude="26.13793600" longitude="-80.13943500" phone="" fax="" active="1">
<name>E Fort Lauderdale</name>
<address1>1000 Northeast 4th Ave Fort Lauderdale</address1>
<address2/>
Expand All @@ -45,7 +45,7 @@
<email/>
<note/>
</store>
<store id="Coconut_Grove" id_country="US" id_state="FL" postcode=" 33133" latitude="25.73629600" longitude="-80.24479700" phone="" fax="" active="1">
<store id="Coconut_Grove" id_country="US" id_state="FL" postcode="33133" latitude="25.73629600" longitude="-80.24479700" phone="" fax="" active="1">
<name>Coconut Grove</name>
<address1>2999 SW 32nd Avenue</address1>
<address2/>
Expand Down
60 changes: 30 additions & 30 deletions js/admin/carrier_wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function displaySummary()

// Delay and pricing
tmp = summary_translation_meta_informations.replace('%2$s', '<strong>' + delay_text + '</strong>');
if ($('#is_free_on').attr('checked'))
if ($('#is_free_on').prop('checked'))
tmp = tmp.replace('%1$s', summary_translation_free);
else
tmp = tmp.replace('%1$s', summary_translation_paid);
Expand All @@ -196,9 +196,9 @@ function displaySummary()
// Tax and calculation mode for the shipping cost
tmp = summary_translation_shipping_cost.replace('%2$s', $('#id_tax_rules_group option:selected').text());

if ($('#billing_price').attr('checked'))
if ($('#billing_price').prop('checked'))
tmp = tmp.replace('%1$s', summary_translation_price);
else if ($('#billing_weight').attr('checked'))
else if ($('#billing_weight').prop('checked'))
tmp = tmp.replace('%1$s', summary_translation_weight);
else
tmp = tmp.replace('%1$s', '<strong>' + summary_translation_undefined + '</strong>');
Expand Down Expand Up @@ -237,26 +237,26 @@ function displaySummary()
.replace('%2$s', '<strong>' + range_sup +' '+ unit + '</strong>')
.replace('%3$s', '<strong>' + $('#range_behavior option:selected').text().toLowerCase() + '</strong>')
);
if ($('#is_free_on').attr('checked'))
if ($('#is_free_on').prop('checked'))
$('span.is_free').hide();
// Delivery zones
$('#summary_zones').html('');
$('.input_zone').each(function(){
if ($(this).attr('checked'))
if ($(this).prop('checked'))
$('#summary_zones').html($('#summary_zones').html() + '<li><strong>' + $(this).closest('tr').find('label').text() + '</strong></li>');
});

// Group restrictions
$('#summary_groups').html('');
$('input[name$="groupBox[]"]').each(function(){
if ($(this).attr('checked'))
if ($(this).prop('checked'))
$('#summary_groups').html($('#summary_groups').html() + '<li><strong>' + $(this).closest('tr').find('td:eq(2)').text() + '</strong></li>');
});

// shop restrictions
$('#summary_shops').html('');
$('.input_shop').each(function(){
if ($(this).attr('checked'))
if ($(this).prop('checked'))
$('#summary_shops').html($('#summary_shops').html() + '<li><strong>' + $(this).closest().text() + '</strong></li>');
});
}
Expand All @@ -266,7 +266,7 @@ function validateSteps(fromStep, toStep)
var is_ok = true;
if ((multistore_enable && fromStep == 3) || (!multistore_enable && fromStep == 2))
{
if (toStep > fromStep && !$('#is_free_on').attr('checked'))
if (toStep > fromStep && !$('#is_free_on').prop('checked'))
{
is_ok = false;
$('.input_zone').each(function () {
Expand All @@ -281,7 +281,7 @@ function validateSteps(fromStep, toStep)
}
}

if (toStep > fromStep && !$('#is_free_on').attr('checked') && !validateRange(2))
if (toStep > fromStep && !$('#is_free_on').prop('checked') && !validateRange(2))
is_ok = false;
}

Expand Down Expand Up @@ -370,14 +370,14 @@ function bind_inputs()
if ($('tr.fees_all td:eq('+index+')').hasClass('validated'))
{
enableGlobalFees(index);
$(this).find('div.input-group input:text').removeAttr('disabled');
$(this).find('div.input-group input:text').prop('disabled', false);
}
else
disabledGlobalFees(index);
});
}
else
$(this).closest('tr').find('td').find('div.input-group input:text').attr('disabled', 'disabled');
$(this).closest('tr').find('td').find('div.input-group input:text').prop('disabled', true);

return false;
});
Expand All @@ -401,7 +401,7 @@ function bind_inputs()
});

$(document.body).off('change', 'tr.fees_all td input').on('change', 'tr.fees_all td input', function() {
   index = $(this).closest('td').index();
index = $(this).closest('td').index();
val = $(this).val();
$(this).val('');
$('tr.fees').each(function () {
Expand Down Expand Up @@ -452,7 +452,7 @@ function hideFees()
$('tr.range_inf td, tr.range_sup td, tr.fees_all td, tr.fees td').each(function () {
if ($(this).index() >= 2)
{
$(this).find('input:text, button').val('').attr('disabled', 'disabled').css('background-color', '#999999').css('border-color', '#999999');
$(this).find('input:text, button').val('').prop('disabled', true).css('background-color', '#999999').css('border-color', '#999999');
$(this).css('background-color', '#999999');
}
});
Expand All @@ -467,10 +467,10 @@ function showFees()
//enable only if zone is active
tr = $(this).closest('tr');
validate = $('tr.fees_all td:eq('+$(this).index()+')').hasClass('validated');
if ($(tr).index() > 2 && $(tr).find('td:eq(1) input').attr('checked') && validate || !$(tr).hasClass('range_sup') || !$(tr).hasClass('range_inf'))
$(this).find('div.input-group input:text').removeAttr('disabled');
if ($(tr).index() > 2 && $(tr).find('td:eq(1) input').prop('checked') && validate || !$(tr).hasClass('range_sup') || !$(tr).hasClass('range_inf'))
$(this).find('div.input-group input:text').prop('disabled', false);
$(this).find('input:text, button').css('background-color', '').css('border-color', '');
$(this).find('button').css('background-color', '').css('border-color', '').removeAttr('disabled');
$(this).find('button').css('background-color', '').css('border-color', '').prop('disabled', false);
$(this).css('background-color', '');
}
});
Expand All @@ -486,7 +486,7 @@ function validateRange(index)
var $currentRangeInf = $('tr.range_inf td:eq(' + index + ')').find('div.input-group input:text');
var rangeSup = parseFloat($currentRangeSup.val().trim());
var rangeInf = parseFloat($currentRangeInf.val().trim());

//reset css error
$currentRangeSup.closest('div.input-group').removeClass('has-error');
$currentRangeInf.closest('div.input-group').removeClass('has-error');
Expand Down Expand Up @@ -536,22 +536,22 @@ function enableZone(index)
{
$('tr.fees').each(function () {
if ($(this).find('td:eq(1)').find('input[type=checkbox]:checked').length)
$(this).find('td:eq('+index+')').find('div.input-group input').removeAttr('disabled');
$(this).find('td:eq('+index+')').find('div.input-group input').prop('disabled', false);
});
}

function disableZone(index)
{
$('tr.fees').each(function () {
$(this).find('td:eq('+index+')').find('div.input-group input').attr('disabled', 'disabled');
$(this).find('td:eq('+index+')').find('div.input-group input').prop('disabled', true);
});
}

function enableRange(index)
{
$('tr.fees').each(function () {
//only enable fees for enabled zones
if ($(this).find('td').find('input:checkbox').attr('checked') == 'checked')
if ($(this).find('td').find('input:checkbox').prop('checked'))
enableZone(index);
});
$('tr.fees_all td:eq('+index+')').addClass('validated').removeClass('not_validated');
Expand All @@ -564,14 +564,14 @@ function enableRange(index)
function enableGlobalFees(index)
{
$('span.fees_all').show();
$('tr.fees_all td:eq('+index+')').find('div.input-group input').show().removeAttr('disabled');
$('tr.fees_all td:eq('+index+')').find('div.input-group input').show().prop('disabled', false);
$('tr.fees_all td:eq('+index+')').find('div.input-group .currency_sign').show();
}

function disabledGlobalFees(index)
{
$('span.fees_all').hide();
$('tr.fees_all td:eq('+index+')').find('div.input-group input').hide().attr('disabled', 'disabled');
$('tr.fees_all td:eq('+index+')').find('div.input-group input').hide().prop('disabled', true);
$('tr.fees_all td:eq('+index+')').find('div.input-group .currency_sign').hide();
}

Expand All @@ -580,10 +580,10 @@ function disableRange(index)
{
$('tr.fees').each(function () {
//only enable fees for enabled zones
if ($(this).find('td').find('input:checkbox').attr('checked') == 'checked')
if ($(this).find('td').find('input:checkbox').prop('checked'))
disableZone(index);
});
$('tr.fees_all td:eq('+index+')').find('div.input-group input').attr('disabled', 'disabled');
$('tr.fees_all td:eq('+index+')').find('div.input-group input').prop('disabled', true);
$('tr.fees_all td:eq('+index+')').removeClass('validated').addClass('not_validated');
}

Expand Down Expand Up @@ -742,21 +742,21 @@ function checkAllZones(elt)
{
if($(elt).is(':checked'))
{
$('.input_zone').attr('checked', 'checked');
$('.input_zone').prop('checked', true);
$('.fees div.input-group input:text').each(function () {
index = $(this).closest('td').index();
enableGlobalFees(index);
if ($('tr.fees_all td:eq('+index+')').hasClass('validated'))
{
$(this).removeAttr('disabled');
$('.fees_all td:eq('+index+') div.input-group input:text').removeAttr('disabled');
$(this).prop('disabled', false);
$('.fees_all td:eq('+index+') div.input-group input:text').prop('disabled', false);
}
});
}
else
{
$('.input_zone').removeAttr('checked');
$('.fees div.input-group input:text, .fees_all div.input-group input:text').attr('disabled', 'disabled');
$('.input_zone').prop('checked', false);
$('.fees div.input-group input:text, .fees_all div.input-group input:text').prop('disabled', true);
}

}
Expand Down Expand Up @@ -789,7 +789,7 @@ var carriersRangeInputs = {
$this.off();
var index = $this.closest('td').index();
var hasError = $('tr.range_sup td:eq(' + index + ') .has-error, tr.range_inf td:eq(' + index + ') .has-error');

if ($('.wizard_error').length === 0 || hasError.length !== 0) {
carriersRangeInputs.checkCarriersRangeValidation(index);
}
Expand Down
6 changes: 0 additions & 6 deletions js/jquery/jquery.live-polyfill-1.1.1.min.js

This file was deleted.

6 changes: 6 additions & 0 deletions js/jquery/jquery.live-polyfill-1.1.2.min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*!
* https://github.com/PrestaShop/jquery.live-polyfill
*
* Released under the MIT license
*/
!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){var n=e.fn.init;e.fn.init=function(e){var t=Array.prototype.slice.call(arguments);"string"==typeof e&&"#"===e&&(console.warn("jQuery('#') is not a valid selector"),t[0]=[]);var i=n.apply(this,arguments);return i.selector="string"==typeof e?e:"",i},e.fn.init.prototype=e.fn,void 0!==e.fn.live&&e.isFunction(e.fn.live)||e.fn.extend({live:function(n,t,i){return this.selector&&e(document).on(n,this.selector,t,i),console.warn("jQuery.live() has been removed since jquery v1.9, please use jQuery.on() instead."),this}})});
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use PrestaShop\PrestaShop\Adapter\Order\AbstractOrderHandler;
use PrestaShop\PrestaShop\Adapter\Order\OrderProductQuantityUpdater;
use PrestaShop\PrestaShop\Core\Domain\Order\Exception\CannotEditDeliveredOrderProductException;
use PrestaShop\PrestaShop\Core\Domain\Order\Exception\CannotFindProductInOrderException;
use PrestaShop\PrestaShop\Core\Domain\Order\Exception\DuplicateProductInOrderInvoiceException;
use PrestaShop\PrestaShop\Core\Domain\Order\Exception\OrderException;
use PrestaShop\PrestaShop\Core\Domain\Order\Product\Command\UpdateProductInOrderCommand;
Expand Down Expand Up @@ -151,6 +152,12 @@ private function assertProductCanBeUpdated(
Order $order,
OrderInvoice $orderInvoice = null
) {
// assert product exists
$product = new Product($orderDetail->product_id);
if ($product->id !== (int) $orderDetail->product_id) {
throw new CannotFindProductInOrderException('You cannot edit the price of a product that no longer exists in your catalog.');
}

if (!Validate::isLoadedObject($orderDetail)) {
throw new OrderException('The Order Detail object could not be loaded.');
}
Expand Down
Loading

0 comments on commit 1a54871

Please sign in to comment.