Skip to content

Commit

Permalink
Merge branch 'hotfix/2.5.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Mar 19, 2019
2 parents e95d8b2 + e0f107f commit ae88db5
Show file tree
Hide file tree
Showing 18 changed files with 110 additions and 46 deletions.
2 changes: 1 addition & 1 deletion system/modules/isotope/dca/tl_iso_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
'eval' => array
(
'tl_class' => 'clr',
'buttons' => array('copy'=>false, 'delete'=>false),
'buttons' => array('new'=>false, 'copy'=>false, 'delete'=>false),
'columnFields' => array
(
'name' => array
Expand Down
14 changes: 14 additions & 0 deletions system/modules/isotope/docs/CHANGELOG-2.5.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Isotope eCommerce Changelog
===========================

Version 2.5.11-stable (2019-03-19)
----------------------------------

- Allow umlauts in coupon codes but correctly compare them in lowercase
- Fixed checkbox attributes not correctly rendering multiple items
- Disable "new" button on shop config address fields wizard
- Do not show variant-enabled product if it has no variants
- CSS class in product type was not added to reader or list (#2010)
- Fixed SQL GROUP_BY error when checking user permissions (#2019)
- Fixed SVG support and fallback icon in media manager (#2008)
- Fixed sorting of product variants by current page ID (#2001)
- Added database keyword validation for attribute field name (#1999)


Version 2.5.10-stable (2019-01-08)
----------------------------------

Expand Down
8 changes: 1 addition & 7 deletions system/modules/isotope/drivers/DC_ProductData.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,13 +709,7 @@ public function edit($intID = false, $ajaxId = false)
</div>
</div>
</form>
<script>
window.addEvent(\'domready\', function() {
Theme.focusInput("'.$this->strTable.'");
});
</script>';
</form>';

$copyFallback = $this->blnEditLanguage ? '&nbsp;&nbsp;::&nbsp;&nbsp;<a href="' . \Backend::addToUrl('act=copyFallback') . '" class="header_iso_copy" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['copyFallback']) . '" accesskey="d" onclick="Backend.getScrollOffset();">' . ($GLOBALS['TL_LANG']['MSC']['copyFallback'] ? $GLOBALS['TL_LANG']['MSC']['copyFallback'] : 'copyFallback') . '</a>' : '';

Expand Down
2 changes: 1 addition & 1 deletion system/modules/isotope/languages/de/tl_iso_attribute.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
</trans-unit>
<trans-unit id="tl_iso_attribute.optionsSource.foreignKey">
<source>Custom database table (foreignKey)</source>
<target>Eigene Datanbank-Tabelle (foreignKey)</target>
<target>Eigene Datenbank-Tabelle (foreignKey)</target>
</trans-unit>
<trans-unit id="tl_iso_attribute.optionsSource.attribute">
<source>Options Wizard (deprecated)</source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Isotope\Backend\Attribute;

use Contao\System;
use Isotope\Model\Attribute;
use Isotope\Model\AttributeOption;

Expand Down Expand Up @@ -83,6 +84,15 @@ public function validateFieldName($varValue)
throw new \InvalidArgumentException(sprintf($GLOBALS['TL_LANG']['ERR']['systemColumn'], $varValue));
}

if (method_exists('Contao\System', 'getContainer')) {
$platform = System::getContainer()->get('database_connection')->getDatabasePlatform();
$keywords = $platform->getReservedKeywordsList();

if ($keywords->isKeyword($varValue)) {
throw new \InvalidArgumentException(sprintf($GLOBALS['TL_LANG']['ERR']['systemColumn'], $varValue));
}
}

return $varValue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ public static function getAllowedIds()
}

$arrProducts = $objProducts->fetchEach('id');
$arrProducts = array_merge($arrProducts, \Database::getInstance()->getChildRecords($arrProducts, 'tl_iso_product'));
$arrProducts = array_merge(
$arrProducts,
\Database::getInstance()->execute(
"SELECT id FROM tl_iso_product WHERE language='' AND ".\Database::getInstance()->findInSet('pid', $arrProducts)
)->fetchEach('id')
);
}

// HOOK: allow extensions to define allowed products
Expand All @@ -195,8 +200,10 @@ public static function getAllowedIds()
}
}

$totalProducts = \Database::getInstance()->execute("SELECT COUNT(*) AS count FROM tl_iso_product WHERE language=''")->count;

// If all product are allowed, we don't need to filter
if ($arrProducts === true || count($arrProducts) == Product::countAll()) {
if ($arrProducts === true || count($arrProducts) == $totalProducts) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion system/modules/isotope/library/Isotope/Isotope.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Isotope extends \Controller
/**
* Isotope version
*/
const VERSION = '2.5.10';
const VERSION = '2.5.11';

/**
* True if the system has been initialized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public function saveToDCA(array &$arrData)
{
parent::saveToDCA($arrData);

$this->multiple = true;

if (!$this->variant_option && $this->optionsSource === IsotopeAttributeWithOptions::SOURCE_NAME) {
$arrData['fields'][$this->field_name]['eval']['multiple'] = false;
$arrData['fields'][$this->field_name]['sql'] = "char(1) NOT NULL default ''";
Expand Down
24 changes: 11 additions & 13 deletions system/modules/isotope/library/Isotope/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,19 +610,6 @@ protected static function buildFindQuery(array $arrOptions)
$arrFields[] = "{$arrOptions['table']}.$attribute AS {$attribute}_fallback";
}

$arrJoins[] = sprintf(
' LEFT OUTER JOIN %s c ON %s.id=c.pid',
ProductCategory::getTable(),
$arrOptions['table']
);


if ('c.sorting' === $arrOptions['order']) {
$arrFields[] = 'c.sorting';

$arrOptions['group'] = (null === $arrOptions['group'] ? '' : $arrOptions['group'].', ') . 'c.id';
}

if ($hasTranslations) {
$arrJoins[] = sprintf(
" LEFT OUTER JOIN %s translation ON %s.id=translation.pid AND translation.language='%s'",
Expand All @@ -642,6 +629,17 @@ protected static function buildFindQuery(array $arrOptions)
);
}

$arrJoins[] = sprintf(
' LEFT OUTER JOIN %s c ON %s=c.pid',
ProductCategory::getTable(),
($hasVariants ? "IFNULL(parent.id, {$arrOptions['table']}.id)" : "{$arrOptions['table']}.id")
);

if ('c.sorting' === $arrOptions['order']) {
$arrFields[] = 'c.sorting';

$arrOptions['group'] = (null === $arrOptions['group'] ? '' : $arrOptions['group'].', ') . 'c.id';
}

if ($objBase->hasRelations()) {
$intCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,43 @@ public function getCategories($blnPublished = false)
return $this->arrCategories[$key];
}

/**
* Gets the CSS ID for this product
*
* @return string|null
*/
public function getCssId()
{
$css = deserialize($this->cssID, true);

return $css[0] ? ' id="' . $css[0] . '"' : null;
}

/**
* Gets the CSS classes for this product
*
* @return string
*/
public function getCssClass()
{
$classes = ['product'];

if ($this->isNew()) {
$classes[] = 'new';
}

$arrCSS = deserialize($this->cssID, true);
if ('' !== (string) $arrCSS[1]) {
$classes[] = (string) $arrCSS[1];
}

if (null !== ($type = $this->getType()) && !empty($type->cssClass)) {
$classes[] = $type->cssClass;
}

return implode(' ', $classes);
}

/**
* @inheritDoc
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ public function isAvailableForCollection(IsotopeProductCollection $objCollection
return false;
}

if ($this->hasVariants() && !count($this->getVariantIds())) {
return false;
}

// Check if "advanced price" is available
if ($this->getType()->hasAdvancedPrices()
&& (in_array('price', $this->getType()->getAttributes(), true) || $this->hasVariantPrices())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* @property string $reader_template
* @property int $list_gallery
* @property int $reader_gallery
* @property string $cssClass
* @property array $attributes
* @property bool $variants
* @property array $variant_attributes
Expand Down
6 changes: 2 additions & 4 deletions system/modules/isotope/library/Isotope/Module/ProductList.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,9 @@ protected function compile()
\Controller::redirect($objProduct->generateUrl($arrConfig['jumpTo']));
}

$arrCSS = deserialize($objProduct->cssID, true);

$arrBuffer[] = array(
'cssID' => ($arrCSS[0] != '') ? ' id="' . $arrCSS[0] . '"' : '',
'class' => trim('product ' . ($objProduct->isNew() ? 'new ' : '') . $arrCSS[1]),
'cssID' => $objProduct->getCssId(),
'class' => $objProduct->getCssClass(),
'html' => $objProduct->generate($arrConfig),
'product' => $objProduct,
);
Expand Down
14 changes: 12 additions & 2 deletions system/modules/isotope/library/Isotope/Module/ProductReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Haste\Input\Input;
use Isotope\Interfaces\IsotopeProduct;
use Isotope\Model\Product;
use Isotope\Model\Product\AbstractProduct;

/**
* Class ProductReader
Expand Down Expand Up @@ -72,6 +73,7 @@ protected function compile()
global $objPage;
global $objIsotopeListPage;

/** @var AbstractProduct $objProduct */
$objProduct = Product::findAvailableByIdOrAlias(Input::getAutoItem('product'));

if (null === $objProduct) {
Expand Down Expand Up @@ -103,8 +105,8 @@ protected function compile()
$this->addCanonicalProductUrls($objProduct);

$this->Template->product = $objProduct->generate($arrConfig);
$this->Template->product_id = $this->getCssId($objProduct);
$this->Template->product_class = $this->getCssClass($objProduct);
$this->Template->product_id = $objProduct->getCssId();
$this->Template->product_class = $objProduct->getCssClass();
$this->Template->referer = 'javascript:history.go(-1)';
$this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
}
Expand Down Expand Up @@ -178,6 +180,8 @@ protected function addCanonicalProductUrls(Product $objProduct)
* @param Product $objProduct
*
* @return string|null
*
* @deprecated Use AbstractProduct::getCssId()
*/
protected function getCssId(Product $objProduct)
{
Expand All @@ -192,9 +196,15 @@ protected function getCssId(Product $objProduct)
* @param Product $objProduct
*
* @return string
*
* @deprecated Use AbstractProduct::getCssClass()
*/
protected function getCssClass(Product $objProduct)
{
if ($objProduct instanceof AbstractProduct) {
return $objProduct->getCssClass();
}

$classes = ['product'];

if ($objProduct->isNew()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,10 @@ public function generate()

$objFile = new \File($strFile);

if ($objFile->isGdImage) {
if ($objFile->isGdImage || $objFile->isSvgImage) {
$strPreview = \Image::get($strFile, 50, 50, 'box');
} else {
$strPreview = 'system/themes/' . \Backend::getTheme() . '/images/' . $objFile->icon;
$strPreview = 'assets/contao/images/' . $objFile->icon;
}

$strTranslateText = ($blnLanguage && 'all' !== $this->varValue[$i]['translate']) ? ' disabled="disabled"' : '';
Expand Down
10 changes: 0 additions & 10 deletions system/modules/isotope_rules/dca/tl_iso_rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,6 @@
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'maxlength'=>255),
'sql' => "varchar(255) NOT NULL default ''",
'save_callback' => array
(
function ($varValue) {
if (!preg_match('/^[a-z0-9 \.\-_]+$/iu', $varValue)) {
throw new \Exception(sprintf($GLOBALS['TL_LANG']['ERR']['alnum'], $GLOBALS['TL_LANG']['tl_iso_rule']['code'][0]));
}

return $varValue;
}
)
),
'limitPerMember' => array
(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private function addCoupon($coupon, array &$coupons)

if (null === $rule) {
Message::addError(sprintf($GLOBALS['TL_LANG']['MSC']['couponInvalid'], $coupon));
} elseif (in_array(strtolower($coupon), array_map('strtolower', $coupons), true)) {
} elseif (in_array(mb_strtolower($coupon), array_map('mb_strtolower', $coupons), true)) {
Message::addError(sprintf($GLOBALS['TL_LANG']['MSC']['couponDuplicate'], $coupon));
} else {
$coupons[] = $rule->code;
Expand Down
3 changes: 1 addition & 2 deletions system/modules/isotope_rules/library/Isotope/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ public function getCouponForm($objModule)
if (null === $objRule) {
$_SESSION['COUPON_FAILED'][$objModule->id] = sprintf($GLOBALS['TL_LANG']['MSC']['couponInvalid'], $strCoupon);
} else {

if (in_array(strtolower($strCoupon), array_map('strtolower', $arrCoupons), true)) {
if (in_array(mb_strtolower($strCoupon), array_map('mb_strtolower', $arrCoupons), true)) {
$_SESSION['COUPON_FAILED'][$objModule->id] = sprintf($GLOBALS['TL_LANG']['MSC']['couponDuplicate'], $strCoupon);
} else {
$arrCoupons[] = $objRule->code;
Expand Down

0 comments on commit ae88db5

Please sign in to comment.