* Fix bug #34677.
This commit is contained in:
+25
-25
@@ -6240,12 +6240,13 @@ class storyModel extends model
|
||||
}
|
||||
|
||||
/* Get stories. */
|
||||
$stories = array();
|
||||
$stories = array();
|
||||
$selectedIDList = $this->cookie->checkedItem ? $this->cookie->checkedItem : '0';
|
||||
if($this->session->storyOnlyCondition)
|
||||
{
|
||||
if($this->post->exportType == 'selected')
|
||||
{
|
||||
$stories = $this->dao->select('id,title,linkStories,childStories,parent,mailto,reviewedBy')->from(TABLE_STORY)->where('id')->in($this->cookie->checkedItem)->orderBy($orderBy)->fetchAll('id');
|
||||
$stories = $this->dao->select('id,title,linkStories,childStories,parent,mailto,reviewedBy')->from(TABLE_STORY)->where('id')->in($selectedIDList)->orderBy($orderBy)->fetchAll('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6257,7 +6258,7 @@ class storyModel extends model
|
||||
$field = $executionID ? 't2.id' : 't1.id';
|
||||
if($this->post->exportType == 'selected')
|
||||
{
|
||||
$stmt = $this->dbh->query("SELECT * FROM " . TABLE_STORY . "WHERE `id` IN({$this->cookie->checkedItem})" . " ORDER BY " . strtr($orderBy, '_', ' '));
|
||||
$stmt = $this->dbh->query("SELECT * FROM " . TABLE_STORY . "WHERE `id` IN({$selectedIDList})" . " ORDER BY " . strtr($orderBy, '_', ' '));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6265,37 +6266,36 @@ class storyModel extends model
|
||||
}
|
||||
while($row = $stmt->fetch()) $stories[$row->id] = $row;
|
||||
}
|
||||
$storyIdList = array_keys($stories);
|
||||
|
||||
if($stories)
|
||||
if(empty($stories)) return $stories;
|
||||
|
||||
$storyIdList = array_keys($stories);
|
||||
$children = array();
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$children = array();
|
||||
if($story->parent > 0 and isset($stories[$story->parent]))
|
||||
{
|
||||
$children[$story->parent][$story->id] = $story;
|
||||
unset($stories[$story->id]);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($children))
|
||||
{
|
||||
$reorderStories = array();
|
||||
foreach($stories as $story)
|
||||
{
|
||||
if($story->parent > 0 and isset($stories[$story->parent]))
|
||||
$reorderStories[$story->id] = $story;
|
||||
if(isset($children[$story->id]))
|
||||
{
|
||||
$children[$story->parent][$story->id] = $story;
|
||||
unset($stories[$story->id]);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($children))
|
||||
{
|
||||
$reorderStories = array();
|
||||
foreach($stories as $story)
|
||||
{
|
||||
$reorderStories[$story->id] = $story;
|
||||
if(isset($children[$story->id]))
|
||||
foreach($children[$story->id] as $childrenID => $childrenStory)
|
||||
{
|
||||
foreach($children[$story->id] as $childrenID => $childrenStory)
|
||||
{
|
||||
$reorderStories[$childrenID] = $childrenStory;
|
||||
}
|
||||
$reorderStories[$childrenID] = $childrenStory;
|
||||
}
|
||||
unset($stories[$story->id]);
|
||||
}
|
||||
$stories = $reorderStories;
|
||||
unset($stories[$story->id]);
|
||||
}
|
||||
$stories = $reorderStories;
|
||||
}
|
||||
|
||||
/* Get users, products and relations. */
|
||||
|
||||
@@ -911,7 +911,7 @@ class transferModel extends model
|
||||
preg_match_all('/[`"]' . $this->config->db->prefix . $model .'[`"] AS ([\w]+) /', $queryCondition, $matches);
|
||||
if(isset($matches[1][0])) $selectKey = "{$matches[1][0]}.id";
|
||||
|
||||
$stmt = $this->dbh->query($queryCondition . ($this->post->exportType == 'selected' ? " AND $selectKey IN({$this->cookie->checkedItem})" : ''));
|
||||
$stmt = $this->dbh->query($queryCondition . ($this->post->exportType == 'selected' ? " AND $selectKey IN(" . ($this->cookie->checkedItem ? $this->cookie->checkedItem : '0') . ")" : ''));
|
||||
while($row = $stmt->fetch())
|
||||
{
|
||||
if($selectKey !== 't1.id' and isset($row->$model) and isset($row->id)) $row->id = $row->$model;
|
||||
|
||||
Reference in New Issue
Block a user