Attached Files |
prev_next_navigation_core.patch [^] (6,773 bytes) 2011-09-27 06:55
[Show Content]
Index: kernel/db/cat_tag_processor.php
===================================================================
--- kernel/db/cat_tag_processor.php (revision 14476)
+++ kernel/db/cat_tag_processor.php (working copy)
@@ -89,12 +89,12 @@
$params['pass'] = 'm,'.$this->Prefix;
}
- $item_id = isset($params[$id_prefix.'_id']) && $params[$id_prefix.'_id'];
- if (!$item_id) {
- $item_id = $this->Application->GetVar($this->getPrefixSpecial().'_id');
- if (!$item_id) {
- $item_id = $this->Application->GetVar($this->Prefix.'_id');
- }
+ // set by PrintList2 tag
+ $item_id = $this->Application->GetVar($this->getPrefixSpecial() . '_id');
+
+ if ( !$item_id && ($this->Special != 'next' && $this->Special != 'previous') ) {
+ // set from page url
+ $item_id = $this->Application->GetVar($this->Prefix . '_id');
}
$object =& $this->getObject($params);
Index: kernel/db/db_event_handler.php
===================================================================
--- kernel/db/db_event_handler.php (revision 14476)
+++ kernel/db/db_event_handler.php (working copy)
@@ -221,6 +221,16 @@
$event->setEventParam('raise_warnings', 1);
}
+ if ( $event->Special == 'previous' || $event->Special == 'next' ) {
+ $object =& $this->Application->recallObject( $event->getEventParam('item') );
+ /* @var $object kDBItem */
+
+ $list_helper =& $this->Application->recallObject('ListHelper');
+ /* @var $list_helper ListHelper */
+
+ return $list_helper->getNavigationResource($object, $event->getEventParam('list'), $event->Special == 'next');
+ }
+
if (preg_match('/^auto-(.*)/', $event->Special, $regs) && $this->Application->prefixRegistred($regs[1])) {
// <inp2:lang.auto-phrase_Field name="DateFormat"/> - returns field DateFormat value from language (LanguageId is extracted from current phrase object)
$main_object =& $this->Application->recallObject($regs[1]);
@@ -1011,6 +1021,9 @@
$this->Application->ConfigValue($sorting_configs['DefaultSorting1Field']) => $this->Application->ConfigValue($sorting_configs['DefaultSorting1Dir']),
$this->Application->ConfigValue($sorting_configs['DefaultSorting2Field']) => $this->Application->ConfigValue($sorting_configs['DefaultSorting2Dir']),
);
+
+ // TODO: lowercase configuration variable values in db, instead of here
+ $list_sortings[$sorting_prefix]['Sorting'] = array_map('strtolower', $list_sortings[$sorting_prefix]['Sorting']);
}
// use default if not specified in session
Index: kernel/db/db_tag_processor.php
===================================================================
--- kernel/db/db_tag_processor.php (revision 14476)
+++ kernel/db/db_tag_processor.php (working copy)
@@ -606,6 +606,42 @@
}
/**
+ * Returns ID of previous record (related to current) in list.
+ * Use only on item detail pages.
+ *
+ * @param Array $params
+ * @return int
+ */
+ function PreviousResource($params)
+ {
+ $object =& $this->getObject($params);
+ /* @var $object kDBItem */
+
+ $list_helper =& $this->Application->recallObject('ListHelper');
+ /* @var $list_helper ListHelper */
+
+ return $list_helper->getNavigationResource($object, $params['list'], false);
+ }
+
+ /**
+ * Returns ID of next record (related to current) in list.
+ * Use only on item detail pages.
+ *
+ * @param Array $params
+ * @return int
+ */
+ function NextResource($params)
+ {
+ $object =& $this->getObject($params);
+ /* @var $object kDBItem */
+
+ $list_helper =& $this->Application->recallObject('ListHelper');
+ /* @var $list_helper ListHelper */
+
+ return $list_helper->getNavigationResource($object, $params['list'], true);
+ }
+
+ /**
* Allows to modify block params & current list record before PrintList parses record
*
* @param kDBList $object
Index: units/helpers/list_helper.php
===================================================================
--- units/helpers/list_helper.php (revision 14476)
+++ units/helpers/list_helper.php (working copy)
@@ -122,4 +122,79 @@
}
return $user_sorting_start;
}
+
+ /**
+ * Returns ID of previous/next record related to current record
+ *
+ * @param kDBItem $object
+ * @param string $list_prefix
+ * @param bool $next
+ * @return int
+ */
+ function getNavigationResource(&$object, $list_prefix, $next = true, $select_fields = null)
+ {
+ $list =& $this->Application->recallObject($list_prefix);
+ /* @var $list kDBList */
+
+ if (!isset($select_fields)) {
+ $select_fields = '%1$s.' . $object->IDField;
+ }
+
+ if (is_array($select_fields)) {
+ $select_fields = implode(', ', $select_fields);
+ }
+
+ $list->SelectClause = str_replace(Array ('%1$s.*', '%2$s'), Array ($select_fields, ''), $list->SelectClause);
+
+ $operators = Array (
+ 'asc' => $next ? '>' : '<',
+ 'desc' => $next ? '<' : '>',
+ );
+
+ $where_clause = Array ();
+ $order_fields_backup = $list->OrderFields;
+ $lang = $this->Application->GetVar('m_lang');
+
+ foreach ($list->OrderFields as $index => $order) {
+ $where_clause[$index] = Array ();
+
+ if (!$next) {
+ $list->OrderFields[$index][1] = $order_fields_backup[$index][1] == 'asc' ? 'desc' : 'asc';
+ }
+
+ for ($i = 0; $i <= $index; $i++) {
+ $order_field = $order_fields_backup[$i][0];
+ $is_expression = $order_fields_backup[$i][2];
+
+ if ( preg_match('/^IF\(COALESCE\(.*?\.(l' . $lang . '_.*?), ""\),/', $order_field, $regs) ) {
+ // undo result of kDBList::getMLSortField method
+ $order_field = $regs[1];
+ $is_expression = false;
+ }
+
+ $order_direction = $order_fields_backup[$i][1];
+
+ $field_prefix = array_key_exists($order_field, $list->VirtualFields) || $is_expression ? '' : '%1$s.';
+
+ $actual_operator = $i == $index ? $operators[$order_direction] : '=';
+ $where_clause[$index][] = $field_prefix . $order_field . ' ' . $actual_operator . ' ' . $this->Conn->qstr( $object->GetDBField($order_field) );
+ }
+
+ $where_clause[$index] = '(' . implode(') AND (', $where_clause[$index]) . ')';
+ }
+
+ $where_clause = '(%1$s.' . $object->IDField . ' != ' . $object->GetID() . ') AND ((' . implode(') OR (', $where_clause) . '))';
+ $list->addFilter('navigation_filter', $where_clause);
+
+ $sql = $list->extractCalculatedFields( $list->GetSelectSQL() );
+
+ $list->removeFilter('navigation_filter');
+ $list->OrderFields = $order_fields_backup;
+
+ if ( $this->Application->isDebugMode() ) {
+ $this->Application->Debugger->appendHTML('Quering <strong>' . ($next ? 'next' : 'previous') . '</strong> item for "<strong>' . $list_prefix . '</strong>" list:');
+ }
+
+ return $this->Conn->GetOne($sql);
+ }
}
\ No newline at end of file
prev_next_navigation_themes.patch [^] (2,266 bytes) 2011-09-27 06:55
[Show Content]
Index: in-commerce/products/product_detail.tpl
===================================================================
--- in-commerce/products/product_detail.tpl (revision 14476)
+++ in-commerce/products/product_detail.tpl (working copy)
@@ -49,6 +49,9 @@
<table class="fullwidth table-border">
<tr>
<td class="item-padding">
+ <inp2:m_RenderElement name="prev_next_element" prefix="p" id_field="ProductId" title_field="Name" special="product-navigation" item_name="Product" main_list="1"/>
+ <br/>
+
<img src="<inp2:m_TemplatesBase module="In-Commerce"/>img/shopping_cart_item.gif" alt=""/> <span class="text-title"><inp2:p_Field name="Name"/></span>
<inp2:m_if check="p_Field" name="IsHot"><img src="<inp2:m_TemplatesBase module="In-Portal"/>img/icon_hot.gif" alt="<inp2:m_Phrase name="lu_Hot" no_editing="1"/>"/></inp2:m_if>
Index: platform/elements/content_boxes.elm.tpl
===================================================================
--- platform/elements/content_boxes.elm.tpl (revision 14476)
+++ platform/elements/content_boxes.elm.tpl (working copy)
@@ -172,4 +172,24 @@
<a href="<inp2:DownloadFileLink />"><inp2:Field name="FileName"/></a>
</td>
<tr>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement no_editing="1" name="prev_next_element" prefix="" id_field="" title_field="" special="product-navigation" item_name="" main_list="">
+ <inp2:{$prefix}.{$special}_InitList per_page="-1" main_list="$main_list" skip_quering="1"/>
+
+ <div>
+ <strong><inp2:m_Phrase name="lu_Previous{$item_name}"/>:</strong>
+ <inp2:m_if check="{$prefix}.previous_Field" name="$id_field" item="$prefix" list="{$prefix}.{$special}">
+ <a href="<inp2:{$prefix}.previous_ItemLink template='__default__'/>"><inp2:{$prefix}.previous_Field name="$title_field"/></a>
+ <inp2:m_else/>
+ None
+ </inp2:m_if>
+
+ <strong><inp2:m_Phrase name="lu_Next{$item_name}"/>:</strong>
+ <inp2:m_if check="{$prefix}.next_Field" name="$id_field" item="$prefix" list="{$prefix}.{$special}">
+ <a href="<inp2:{$prefix}.next_ItemLink template='__default__'/>"><inp2:{$prefix}.next_Field name="$title_field"/></a>
+ <inp2:m_else/>
+ None
+ </inp2:m_if>
+ </div>
</inp2:m_DefineElement>
\ No newline at end of file
prev_next_navigation_core_520.patch [^] (11,814 bytes) 2011-10-06 10:36
[Show Content]
Index: kernel/db/cat_tag_processor.php
===================================================================
--- kernel/db/cat_tag_processor.php (revision 14628)
+++ kernel/db/cat_tag_processor.php (working copy)
@@ -90,12 +90,12 @@
$params['pass'] = 'm,'.$this->Prefix;
}
- $item_id = isset($params[$id_prefix.'_id']) && $params[$id_prefix.'_id'];
- if (!$item_id) {
- $item_id = $this->Application->GetVar($this->getPrefixSpecial().'_id');
- if (!$item_id) {
- $item_id = $this->Application->GetVar($this->Prefix.'_id');
- }
+ // set by PrintList2 tag
+ $item_id = $this->Application->GetVar($this->getPrefixSpecial() . '_id');
+
+ if ( !$item_id && ($this->Special != 'next' && $this->Special != 'previous') ) {
+ // set from page url
+ $item_id = $this->Application->GetVar($this->Prefix . '_id');
}
$object =& $this->getObject($params);
Index: kernel/db/db_event_handler.php
===================================================================
--- kernel/db/db_event_handler.php (revision 14632)
+++ kernel/db/db_event_handler.php (working copy)
@@ -203,6 +203,16 @@
$event->setEventParam('raise_warnings', 1);
}
+ if ( $event->Special == 'previous' || $event->Special == 'next' ) {
+ $object =& $this->Application->recallObject( $event->getEventParam('item') );
+ /* @var $object kDBItem */
+
+ $list_helper =& $this->Application->recallObject('ListHelper');
+ /* @var $list_helper ListHelper */
+
+ return $list_helper->getNavigationResource($object, $event->getEventParam('list'), $event->Special == 'next');
+ }
+
if (preg_match('/^auto-(.*)/', $event->Special, $regs) && $this->Application->prefixRegistred($regs[1])) {
// <inp2:lang.auto-phrase_Field name="DateFormat"/> - returns field DateFormat value from language (LanguageId is extracted from current phrase object)
$main_object =& $this->Application->recallObject($regs[1]);
@@ -1010,6 +1020,9 @@
$this->Application->ConfigValue($sorting_configs['DefaultSorting1Field']) => $this->Application->ConfigValue($sorting_configs['DefaultSorting1Dir']),
$this->Application->ConfigValue($sorting_configs['DefaultSorting2Field']) => $this->Application->ConfigValue($sorting_configs['DefaultSorting2Dir']),
);
+
+ // TODO: lowercase configuration variable values in db, instead of here
+ $list_sortings[$sorting_prefix]['Sorting'] = array_map('strtolower', $list_sortings[$sorting_prefix]['Sorting']);
}
// use default if not specified in session
Index: kernel/db/db_tag_processor.php
===================================================================
--- kernel/db/db_tag_processor.php (revision 14614)
+++ kernel/db/db_tag_processor.php (working copy)
@@ -591,6 +591,44 @@
}
/**
+ * Returns ID of previous record (related to current) in list.
+ * Use only on item detail pages.
+ *
+ * @param Array $params
+ * @return int
+ * @access protected
+ */
+ protected function PreviousResource($params)
+ {
+ $object =& $this->getObject($params);
+ /* @var $object kDBItem */
+
+ $list_helper =& $this->Application->recallObject('ListHelper');
+ /* @var $list_helper ListHelper */
+
+ return $list_helper->getNavigationResource($object, $params['list'], false);
+ }
+
+ /**
+ * Returns ID of next record (related to current) in list.
+ * Use only on item detail pages.
+ *
+ * @param Array $params
+ * @return int
+ * @access protected
+ */
+ protected function NextResource($params)
+ {
+ $object =& $this->getObject($params);
+ /* @var $object kDBItem */
+
+ $list_helper =& $this->Application->recallObject('ListHelper');
+ /* @var $list_helper ListHelper */
+
+ return $list_helper->getNavigationResource($object, $params['list'], true);
+ }
+
+ /**
* Allows to modify block params & current list record before PrintList parses record
*
* @param kDBList $object
Index: kernel/db/dblist.php
===================================================================
--- kernel/db/dblist.php (revision 14602)
+++ kernel/db/dblist.php (working copy)
@@ -314,7 +314,7 @@
self::HAVING_FILTER => 'HavingFilter',
self::AGGREGATE_FILTER => 'AggregateFilter'
);
-
+
$filter_name = $filter_source[$filter_type];
$filter =& $this->$filter_name;
@@ -346,7 +346,7 @@
$filter =& $this->$filter_name;
$filter =& $filter[$filter_scope];
/* @var $filter kMultipleFilter */
-
+
return $filter->getFilter($name);
}
@@ -371,7 +371,7 @@
$filter =& $this->$filter_name;
$filter =& $filter[$filter_scope];
/* @var $filter kMultipleFilter */
-
+
$filter->removeFilter($name);
}
@@ -702,14 +702,14 @@
}
/**
- * Replaces all calculated field occurences with their associated expressions
+ * Replaces all calculated field occurrences with their associated expressions
*
* @param string $clause where clause to extract calculated fields from
* @param int $aggregated 0 - having + aggregated, 1 - having only, 2 - aggregated only
* @return string
- * @access private
+ * @access public
*/
- private function extractCalculatedFields($clause, $aggregated = 1)
+ public function extractCalculatedFields($clause, $aggregated = 1)
{
$fields = $this->getCalculatedFields($aggregated);
if (is_array($fields) && count($fields) > 0) {
@@ -733,7 +733,7 @@
{
$where =& $this->Application->makeClass('kMultipleFilter');
/* @var $where kMultipleFilter */
-
+
$where->addFilter('system_where', $this->WhereFilter[self::FLT_SYSTEM] );
if (!$system_filters_only) {
@@ -748,7 +748,7 @@
// CUSTOM
$search_w = $this->WhereFilter[self::FLT_CUSTOM]->getSQL();
-
+
if ($search_w || $for_counting) { // move search_having to search_where in case search_where isset or we are counting
$search_h = $this->extractCalculatedFields( $this->HavingFilter[self::FLT_CUSTOM]->getSQL() );
$search_w = ($search_w && $search_h) ? $search_w.' AND '.$search_h : $search_w.$search_h;
@@ -845,13 +845,14 @@
}
/**
- * Adds order field to ORDER BY clause
- *
- * @param string $field Field name
- * @param string $direction Direction of ordering (asc|desc)
- * @param bool $is_expression this is expression, that should not be escapted by "`" symbols
- * @access public
- */
+ * Adds order field to ORDER BY clause
+ *
+ * @param string $field Field name
+ * @param string $direction Direction of ordering (asc|desc)
+ * @param bool $is_expression this is expression, that should not be escapted by "`" symbols
+ * @return int
+ * @access public
+ */
public function AddOrderField($field, $direction = 'asc', $is_expression = false)
{
// original multilanguage field - convert to current lang field
@@ -868,9 +869,40 @@
}
$this->OrderFields[] = Array($field, $direction, $is_expression);
+
+ return count($this->OrderFields) - 1;
}
/**
+ * Sets new order fields, replacing existing ones
+ *
+ * @param Array $order_fields
+ * @return void
+ * @access public
+ */
+ public function setOrderFields($order_fields)
+ {
+ $this->OrderFields = $order_fields;
+ }
+
+ /**
+ * Changes sorting direction for a given sorting field index
+ *
+ * @param int $field_index
+ * @param string $direction
+ * @return void
+ * @access public
+ */
+ public function changeOrderDirection($field_index, $direction)
+ {
+ if ( !isset($this->OrderFields[$field_index]) ) {
+ return;
+ }
+
+ $this->OrderFields[$field_index][1] = $direction;
+ }
+
+ /**
* Returns expression, used to sort given multilingual field
*
* @param string $field
@@ -954,6 +986,17 @@
}
/**
+ * Returns list order fields
+ *
+ * @return Array
+ * @access public
+ */
+ public function getOrderFields()
+ {
+ return $this->OrderFields;
+ }
+
+ /**
* Returns order field direction in given position
*
* @param int $pos
@@ -1504,7 +1547,7 @@
/**
* Detects relations between LEFT JOINs
- *
+ *
* @return void
* @access private
*/
@@ -1527,7 +1570,7 @@
/**
* Removes scheduled LEFT JOINs, but only if they are not protected
- *
+ *
* @return void
* @access private
*/
@@ -1544,7 +1587,7 @@
/**
* Schedules unused LEFT JOINs to for removal
- *
+ *
* @return void
* @access private
*/
Index: units/helpers/list_helper.php
===================================================================
--- units/helpers/list_helper.php (revision 14628)
+++ units/helpers/list_helper.php (working copy)
@@ -33,7 +33,7 @@
$sort_fields = is_array($sorting) ? array_keys($sorting) : Array ();
for ($order_number = 0; $order_number < 2; $order_number++) {
- // currect sorting in list
+ // current sorting in list
$sorting_pos = $user_sorting_start + $order_number;
$current_order_field = $list->GetOrderField($sorting_pos, true);
$current_order_direction = $list->GetOrderDirection($sorting_pos, true);
@@ -120,6 +120,82 @@
if ( $forced_sorting = getArrayValue($list_sortings, $sorting_prefix, 'ForcedSorting') ) {
$user_sorting_start = count($forced_sorting);
}
+
return $user_sorting_start;
}
+
+ /**
+ * Returns ID of previous/next record related to current record
+ *
+ * @param kDBItem $object
+ * @param string $list_prefix
+ * @param bool $next
+ * @return int
+ */
+ function getNavigationResource(&$object, $list_prefix, $next = true, $select_fields = null)
+ {
+ $list =& $this->Application->recallObject($list_prefix);
+ /* @var $list kDBList */
+
+ if ( !isset($select_fields) ) {
+ $select_fields = '%1$s.' . $object->IDField;
+ }
+
+ if ( is_array($select_fields) ) {
+ $select_fields = implode(', ', $select_fields);
+ }
+
+ $list->SetSelectSQL( str_replace(Array ('%1$s.*', '%2$s'), Array ($select_fields, ''), $list->GetPlainSelectSQL()) );
+
+ $operators = Array (
+ 'asc' => $next ? '>' : '<',
+ 'desc' => $next ? '<' : '>',
+ );
+
+ $where_clause = Array ();
+ $lang = $this->Application->GetVar('m_lang');
+ $order_fields = $order_fields_backup = $list->getOrderFields();
+
+ foreach ($order_fields as $index => $order) {
+ $where_clause[$index] = Array ();
+
+ if ( !$next ) {
+ $list->changeOrderDirection($index, $order_fields_backup[$index][1] == 'asc' ? 'desc' : 'asc');
+ }
+
+ for ($i = 0; $i <= $index; $i++) {
+ $order_field = $order_fields_backup[$i][0];
+ $is_expression = $order_fields_backup[$i][2];
+
+ if ( preg_match('/^IF\(COALESCE\(.*?\.(l' . $lang . '_.*?), ""\),/', $order_field, $regs) ) {
+ // undo result of kDBList::getMLSortField method
+ $order_field = $regs[1];
+ $is_expression = false;
+ }
+
+ $order_direction = $order_fields_backup[$i][1];
+
+ $field_prefix = $list->isVirtualField($order_field) || $is_expression ? '' : '%1$s.';
+
+ $actual_operator = $i == $index ? $operators[$order_direction] : '=';
+ $where_clause[$index][] = $field_prefix . $order_field . ' ' . $actual_operator . ' ' . $this->Conn->qstr($object->GetDBField($order_field));
+ }
+
+ $where_clause[$index] = '(' . implode(') AND (', $where_clause[$index]) . ')';
+ }
+
+ $where_clause = '(%1$s.' . $object->IDField . ' != ' . $object->GetID() . ') AND ((' . implode(') OR (', $where_clause) . '))';
+ $list->addFilter('navigation_filter', $where_clause);
+
+ $sql = $list->extractCalculatedFields($list->GetSelectSQL());
+
+ $list->removeFilter('navigation_filter');
+ $list->setOrderFields($order_fields_backup);
+
+ if ( $this->Application->isDebugMode() ) {
+ $this->Application->Debugger->appendHTML('Quering <strong>' . ($next ? 'next' : 'previous') . '</strong> item for "<strong>' . $list_prefix . '</strong>" list:');
+ }
+
+ return $this->Conn->GetOne($sql);
+ }
}
\ No newline at end of file
prev_next_fixes.patch [^] (3,153 bytes) 2011-11-22 10:36
[Show Content]
Index: kernel/db/cat_event_handler.php
===================================================================
--- kernel/db/cat_event_handler.php (revision 14780)
+++ kernel/db/cat_event_handler.php (working copy)
@@ -2629,7 +2629,9 @@
/* @var $object kDBItem */
if ( !$object->isLoaded() ) {
- $this->_errorNotFound($event);
+ if ( $event->Special != 'previous' && $event->Special != 'next' ) {
+ $this->_errorNotFound($event);
+ }
return true;
}
Index: kernel/db/db_event_handler.php
===================================================================
--- kernel/db/db_event_handler.php (revision 14768)
+++ kernel/db/db_event_handler.php (working copy)
@@ -211,7 +211,9 @@
$list_helper =& $this->Application->recallObject('ListHelper');
/* @var $list_helper ListHelper */
- return $list_helper->getNavigationResource($object, $event->getEventParam('list'), $event->Special == 'next');
+ $select_clause = $this->Application->getUnitOption($object->Prefix, 'NavigationSelectClause', null);
+
+ return $list_helper->getNavigationResource($object, $event->getEventParam('list'), $event->Special == 'next', $select_clause);
}
if (preg_match('/^auto-(.*)/', $event->Special, $regs) && $this->Application->prefixRegistred($regs[1])) {
Index: kernel/db/db_tag_processor.php
===================================================================
--- kernel/db/db_tag_processor.php (revision 14769)
+++ kernel/db/db_tag_processor.php (working copy)
@@ -606,7 +606,9 @@
$list_helper =& $this->Application->recallObject('ListHelper');
/* @var $list_helper ListHelper */
- return $list_helper->getNavigationResource($object, $params['list'], false);
+ $select_clause = $this->Application->getUnitOption($object->Prefix, 'NavigationSelectClause', null);
+
+ return $list_helper->getNavigationResource($object, $params['list'], false, $select_clause);
}
/**
@@ -625,7 +627,9 @@
$list_helper =& $this->Application->recallObject('ListHelper');
/* @var $list_helper ListHelper */
- return $list_helper->getNavigationResource($object, $params['list'], true);
+ $select_clause = $this->Application->getUnitOption($object->Prefix, 'NavigationSelectClause', null);
+
+ return $list_helper->getNavigationResource($object, $params['list'], true, $select_clause);
}
/**
Index: units/helpers/list_helper.php
===================================================================
--- units/helpers/list_helper.php (revision 14768)
+++ units/helpers/list_helper.php (working copy)
@@ -204,7 +204,8 @@
$where_clause = '(%1$s.' . $object->IDField . ' != ' . $object->GetID() . ') AND ((' . implode(') OR (', $where_clause) . '))';
$list->addFilter('navigation_filter', $where_clause);
- $sql = $list->extractCalculatedFields($list->GetSelectSQL());
+ // do extractCalculatedFields (transforms having into where), since we don't select fields from JOINed tables
+ $sql = str_replace('%1$s', $list->TableName, $list->extractCalculatedFields($list->GetSelectSQL()));
$list->removeFilter('navigation_filter');
$list->setOrderFields($order_fields_backup);
|