Page MenuHomeIn-Portal Phabricator

D175.id423.diff
No OneTemporary

File Metadata

Created
Wed, Feb 26, 9:05 AM

D175.id423.diff

Index: core/kernel/db/db_tag_processor.php
===================================================================
--- core/kernel/db/db_tag_processor.php
+++ core/kernel/db/db_tag_processor.php
@@ -17,6 +17,13 @@
class kDBTagProcessor extends kTagProcessor {
/**
+ * Mapping between "list_name" tag attribute values and generated Specials.
+ *
+ * @var array
+ */
+ protected $nameToSpecialMapping = array();
+
+ /**
* Returns true if "new" button was pressed in toolbar
*
* @param Array $params
@@ -306,9 +313,7 @@
{
$list_name = isset($params['list_name']) ? $params['list_name'] : '';
- $names_mapping = $this->Application->GetVar('NamesToSpecialMapping', Array ());
-
- if ( getArrayValue($names_mapping, $this->Prefix, $list_name) === false ) {
+ if ( getArrayValue($this->nameToSpecialMapping, $list_name) === false ) {
$list =& $this->GetList($params);
}
}
@@ -353,22 +358,15 @@
$requery = isset($params['requery']) && $params['requery'];
$main_list = array_key_exists('main_list', $params) && $params['main_list'];
- $names_mapping = $this->Application->GetVar('NamesToSpecialMapping', Array ());
-
- if ( !array_key_exists($this->Prefix, $names_mapping) ) {
- // create prefix-based array to special mapping storage
- $names_mapping[$this->Prefix] = Array ();
- }
-
if ( $list_name && !$requery ) {
// list with "list_name" parameter
- if ( !array_key_exists($list_name, $names_mapping[$this->Prefix]) ) {
+ if ( !array_key_exists($list_name, $this->nameToSpecialMapping) ) {
// special missing -> generate one
$special = $main_list ? $this->Special : $this->BuildListSpecial($params);
}
else {
// get special, formed during list initialization
- $special = $names_mapping[$this->Prefix][$list_name];
+ $special = $this->nameToSpecialMapping[$list_name];
}
}
else {
@@ -401,8 +399,7 @@
$this->Init($this->Prefix, $special);
if ( $list_name ) {
- $names_mapping[$this->Prefix][$list_name] = $special;
- $this->Application->SetVar('NamesToSpecialMapping', $names_mapping);
+ $this->nameToSpecialMapping[$list_name] = $special;
}
return $list;
Index: core/units/visits/visits_tag_processor.php
===================================================================
--- core/units/visits/visits_tag_processor.php
+++ core/units/visits/visits_tag_processor.php
@@ -171,12 +171,9 @@
$types = $this->SelectParam($params, 'types');
if ( $types == 'myvisitororders' || $types == 'myvisitors' ) {
- $special = 'incommerce';
- $names_mapping = $this->Application->GetVar('NamesToSpecialMapping', Array ());
- $names_mapping[$this->Prefix][$list_name] = $special;
- $this->Application->SetVar('NamesToSpecialMapping', $names_mapping);
+ $this->nameToSpecialMapping[$list_name] = 'incommerce';
}
return parent::GetList($params);
}
- }
\ No newline at end of file
+ }
Index: modules/in-commerce/units/products/products_tag_processor.php
===================================================================
--- modules/in-commerce/units/products/products_tag_processor.php
+++ modules/in-commerce/units/products/products_tag_processor.php
@@ -482,10 +482,9 @@
function PrepareSearchResults($params)
{
- $names_mapping = $this->Application->GetVar('NamesToSpecialMapping', Array ());
-
- if($this->Application->GetVar('search_type') == 'advanced' || !getArrayValue($names_mapping, $this->Prefix, 'search_results'))
- {
+ if ( $this->Application->GetVar('search_type') == 'advanced'
+ || !getArrayValue($this->nameToSpecialMapping, 'search_results')
+ ) {
$params = Array('list_name' => 'search_results',
'types' => 'search',
'parent_cat_id' => 'any',
@@ -858,4 +857,4 @@
return $url;
}
-}
\ No newline at end of file
+}

Event Timeline