Skip to content

Commit

Permalink
Merge branch 'hotfix/2.1.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Nov 18, 2014
2 parents 00fdd58 + 7a89c58 commit a541d1d
Show file tree
Hide file tree
Showing 23 changed files with 118 additions and 45 deletions.
3 changes: 2 additions & 1 deletion system/modules/isotope/dca/tl_iso_product_collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
),
'label' => array
(
'fields' => array('document_number', 'locked', 'billing_address_id', 'grandTotal', 'order_status'),
'fields' => array('document_number', 'locked', 'billing_address_id', 'total', 'order_status'),
'showColumns' => true,
'label_callback' => array('Isotope\Backend\ProductCollection\Callback', 'getOrderLabel')
),
Expand Down Expand Up @@ -293,6 +293,7 @@
'total' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_iso_product_collection']['total'],
'sorting' => true,
'sql' => "decimal(12,2) NOT NULL default '0.00'",
),
'tax_free_total' => array
Expand Down
1 change: 1 addition & 0 deletions system/modules/isotope/dca/tl_member.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Add a child table to tl_member
*/
$GLOBALS['TL_DCA']['tl_member']['config']['ctable'][] = \Isotope\Model\Address::getTable();
$GLOBALS['TL_DCA']['tl_member']['config']['ondelete_callback'][] = array('\Isotope\Backend\Member\Callback', 'deleteMemberCart');


