Skip to content

Commit

Permalink
Merge branch 'hotfix/2.1.12' into support/2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Mar 17, 2015
2 parents ff8255b + 85d4f9c commit b162136
Show file tree
Hide file tree
Showing 16 changed files with 127 additions and 64 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 @@ -423,7 +423,7 @@
(
'label' => &$GLOBALS['TL_LANG']['tl_iso_config']['cartMinSubtotal'],
'exclude' => true,
'default' => '',
'default' => '0.00',
'inputType' => 'text',
'eval' => array('mandatory'=>true, 'maxlength'=>13, 'rgpx'=>'price', 'tl_class'=>'w50'),
'sql' => "decimal(12,2) NOT NULL default '0.00'",
Expand Down
18 changes: 18 additions & 0 deletions system/modules/isotope/docs/CHANGELOG-2.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
Isotope eCommerce Changelog
===========================

Version 2.1.12-stable (2015-03-17)
----------------------------------

### Improved
- Better Postfinance postsale handling
- Only filter by groups if one is set (fixes #1373)
- Check transaction status for PayOne payments (#1392)
- Better logging when notification for order status was not found (#1391)

### Fixed
- Filter fields could overwrite product properties if property was not customer defined/variant option
- Added missing collection ID to template (#1394)
- Default value for tl_iso_config.cartMinSubtotal was empty instead of decimal (#1367)
- Month and week reports were not correctly sorted across years (#1359)
- Category scope "product" in product list module should not be cached (#1383)
- Warning if products are not assigned to any category (#1398)


Version 2.1.11-stable (2015-02-10)
----------------------------------

Expand Down
2 changes: 1 addition & 1 deletion system/modules/isotope/drivers/DC_ProductData.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function showAll()
$this->procedure[] = "language=''";

// Display products filtered by group
if (!$this->intId) {
if (!$this->intId && $this->intGroupId > 0) {
$this->procedure[] = "gid IN(" . implode(',', array_map('intval', \Database::getInstance()->getChildRecords(array($this->intGroupId), \Isotope\Model\Group::getTable(), false, array($this->intGroupId)))) . ")";
}

Expand Down
14 changes: 13 additions & 1 deletion system/modules/isotope/library/Isotope/Frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,10 @@ public function storeCurrentArticle($objRow)
*/
public static function getPagesInCurrentRoot(array $arrPages, $objMember = null)
{
if (empty($arrPages)) {
return $arrPages;
}

global $objPage;

// $objPage not available, we dont know if the page is allowed
Expand All @@ -549,7 +553,15 @@ public static function getPagesInCurrentRoot(array $arrPages, $objMember = null)
}
}

foreach (array_diff($arrPages, $arrAvailable, $arrUnavailable) as $intPage) {
if (!isset($arrAvailable[$intMember])) {
$arrAvailable[$intMember] = array();
}

if (!isset($arrUnavailable[$intMember])) {
$arrUnavailable[$intMember] = array();
}

foreach (array_diff($arrPages, $arrUnavailable[$intMember], $arrUnavailable[$intMember]) as $intPage) {
$objPageDetails = \PageModel::findWithDetails($intPage);

// Page is not in the current root
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 @@ -36,7 +36,7 @@ class Isotope extends \Controller
/**
* Isotope version
*/
const VERSION = '2.1.11';
const VERSION = '2.1.12';

/**
* True if the system has been initialized
Expand Down
6 changes: 3 additions & 3 deletions system/modules/isotope/library/Isotope/Model/Payment/PSP.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function getPostsaleOrder()
return null;
}

return Order::findByPk($this->getRequestData('orderID'));
return Order::findByPk((int) $this->getRequestData('orderID'));
}

/**
Expand Down Expand Up @@ -199,10 +199,10 @@ protected function preparePSPParams($objOrder, $objModule)
private function getRequestData($strKey)
{
if ($this->psp_http_method == 'GET') {
return \Input::get($strKey);
return $_GET[$strKey];
}

return \Input::post($strKey);
return $_POST[$strKey];
}


Expand Down
16 changes: 12 additions & 4 deletions system/modules/isotope/library/Isotope/Model/Payment/Payone.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@ public function processPostsale(IsotopeProductCollection $objOrder)
die('TSOK');
}

if (\Input::post('txaction') != 'paid'
&& \Input::post('currency') != $objOrder->currency
&& \Input::post('balance') > 0
// Ignore all except these actions
if (\Input::post('txaction') != 'appointed'
&& \Input::post('txaction') != 'capture'
&& \Input::post('txaction') != 'paid'
) {
die('TSOK');
}

if (\Input::post('currency') != $objOrder->currency || \Input::post('balance') > 0) {
\System::log('PayOne order data mismatch for Order ID "' . \Input::post('invoice') . '"', __METHOD__, TL_ERROR);
die('TSOK');
}
Expand All @@ -50,7 +55,10 @@ public function processPostsale(IsotopeProductCollection $objOrder)
die('TSOK');
}

$objOrder->date_paid = time();
if (\Input::post('txaction') == 'paid') {
$objOrder->date_paid = time();
}

$objOrder->updateOrderStatus($this->new_order_status);

$objOrder->save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,24 @@ class Postfinance extends PSP implements IsotopePayment, IsotopePostsale
(
'AAVADDRESS',
'AAVCHECK',
'AAVMAIL',
'AAVNAME',
'AAVPHONE',
'AAVZIP',
'ACCEPTANCE',
'ALIAS',
'AMOUNT',
'BIC',
'BIN',
'BRAND',
'CARDNO',
'CCCTY',
'CN',
'COLLECTOR_BIC',
'COLLECTOR_IBAN',
'COMPLUS',
'CREATION_STATUS',
'CREDITDEBIT',
'CURRENCY',
'CVCCHECK',
'DCC_COMMPERCENTAGE',
Expand All @@ -68,25 +75,27 @@ class Postfinance extends PSP implements IsotopePayment, IsotopePostsale
'DIGESTCARDNO',
'ECI',
'ED',
'EMAIL',
'ENCCARDNO',
'FXAMOUNT',
'FXCURRENCY',
'IP',
'IPCTY',
'MANDATEID',
'MOBILEMODE',
'NBREMAILUSAGE',
'NBRIPUSAGE',
'NBRIPUSAGE_ALLTX',
'NBRUSAGE',
'NCERROR',
'NCERRORCARDNO',
'NCERRORCN',
'NCERRORCVC',
'NCERRORED',
'ORDERID',
'PAYID',
'PAYMENT_REFERENCE',
'PM',
'SCO_CATEGORY',
'SCORING',
'SEQUENCETYPE',
'SIGNDATE',
'STATUS',
'SUBBRAND',
'SUBSCRIPTION_ID',
Expand Down
49 changes: 29 additions & 20 deletions system/modules/isotope/library/Isotope/Model/ProductCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,7 @@ public function addToTemplate(\Isotope\Template $objTemplate, array $arrConfig =
$arrGalleries = array();
$arrItems = $this->addItemsToTemplate($objTemplate, $arrConfig['sorting']);

$objTemplate->id = $this->id;
$objTemplate->collection = $this;
$objTemplate->config = ($this->getRelated('config_id') || Isotope::getConfig());
$objTemplate->surcharges = \Isotope\Frontend::formatSurcharges($this->getSurcharges());
Expand Down Expand Up @@ -1338,30 +1339,38 @@ protected function generateDocumentNumber($strPrefix, $intDigits)
// Lock tables so no other order can get the same ID
\Database::getInstance()->lockTables(array(static::$strTable => 'WRITE'));

// Retrieve the highest available order ID
$objMax = \Database::getInstance()->prepare("
SELECT document_number
FROM " . static::$strTable . "
WHERE
type=?
" . ($strPrefix != '' ? " AND document_number LIKE '$strPrefix%'" : '') . "
AND store_id=?
ORDER BY CAST(" . ($strPrefix != '' ? "SUBSTRING(document_number, " . ($intPrefix+1) . ")" : 'document_number') . " AS UNSIGNED) DESC
")->limit(1)->execute(
array_search(get_called_class(), static::getModelTypes()),
Isotope::getCart()->store_id
);
try {
// Retrieve the highest available order ID
$objMax = \Database::getInstance()->prepare("
SELECT document_number
FROM " . static::$strTable . "
WHERE
type=?
" . ($strPrefix != '' ? " AND document_number LIKE '$strPrefix%'" : '') . "
AND store_id=?
ORDER BY CAST(" . ($strPrefix != '' ? "SUBSTRING(document_number, " . ($intPrefix + 1) . ")" : 'document_number') . " AS UNSIGNED) DESC
")->limit(1)->execute(
array_search(get_called_class(), static::getModelTypes()),
$this->store_id
);

$intMax = (int) substr($objMax->document_number, $intPrefix);
$intMax = (int) substr($objMax->document_number, $intPrefix);

$this->arrData['document_number'] = $strPrefix . str_pad($intMax + 1, $intDigits, '0', STR_PAD_LEFT);
}
$this->arrData['document_number'] = $strPrefix . str_pad($intMax + 1, $intDigits, '0', STR_PAD_LEFT);

\Database::getInstance()->prepare("
UPDATE " . static::$strTable . " SET document_number=? WHERE id=?
")->execute($this->arrData['document_number'], $this->id);

\Database::getInstance()->prepare("
UPDATE " . static::$strTable . " SET document_number=? WHERE id=?
")->execute($this->arrData['document_number'], $this->id);
\Database::getInstance()->unlockTables();

\Database::getInstance()->unlockTables();
} catch (\Exception $e) {
// Make sure tables are always unlocked
\Database::getInstance()->unlockTables();

throw $e;
}
}

return $this->arrData['document_number'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,12 @@ public function updateOrderStatus($intNewStatus)

if (in_array(false, $arrResult)) {
$blnNotificationError = true;
\System::log('Error sending status update notification for order ID ' . $this->id, __METHOD__, TL_ERROR);
} elseif (!empty($arrResult)) {
$blnNotificationError = false;
}
}

if ($blnNotificationError === true) {
\System::log('Error sending status update notification for order ID ' . $this->id, __METHOD__, TL_ERROR);
} else {
\System::log('Invalid notification for order status ID ' . $objNewStatus->id, __METHOD__, TL_ERROR);
}
}

Expand Down
8 changes: 5 additions & 3 deletions system/modules/isotope/library/Isotope/Module/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

namespace Isotope\Module;

use Haste\Input\Input;
use Haste\Util\Debug;
use Isotope\Isotope;
use Isotope\Model\Product;
use Module as Contao_Module;
Expand Down Expand Up @@ -57,8 +59,8 @@ public function __construct($objModule, $strColumn = 'main')

if (TL_MODE == 'FE') {
// Load Isotope javascript and css
$GLOBALS['TL_JAVASCRIPT'][] = \Haste\Util\Debug::uncompressedFile('system/modules/isotope/assets/js/isotope.min.js');
$GLOBALS['TL_CSS'][] = \Haste\Util\Debug::uncompressedFile('system/modules/isotope/assets/css/isotope.min.css');
$GLOBALS['TL_JAVASCRIPT'][] = Debug::uncompressedFile('system/modules/isotope/assets/js/isotope.min.js');
$GLOBALS['TL_CSS'][] = Debug::uncompressedFile('system/modules/isotope/assets/css/isotope.min.css');

// Disable caching for pages with certain modules (eg. Cart)
if ($this->blnDisableCache) {
Expand Down Expand Up @@ -134,7 +136,7 @@ protected function findCategories()
break;

case 'product':
$objProduct = Product::findAvailableByIdOrAlias(\Haste\Input\Input::getAutoItem('product'));
$objProduct = Product::findAvailableByIdOrAlias(Input::getAutoItem('product'));

if ($objProduct !== null) {
$arrCategories = $objProduct->getCategories(true);
Expand Down
16 changes: 12 additions & 4 deletions system/modules/isotope/library/Isotope/Module/ProductList.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Haste\Generator\RowClass;
use Haste\Http\Response\HtmlResponse;
use Isotope\Isotope;
use Isotope\Model\Attribute;
use Isotope\Model\Product;
use Isotope\Model\ProductCache;
use Isotope\Model\RequestCache;
Expand Down Expand Up @@ -74,7 +75,7 @@ public function generate()
$this->iso_productcache = deserialize($this->iso_productcache, true);

// Disable the cache in frontend preview or debug mode
if (BE_USER_LOGGED_IN === true || $GLOBALS['TL_CONFIG']['debugMode']) {
if (BE_USER_LOGGED_IN === true || $GLOBALS['TL_CONFIG']['debugMode'] || $this->iso_category_scope == 'product') {
$this->blnCacheProducts = false;
}

Expand Down Expand Up @@ -199,8 +200,7 @@ protected function compile()
return;
}

$arrBuffer = array();

$arrBuffer = array();
$arrDefaultOptions = $this->getDefaultProductOptions();

foreach ($arrProducts as $objProduct) {
Expand Down Expand Up @@ -410,11 +410,19 @@ protected function getFiltersAndSorting($blnNativeSQL = true)
*/
protected function getDefaultProductOptions()
{
$arrFields = array_merge(Attribute::getVariantOptionFields(), Attribute::getCustomerDefinedFields());

if (empty($arrFields)) {
return array();
}

$arrOptions = array();
$arrFilters = Isotope::getRequestCache()->getFiltersForModules($this->iso_filterModules);

foreach ($arrFilters as $arrConfig) {
if ($arrConfig['operator'] == '=' || $arrConfig['operator'] == '==' || $arrConfig['operator'] == 'eq') {
if (in_array($arrConfig['attribute'], $arrFields)
&& ($arrConfig['operator'] == '=' || $arrConfig['operator'] == '==' || $arrConfig['operator'] == 'eq')
) {
$arrOptions[$arrConfig['attribute']] = $arrConfig['value'];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace Isotope\Module;

use Haste\Input\Input;
use Isotope\Model\Product;
use Isotope\Model\RelatedProduct;

Expand Down Expand Up @@ -51,7 +52,7 @@ public function generate()
return $objTemplate->parse();
}

if (!\Haste\Input\Input::getAutoItem('product', false, true)) {
if (!Input::getAutoItem('product', false, true)) {
return '';
}

Expand All @@ -77,7 +78,7 @@ protected function findProducts($arrCacheIds = null)
{
$arrIds = array(0);

$objProduct = Product::findAvailableByIdOrAlias(\Haste\Input\Input::getAutoItem('product'));
$objProduct = Product::findAvailableByIdOrAlias(Input::getAutoItem('product'));

if (null === $objProduct) {
return array();
Expand Down
Loading

0 comments on commit b162136

Please sign in to comment.