Skip to content

Commit

Permalink
Merge branch '1.7.3.x' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
eternoendless committed Apr 24, 2018
2 parents 11350b4 + 0229660 commit 0213db5
Show file tree
Hide file tree
Showing 72 changed files with 2,041 additions and 105 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ script:
- bash travis-scripts/install-prestashop
- php bin/console lint:twig src
- php bin/console lint:twig app
- composer phpunit-legacy
- composer phpunit-admin
- composer phpunit-sf
- composer phpunit-controllers
- composer run-script phpunit-legacy --timeout=0
- composer run-script phpunit-admin --timeout=0
- composer run-script phpunit-sf --timeout=0
- composer run-script phpunit-controllers --timeout=0
- bash travis-scripts/install-prestashop
- bash ./travis-scripts/run-selenium-tests
- bash ./travis-scripts/run-functional-tests # Must run before starter theme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@
<p class="alert alert-info">
{l s='Copies data from one language to another.' d='Admin.International.Help'}<br />
{l s='Warning: This will replace all of the existing data inside the destination language.' d='Admin.International.Help'}<br />
{l s='If necessary [1][2] you must first create a new language[/1].' sprintf=['[1]' => "<a href=\"-{$url_create_language}-\" class=\"btn btn-link\">", '[/1]' => '</a>', '[2]' => '<i class="icon-external-link-sign"></i>'] d='Admin.International.Help'}
{l s='If necessary [1][2] you must first create a new language[/1].' sprintf=['[1]' => "<a href=\"{$url_create_language}\" class=\"btn btn-link\">", '[/1]' => '</a>', '[2]' => '<i class="icon-external-link-sign"></i>'] d='Admin.International.Help'}
</p>
<div class="form-group">
<label class="control-label col-lg-3 required" for="fromLang"> {l s='From' d='Admin.Global'}</label>
Expand Down
10 changes: 5 additions & 5 deletions admin-dev/themes/default/template/helpers/form/form.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,11 @@
</script>
{/if}
{elseif $input.type == 'swap'}
<div class="form-group">
<div class="form-group swap-container">
<div class="col-lg-9">
<div class="form-control-static row">
<div class="col-xs-6">
<select {if isset($input.size)}size="{$input.size|escape:'html':'utf-8'}"{/if}{if isset($input.onchange)} onchange="{$input.onchange|escape:'html':'utf-8'}"{/if} class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'}{/if}" id="availableSwap" name="{$input.name|escape:'html':'utf-8'}_available[]" multiple="multiple">
<select {if isset($input.size)}size="{$input.size|escape:'html':'utf-8'}"{/if}{if isset($input.onchange)} onchange="{$input.onchange|escape:'html':'utf-8'}"{/if} class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'}{/if} availableSwap" name="{$input.name|escape:'html':'utf-8'}_available[]" multiple="multiple">
{foreach $input.options.query AS $option}
{if is_object($option)}
{if !in_array($option->$input.options.id, $fields_value[$input.name])}
Expand All @@ -308,10 +308,10 @@
{/if}
{/foreach}
</select>
<a href="#" id="addSwap" class="btn btn-default btn-block">{l s='Add' d='Admin.Actions'} <i class="icon-arrow-right"></i></a>
<a href="#" class="btn btn-default btn-block addSwap">{l s='Add' d='Admin.Actions'} <i class="icon-arrow-right"></i></a>
</div>
<div class="col-xs-6">
<select {if isset($input.size)}size="{$input.size|escape:'html':'utf-8'}"{/if}{if isset($input.onchange)} onchange="{$input.onchange|escape:'html':'utf-8'}"{/if} class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'}{/if}" id="selectedSwap" name="{$input.name|escape:'html':'utf-8'}_selected[]" multiple="multiple">
<select {if isset($input.size)}size="{$input.size|escape:'html':'utf-8'}"{/if}{if isset($input.onchange)} onchange="{$input.onchange|escape:'html':'utf-8'}"{/if} class="{if isset($input.class)}{$input.class|escape:'html':'utf-8'}{/if} selectedSwap" name="{$input.name|escape:'html':'utf-8'}_selected[]" multiple="multiple">
{foreach $input.options.query AS $option}
{if is_object($option)}
{if in_array($option->$input.options.id, $fields_value[$input.name])}
Expand All @@ -326,7 +326,7 @@
{/if}
{/foreach}
</select>
<a href="#" id="removeSwap" class="btn btn-default btn-block"><i class="icon-arrow-left"></i> {l s='Remove'}</a>
<a href="#" class="btn btn-default btn-block removeSwap"><i class="icon-arrow-left"></i> {l s='Remove'}</a>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions classes/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -1350,11 +1350,11 @@ public function updateQty(
$updateQuantity = '+ ' . $quantity;
$newProductQuantity = $productQuantity - $quantity;

if ($newProductQuantity < 0 && !$availableOutOfStock) {
if ($newProductQuantity < 0 && !$availableOutOfStock && !$skipAvailabilityCheckOutOfStock) {
return false;
}
} else if ($operator == 'down') {
$cartFirstLevelProductQuantity = $this->getProductQuantity((int) $id_product, (int) $id_product_attribute);
$cartFirstLevelProductQuantity = $this->getProductQuantity((int) $id_product, (int) $id_product_attribute, $id_customization);
$updateQuantity = '- ' . $quantity;
$newProductQuantity = $productQuantity + $quantity;

Expand Down Expand Up @@ -1388,7 +1388,7 @@ public function updateQty(
$result2['quantity'] = Pack::getQuantity($id_product, $id_product_attribute, null, $this);
}

if (!Product::isAvailableWhenOutOfStock((int)$result2['out_of_stock'])) {
if (!Product::isAvailableWhenOutOfStock((int)$result2['out_of_stock']) && !$skipAvailabilityCheckOutOfStock) {
if ((int)$quantity > $result2['quantity']) {
return false;
}
Expand Down
33 changes: 17 additions & 16 deletions classes/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use PrestaShop\PrestaShop\Core\Cldr\Repository as cldrRepository;
use PrestaShop\PrestaShop\Core\Localization\RTL\Processor as RtlStylesheetProcessor;
use PrestaShopBundle\Translation\Translator;
use Symfony\Component\Filesystem\Filesystem;

class LanguageCore extends ObjectModel
{
Expand Down Expand Up @@ -1073,36 +1074,36 @@ public static function downloadXLFLanguagePack($locale, &$errors = array(), $typ
{
$file = _PS_TRANSLATIONS_DIR_.$type.'-'.$locale.'.zip';
$url = ('emails' === $type) ? self::EMAILS_LANGUAGE_PACK_URL : self::SF_LANGUAGE_PACK_URL;
$content = Tools::file_get_contents(
str_replace(
array(
'%version%',
'%locale%',
),
array(
_PS_VERSION_,
$locale,
),
$url
)
$url = str_replace(
array(
'%version%',
'%locale%',
),
array(
_PS_VERSION_,
$locale,
),
$url
);

if (!is_writable(dirname($file))) {
// @todo Throw exception
$errors[] = Context::getContext()->getTranslator()->trans('Server does not have permissions for writing.', array(), 'Admin.International.Notification').' ('.$file.')';
} else {
@file_put_contents($file, $content);
$fs = new Filesystem();
$fs->copy($url, $file, true);
}
}

public static function installSfLanguagePack($locale, &$errors = array())
{
if (!file_exists(_PS_TRANSLATIONS_DIR_.'sf-'.$locale.'.zip')) {
$zipFilePath = _PS_TRANSLATIONS_DIR_.'sf-'.$locale.'.zip';
if (!file_exists($zipFilePath)) {
// @todo Throw exception
$errors[] = Context::getContext()->getTranslator()->trans('Language pack unavailable.', array(), 'Admin.International.Notification');
} else {
$zipArchive = new ZipArchive();
$zipArchive->open(_PS_TRANSLATIONS_DIR_.'sf-'.$locale.'.zip');
$zipArchive->open($zipFilePath);
$zipArchive->extractTo(_PS_ROOT_DIR_.'/app/Resources/translations');
$zipArchive->close();
}
Expand All @@ -1111,7 +1112,7 @@ public static function installSfLanguagePack($locale, &$errors = array())
public static function installEmailsLanguagePack($lang_pack, &$errors = array())
{
$folder = _PS_TRANSLATIONS_DIR_.'emails-'.$lang_pack['locale'];
$fileSystem = new \Symfony\Component\Filesystem\Filesystem();
$fileSystem = new Filesystem();
$finder = new \Symfony\Component\Finder\Finder();

if (!file_exists($folder.'.zip')) {
Expand Down
2 changes: 1 addition & 1 deletion classes/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -3606,7 +3606,7 @@ public static function getQuantity(
$nbProductInCart = 0;

if (!empty($cart)) {
$cartProduct = $cart->getProductQuantity($id_product);
$cartProduct = $cart->getProductQuantity($id_product, $id_product_attribute);

if (!empty($cartProduct['deep_quantity'])) {
$nbProductInCart = $cartProduct['deep_quantity'];
Expand Down
16 changes: 9 additions & 7 deletions classes/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public static function getProfileAccesses($idProfile, $type = 'id_tab')
$idProfile,
$type,
array(
'id_profile' => _PS_ADMIN_PROFILE_,
'id_profile' => $idProfile,
'view' => '0',
'add' => '0',
'edit' => '0',
Expand All @@ -172,9 +172,9 @@ public static function getProfileAccesses($idProfile, $type = 'id_tab')
WHERE j.`id_profile` = '.(int) $idProfile);

foreach ($result as $row) {
$idTab = self::findIdTabByAuthSlug($row['slug']);
$tab = self::findTabTypeInformationByAuthSlug($type, $row['slug']);

self::$_cache_accesses[$idProfile][$type][$idTab][array_search('1', $row)] = '1';
self::$_cache_accesses[$idProfile][$type][$tab][array_search('1', $row)] = '1';
}
}
}
Expand Down Expand Up @@ -207,11 +207,13 @@ private static function fillCacheAccesses($idProfile, $type, $cacheData = [])
}

/**
*
* Find tab type information by authorization slug
*
* @param string $type
* @param string $authSlug
* @return int
*/
private static function findIdTabByAuthSlug($authSlug)
private static function findTabTypeInformationByAuthSlug($type, $authSlug)
{
preg_match(
'/ROLE_MOD_[A-Z]+_(?P<classname>[A-Z][A-Z0-9]*)_(?P<auth>[A-Z]+)/',
Expand All @@ -220,11 +222,11 @@ private static function findIdTabByAuthSlug($authSlug)
);

$result = Db::getInstance()->getRow('
SELECT `id_tab`
SELECT `'.$type.'`
FROM `'._DB_PREFIX_.'tab` t
WHERE UCASE(`class_name`) = "'.$matches['classname'].'"
');

return $result['id_tab'];
return $result[$type];
}
}
5 changes: 2 additions & 3 deletions classes/SpecificPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ protected static function computeExtraConditions($id_product, $id_product_attrib
$ending = $now;
}
$id_customer = (int)$id_customer;
$id_cart = (int)$id_cart;

$query_extra = '';

Expand All @@ -340,9 +341,7 @@ protected static function computeExtraConditions($id_product, $id_product_attrib
$query_extra .= self::filterOutField('id_product_attribute', $id_product_attribute);
}

if ($id_cart !== null) {
$query_extra .= self::filterOutField('id_cart', $id_cart);
}
$query_extra .= self::filterOutField('id_cart', $id_cart);

if ($ending == $now && $beginning == $now) {
$key = __FUNCTION__.'-'.$first_date.'-'.$last_date;
Expand Down
2 changes: 1 addition & 1 deletion controllers/front/CartController.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ protected function processChangeProductInCart()
);
} elseif (!$update_quantity) {
array_push(
$this->{$ErrorKey},
$this->errors,
$this->trans(
'You already have the maximum quantity available for this product.',
array(),
Expand Down
11 changes: 10 additions & 1 deletion controllers/front/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,16 @@ public function initContent()
$presentedCart = $this->cart_presenter->present($this->context->cart);

if (count($presentedCart['products']) <= 0 || $presentedCart['minimalPurchaseRequired']) {
Tools::redirect('index.php?controller=cart');
// if there is no product in current cart, redirect to cart page
$cartLink = $this->context->link->getPageLink('cart');
Tools::redirect($cartLink);
}

$product = $this->context->cart->checkQuantities(true);
if (is_array($product)) {
// if there is an issue with product quantities, redirect to cart page
$cartLink = $this->context->link->getPageLink('cart', null, null, array('action' => 'show'));
Tools::redirect($cartLink);
}

$this->checkoutProcess
Expand Down
77 changes: 77 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,83 @@ International Registered Trademark & Property of PrestaShop SA
Release Notes for PrestaShop 1.7
--------------------------------

####################################
# v1.7.3.1 - (2018-04-09)
####################################
- Back Office:
- New feature:
- #8849: Add User club and UserVoice on BO link footer
- Improvement:
- #8664: Change employee icon
- #8500: Make sure shop list in header is scrollable with lot of items
- #8780: Improve BO speed by removing menu images
- #8725: Replace Google+ link on BO footer by Youtube link
- Bug fix:
- #8925: Stop generating RTL css file for the default theme using SASS
- #8921: Fixed CDN management in Performance page
- #8871: Improved rendering of combinations in Product page
- #8779: Little css override for modal title
- #8631: Request module zip for upgrade ONLY when the version available is higher
- #8714: Update loaded details from database on module action
- #8696: Fix translation issue during language install
- #8648: Fix modal backdrop not removed when uninstalling a module
- #8618: Fix type warning in order detail
- #8525: "No tax" price option is now well saved in admin product page
- #8476: Fix customer search in new order form
- #8234: Fixed bug on save specific price priority for specific product
- Front Office:
- Bug fix:
- #8873: Fix contactform module issues
- #8856: Fixed undefined variables when an url is called in ajax
- #8847: Override advertising module on classic template to fix image width
- #8845: Fix search bar on header when it moves from hook and improve header structure #2
- #7775: Resolve incompatibility between canonical redirections, attributes and product route not only containing rewrite
- #8846: Fix menu width and submenu hover on header
- #8522: Fixed specific price percentage rounding on front product page
- Core:
- Improvement:
- #8867: Rely on the right legacy container if available on modules
- #8584: Update toCamelCase
- #8795: Minor improvements during install
- Bug fix:
- #8922: Fixed access to Front Office container from modules
- #8766: Show unit price within a tax in order confirmation e-mail
- #8607: Fix pack stock issues
- #8711: Default AJAX Relevance search sort order is wrong
- #8803: Stop full object exposure on the front end
- #8708: Debug of Tools::strReplaceFirst that do not correctly compare the return of strpos + PhpDoc
- #8498: Fixed bug on reorder with free gift in the cart
- #8543: Layout broken by cache clear
- #8669: Make sure all adresses are reset on cart
- #8462: Fix empty module return on actionEmailSendBefore breaks all email send
- #8277: CustomerAddressFormatter states were queried without the status (active) check causing disabling states in BO useless
- Installer:
- Improvement:
- #8860: Make the dezipper great again
- #8806: Sample products in FA
- Bug fix:
- #8913: Fix issue with pack in fixtures (installer)
- #8891: Fix dezipper redirect
- #8858: Include docs when creating zip build
- Tests:
- New feature:
- #8812: Delete product
- #8829: Add script for screenshot display on Travis
- Improvement:
- #8881: Check the pagination of product in the Front Office
- #8898: Check generated combinations table
- #8903: Add some fixes to the script
- #8813: Check the product discount in the Front Office
- #8805: Reset module Welcome if the RESUME button does not exist
- #8878: Check the appearance of tinymce field on the product page
- #8854: Check the change of the default combination from the edition page
- #8819: Fix sort product script
- #8810: Check the total price in the shopping cart
- #8815: Re-enable functional tests
- Bug fix:
- #8842: Fixed Travis build (update Chrome browser version)
- #8746: Make file copy on ModuleSelfConfiguration mockable

####################################
# v1.7.3.0 - (2018-02-28)
####################################
Expand Down
4 changes: 2 additions & 2 deletions docs/readme_de.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ needs please refer to http://www.prestashop.com for more information.
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
International Registered Trademark & Property of PrestaShop SA

NAME: Prestashop 1.7.3.0
VERSION: 1.7.3.0
NAME: Prestashop 1.7.3.1
VERSION: 1.7.3.1

VORBEREITUNG
===========
Expand Down
4 changes: 2 additions & 2 deletions docs/readme_en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ needs please refer to http://www.prestashop.com for more information.
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
International Registered Trademark & Property of PrestaShop SA

NAME: Prestashop 1.7.3.0
VERSION: 1.7.3.0
NAME: Prestashop 1.7.3.1
VERSION: 1.7.3.1

PREPARATION
===========
Expand Down
4 changes: 2 additions & 2 deletions docs/readme_es.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ needs please refer to http://www.prestashop.com for more information.
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
International Registered Trademark & Property of PrestaShop SA

NAME: Prestashop 1.7.3.0
VERSION: 1.7.3.0
NAME: Prestashop 1.7.3.1
VERSION: 1.7.3.1

PREPARACIÓN
===========
Expand Down
4 changes: 2 additions & 2 deletions docs/readme_fr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ needs please refer to http://www.prestashop.com for more information.
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
International Registered Trademark & Property of PrestaShop SA

NAME: Prestashop 1.7.3.0
VERSION: 1.7.3.0
NAME: Prestashop 1.7.3.1
VERSION: 1.7.3.1

PREPARATION
===========
Expand Down
4 changes: 2 additions & 2 deletions docs/readme_it.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ needs please refer to http://www.prestashop.com for more information.
@license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
International Registered Trademark & Property of PrestaShop SA

NAME: Prestashop 1.7.3.0
VERSION: 1.7.3.0
NAME: Prestashop 1.7.3.1
VERSION: 1.7.3.1

PREPARAZIONE
===========
Expand Down
Loading

0 comments on commit 0213db5

Please sign in to comment.