/**
Expand Down
2 changes: 1 addition & 1 deletion system/modules/isotope/dca/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
$GLOBALS['TL_DCA']['tl_module']['palettes']['iso_checkout'] = '{title_legend},name,headline,type;{config_legend},iso_checkout_method,iso_payment_modules,iso_shipping_modules,nc_notification;{redirect_legend},iso_forward_review,orderCompleteJumpTo,iso_cart_jumpTo;{template_legend},iso_collectionTpl,iso_orderCollectionBy,iso_gallery,iso_includeMessages;{iso_order_conditions_legend},iso_order_conditions,tableless,iso_order_conditions_position;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
$GLOBALS['TL_DCA']['tl_module']['palettes']['iso_checkoutmember'] = '{title_legend},name,headline,type;{config_legend},iso_checkout_method,iso_payment_modules,iso_shipping_modules,iso_addToAddressbook,nc_notification;{redirect_legend},iso_forward_review,orderCompleteJumpTo,iso_login_jumpTo,iso_cart_jumpTo;{template_legend},iso_collectionTpl,iso_orderCollectionBy,iso_gallery,iso_includeMessages;{iso_order_conditions_legend},iso_order_conditions,tableless,iso_order_conditions_position;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
$GLOBALS['TL_DCA']['tl_module']['palettes']['iso_checkoutguest'] = '{title_legend},name,headline,type;{config_legend},iso_checkout_method,iso_payment_modules,iso_shipping_modules,nc_notification;{redirect_legend},iso_forward_review,orderCompleteJumpTo,iso_cart_jumpTo;{template_legend},iso_collectionTpl,iso_orderCollectionBy,iso_gallery,iso_includeMessages;{iso_order_conditions_legend},iso_order_conditions,tableless,iso_order_conditions_position;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
$GLOBALS['TL_DCA']['tl_module']['palettes']['iso_checkoutboth'] = '{title_legend},name,headline,type;{config_legend},iso_checkout_method,iso_payment_modules,iso_shipping_modules,iso_addToAddressbook,nc_notification;{redirect_legend},iso_forward_review,orderCompleteJumpTo,iso_login_jumpTo,iso_cart_jumpTo;{template_legend},iso_collectionTpl,iso_orderCollectionBy,iso_gallery,tableless,iso_includeMessages;{iso_order_conditions_legend},iso_order_conditions,iso_order_conditions_position;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
$GLOBALS['TL_DCA']['tl_module']['palettes']['iso_checkoutboth'] = '{title_legend},name,headline,type;{config_legend},iso_checkout_method,iso_payment_modules,iso_shipping_modules,iso_addToAddressbook,nc_notification;{redirect_legend},iso_forward_review,orderCompleteJumpTo,iso_cart_jumpTo;{template_legend},iso_collectionTpl,iso_orderCollectionBy,iso_gallery,tableless,iso_includeMessages;{iso_order_conditions_legend},iso_order_conditions,iso_order_conditions_position;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
$GLOBALS['TL_DCA']['tl_module']['palettes']['iso_orderhistory'] = '{title_legend},name,headline,type;{config_legend},iso_config_ids;{redirect_legend},jumpTo;{template_legend},iso_includeMessages;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
$GLOBALS['TL_DCA']['tl_module']['palettes']['iso_orderdetails'] = '{title_legend},name,headline,type;{config_legend},iso_loginRequired;{template_legend},iso_collectionTpl,iso_orderCollectionBy,iso_gallery,iso_includeMessages;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
$GLOBALS['TL_DCA']['tl_module']['palettes']['iso_configswitcher'] = '{title_legend},name,headline,type;{config_legend},iso_config_ids;{template_legend},iso_includeMessages;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space';
Expand Down
17 changes: 17 additions & 0 deletions system/modules/isotope/docs/CHANGELOG-2.1.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
Isotope eCommerce Changelog
===========================

Version 2.1.9-stable (2014-11-18)
---------------------------------

### Improved
- Show error instead of confirm message if order status notification could not be sent
- Delete a member's cart when the member is deleted (#1296)
- Correctly select "use billing address" when shipping and billing address are the same
- Added log messages when toggling visibility of product and download (#1310)

### Fixed
- Order total was not shown in the backend order list (#1282)
- Always load language files in postsale script (#1281)
- Correctly format shipping addresses in checkout step (#1278)
- Shipping address was not available when billing address was automatically chosen (#1267)
- Reports daily summary showed incorrect number of orders (#1268)


Version 2.1.8-stable (2014-10-01)
---------------------------------

Expand Down
1 change: 1 addition & 0 deletions system/modules/isotope/languages/de/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
$GLOBALS['TL_LANG']['MSC']['timePeriod']['weeks'] = 'Wochen';
$GLOBALS['TL_LANG']['MSC']['timePeriod']['months'] = 'Monate';
$GLOBALS['TL_LANG']['MSC']['timePeriod']['years'] = 'Jahre';
$GLOBALS['TL_LANG']['MSC']['isotopeIntroductionLegend'] = 'Einführung';
$GLOBALS['TL_LANG']['MSC']['isotopeIntroduction'][0] = 'Willkommen zu Isotope eCommerce';
$GLOBALS['TL_LANG']['MSC']['isotopeIntroduction'][1] = 'Isotope ist die führende Open Source eCommerce Lösung für Contao.';
$GLOBALS['TL_LANG']['MSC']['isotopeIntroduction'][2] = 'Auf dieser Seite werden die meisten Einstellungen vorgenommen. <strong>Sie sollten am Ende der Seite starten und sich Schritt für Schritt von rechts unten nach links oben arbeiten.</strong>';
Expand Down
5 changes: 4 additions & 1 deletion system/modules/isotope/library/Isotope/Automator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ class Automator extends \Controller
public function deleteOldCarts()
{
$t = Cart::getTable();
$objCarts = Cart::findBy(array("$t.member=0", "$t.tstamp<?"), array(time() - $GLOBALS['TL_CONFIG']['iso_cartTimeout']));
$objCarts = Cart::findBy(
array("($t.member=0 AND $t.tstamp<?) OR $t.member NOT IN (SELECT id FROM tl_member)"),
array(time() - $GLOBALS['TL_CONFIG']['iso_cartTimeout'])
);

if (($intPurged = $this->deleteOldCollections($objCarts)) > 0) {
\System::log('Deleted ' . $intPurged . ' old guest carts', __METHOD__, TL_CRON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ public function toggleVisibility($intId, $blnVisible)
\Controller::redirect('contao/main.php?act=error');
}

$this->createInitialVersion('tl_iso_download', $intId);
$objVersions = new \Versions('tl_iso_download', $intId);
$objVersions->initialize();

// Trigger the save_callback
if (is_array($GLOBALS['TL_DCA']['tl_iso_download']['fields']['published']['save_callback'])) {
Expand All @@ -188,6 +189,7 @@ public function toggleVisibility($intId, $blnVisible)
// Update the database
\Database::getInstance()->prepare("UPDATE tl_iso_download SET published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);

$this->createNewVersion('tl_iso_download', $intId);
$objVersions->create();
$this->log('A new version of record "tl_iso_download.id='.$intId.'" has been created'.$this->getParentEntries('tl_iso_download', $intId), __METHOD__, TL_GENERAL);
}
}
17 changes: 17 additions & 0 deletions system/modules/isotope/library/Isotope/Backend/Member/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace Isotope\Backend\Member;

use Isotope\Isotope;
use Isotope\Model\ProductCollection\Cart;


class Callback extends \Backend
Expand Down Expand Up @@ -47,4 +48,20 @@ public function limitCountries($strTable)
$GLOBALS['TL_DCA']['tl_member']['fields']['country']['default'] = $arrCountryCodes[0];
}
}

/**
* Delete the cart when a member is deleted
*
* @param object $dc
*/
public function deleteMemberCart($dc)
{
$carts = Cart::findBy('member', $dc->id);

if (null !== $carts) {
foreach ($carts as $cart) {
$cart->delete();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ protected function toggleVisibility($intId, $blnVisible)
\Database::getInstance()->prepare("UPDATE tl_iso_product SET published='" . ($blnVisible ? 1 : '') . "' WHERE id=?")->execute($intId);

$objVersions->create();
$this->log('A new version of record "tl_iso_product.id='.$intId.'" has been created'.$this->getParentEntries('tl_iso_product', $intId), __METHOD__, TL_GENERAL);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function getOrderLabel($row, $label, \DataContainer $dc, $args)
$args[2] = $arrTokens['hcard_fn'];
}

$args[3] = Isotope::formatPriceWithCurrency($row['grandTotal']);
$args[3] = Isotope::formatPriceWithCurrency($row['total']);

/** @var \Isotope\Model\OrderStatus $objStatus */
if (($objStatus = $objOrder->getRelated('order_status')) !== null) {
Expand Down
13 changes: 9 additions & 4 deletions system/modules/isotope/library/Isotope/CheckoutStep/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected function generateOptions($blnValidate = false)

if (null === $objAddress || !\Model\Registry::getInstance()->isRegistered($objAddress)) {
$this->blnError = true;
} elseif ($blnValidate) {
} else {
$this->setAddress($objAddress);
}

Expand Down Expand Up @@ -254,13 +254,18 @@ protected function getWidgets()

/**
* Get options for all addresses in the user's address book
* @return array
*
* @param array $arrFields
*
* @return array
*/
protected function getAddressOptions()
protected function getAddressOptions($arrFields = null)
{
$arrOptions = array();

if (FE_USER_LOGGED_IN === true) {

/** @type AddressModel[] $arrAddresses */
$arrAddresses = $this->getAddresses();
$arrCountries = $this->getAddressCountries();

Expand All @@ -275,7 +280,7 @@ protected function getAddressOptions()

$arrOptions[] = array(
'value' => $objAddress->id,
'label' => $objAddress->generateHtml(),
'label' => $objAddress->generate($arrFields),
'default' => ($objAddress->id == $objDefault->id ? '1' : ''),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,14 @@ public function getNotificationTokens(IsotopeProductCollection $objCollection)

/**
* Get available address options
*
* @param array $arrFields
*
* @return array
*/
protected function getAddressOptions()
protected function getAddressOptions($arrFields = null)
{
$arrOptions = parent::getAddressOptions();
$arrOptions = parent::getAddressOptions(Isotope::getConfig()->getBillingFieldsConfig());

if (!empty($arrOptions)) {
$arrOptions[] = array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ public function getNotificationTokens(IsotopeProductCollection $objCollection)

/**
* Get available address options
* @return array
*
* @param array $arrFields
*
* @return array
*/
protected function getAddressOptions()
protected function getAddressOptions($arrFields = null)
{
$arrOptions = parent::getAddressOptions();
$arrOptions = parent::getAddressOptions(Isotope::getConfig()->getShippingFieldsConfig());

array_insert($arrOptions, 0, array(array(
'value' => '-1',
Expand Down Expand Up @@ -181,7 +184,10 @@ protected function getAddressCountries()
*/
protected function getAddress()
{
return Isotope::getCart()->getShippingAddress();
$billingAddress = Isotope::getCart()->getShippingAddress();
$shippingAddress = Isotope::getCart()->getShippingAddress();

return ($shippingAddress === $billingAddress) ? null : $shippingAddress;
}

/**
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.8';
const VERSION = '2.1.9';

/**
* True if the system has been initialized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function isExemptFromShipping()
*/
public function isVariant()
{
return ($this->hasVariants() && $this->pid > 0);
return ($this->pid > 0 && $this->hasVariants());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public function updateOrderStatus($intNewStatus)
\Message::addConfirmation($GLOBALS['TL_LANG']['tl_iso_product_collection']['orderStatusUpdate']);

if ($blnNotificationError === true) {
\Message::addConfirmation($GLOBALS['TL_LANG']['tl_iso_product_collection']['orderStatusNotificationError']);
\Message::addError($GLOBALS['TL_LANG']['tl_iso_product_collection']['orderStatusNotificationError']);
} elseif ($blnNotificationError === false) {
\Message::addConfirmation($GLOBALS['TL_LANG']['tl_iso_product_collection']['orderStatusNotificationSuccess']);
}
Expand Down
16 changes: 11 additions & 5 deletions system/modules/isotope/library/Isotope/Module/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,17 +382,20 @@ protected function canCheckout()
{
// Redirect to login page if not logged in
if ($this->iso_checkout_method == 'member' && FE_USER_LOGGED_IN !== true) {
$objPage = \Database::getInstance()->prepare("SELECT id,alias FROM tl_page WHERE id=?")->limit(1)->execute($this->iso_login_jumpTo);

if (!$objPage->numRows) {
/** @type \PageModel $objJump */
$objJump = \PageModel::findPublishedById($this->iso_login_jumpTo);

if (null === $objJump) {
$this->Template = new \Isotope\Template('mod_message');
$this->Template->type = 'error';
$this->Template->message = $GLOBALS['TL_LANG']['ERR']['isoLoginRequired'];

return false;
}

\Controller::redirect(\Controller::generateFrontendUrl($objPage->row()));
$objJump->loadDetails();
\Controller::redirect($objJump->getFrontendUrl(null, $objJump->language));

} elseif ($this->iso_checkout_method == 'guest' && FE_USER_LOGGED_IN === true) {
$this->Template = new \Isotope\Template('mod_message');
Expand All @@ -414,10 +417,13 @@ protected function canCheckout()
// Insufficient cart subtotal
if (Isotope::getCart()->hasErrors()) {
if ($this->iso_cart_jumpTo > 0) {
$objJump = \PageModel::findWithDetails($this->iso_cart_jumpTo);

/** @type \PageModel $objJump */
$objJump = \PageModel::findPublishedById($this->iso_cart_jumpTo);

if (null !== $objJump) {
\Controller::redirect(\Controller::generateFrontendUrl($objJump->row(), null, $objJump->language));
$objJump->loadDetails();
\Controller::redirect($objJump->getFrontendUrl(null, $objJump->language));
}
}

Expand Down
23 changes: 12 additions & 11 deletions system/modules/isotope/library/Isotope/Module/OrderHistory.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,21 @@ protected function compile()
return;
}

while ($objOrders->next()) {
Isotope::setConfig($objOrders->current()->getRelated('config_id'));
/** @type Order $objOrder */
foreach ($objOrders as $objOrder) {
Isotope::setConfig($objOrder->getRelated('config_id'));

$arrOrders[] = array
(
'collection' => $objOrders->current(),
'raw' => $objOrders->current()->row(),
'date' => Format::date($objOrders->current()->locked),
'time' => Format::time($objOrders->current()->locked),
'datime' => Format::datim($objOrders->current()->locked),
'grandTotal' => Isotope::formatPriceWithCurrency($objOrders->current()->getTotal()),
'status' => $objOrders->current()->getStatusLabel(),
'link' => ($this->jumpTo ? (\Haste\Util\Url::addQueryString('uid=' . $objOrders->current()->uniqid, $this->jumpTo)) : ''),
'class' => $objOrders->current()->getStatusAlias(),
'collection' => $objOrder,
'raw' => $objOrder->row(),
'date' => Format::date($objOrder->locked),
'time' => Format::time($objOrder->locked),
'datime' => Format::datim($objOrder->locked),
'grandTotal' => Isotope::formatPriceWithCurrency($objOrder->getTotal()),
'status' => $objOrder->getStatusLabel(),
'link' => ($this->jumpTo ? (\Haste\Util\Url::addQueryString('uid=' . $objOrder->uniqid, $this->jumpTo)) : ''),
'class' => $objOrder->getStatusAlias(),
);
}

Expand Down
6 changes: 2 additions & 4 deletions system/modules/isotope/postsale.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,8 @@ public function run()

// Set the current system to the language when the user placed the order.
// This will result in correct e-mails and payment description.
if ($GLOBALS['TL_LANGUAGE'] != $objOrder->language) {
$GLOBALS['TL_LANGUAGE'] = $objOrder->language;
\System::loadLanguageFile('default', $objOrder->language, true);
}
$GLOBALS['TL_LANGUAGE'] = $objOrder->language;
\System::loadLanguageFile('default', $objOrder->language, true);

Isotope::setConfig($objOrder->getRelated('config_id'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ protected function getDailySummary()
c.id AS config_id,
c.name AS config_name,
c.currency,
COUNT(o.id) AS total_orders,
COUNT(DISTINCT o.id) AS total_orders,
SUM(i.tax_free_price * i.quantity) AS total_sales,
SUM(i.quantity) AS total_items
FROM " . \Isotope\Model\ProductCollection::getTable() . " o
LEFT JOIN " . \Isotope\Model\ProductCollectionItem::getTable() . " i ON o.id=i.pid
LEFT OUTER JOIN " . \Isotope\Model\Config::getTable() . " c ON o.config_id=c.id
FROM tl_iso_product_collection o
LEFT JOIN tl_iso_product_collection_item i ON o.id=i.pid
LEFT OUTER JOIN tl_iso_config c ON o.config_id=c.id
WHERE o.type='order' AND o.order_status>0 AND o.locked>=?
" . ($arrAllowedProducts === true ? '' : (" AND i.product_id IN (" . (empty($arrAllowedProducts) ? '0' : implode(',', $arrAllowedProducts)) . ")")) . "
GROUP BY config_id
Expand Down
2 changes: 1 addition & 1 deletion system/modules/isotope_rules/dca/tl_iso_rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'label' => array
(
'fields' => array('name', 'code'),
'label' => '%s <span style="color:#b3b3b3; padding-left:3px;">[%s]</span>',
'format' => '%s <span style="color:#b3b3b3; padding-left:3px;">[%s]</span>',
),
'global_operations' => array
(
Expand Down
9 changes: 9 additions & 0 deletions system/modules/isotope_rules/library/Isotope/Model/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,16 @@ public static function findForCartWithCoupons()
return static::findByConditions(array("type='cart'", "enableCode='1'"));
}

/**
* @deprecated Deprecated since 2.1.9, to be removed in 3.0
* @see Rule::findActiveWithoutCoupons
*/
public static function findActiveWitoutCoupons()
{
return static::findActiveWithoutCoupons();
}

public static function findActiveWithoutCoupons()
{
return static::findByConditions(array("(type='product' OR (type='cart' AND enableCode=''))"));
}
Expand Down
Loading

0 comments on commit a541d1d

Please sign in to comment.