Skip to content

Commit

Permalink
* bugfix: The connection to the parent record has not been stored.
Browse files Browse the repository at this point in the history
  • Loading branch information
franzholz committed Nov 29, 2017
1 parent bbfe00e commit 3c624be
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

2017-11-29 Franz Holzinger <[email protected]>
* restructure ActionController::forum_postform: extract PostForm as a new class with a render method
* bugfix: The connection to the parent record has not been stored.

2017-11-24 Franz Holzinger <[email protected]>
* add file README.txt with the hint that the constants PAGE_TARGET must be set to _top
Expand Down
20 changes: 19 additions & 1 deletion Classes/Domain/TtBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,25 @@ public function getLastPost ($pid) {
*/
public function getLastPostInThread ($pid, $uid, $ref) {
$whereRef = $this->getWhereRef($ref);
$where = 'pid IN (' . $pid . ') AND parent=' . $uid . $whereRef . $this->getEnableFields();
$where = 'pid IN (' . $pid . ') AND parent=' . intval($uid) . $whereRef . $this->getEnableFields();

$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
'*',
$this->getTablename(),
$where,
'',
$this->orderBy('DESC')
);
return $row;
}


/**
* Returns last post in thread.
*/
public function getCurrentPost ($uid, $ref) {
$whereRef = $this->getWhereRef($ref);
$where = 'uid=' . $uid . $whereRef . $this->getEnableFields();

$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
'*',
Expand Down
2 changes: 1 addition & 1 deletion Classes/View/Forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function printView (
$crdate = $rootParent['crdate'];
} else {
$row =
$modelObj->getSingleThread(
$modelObj->getCurrentPost(
$uid,
$ref
);
Expand Down
25 changes: 15 additions & 10 deletions Classes/View/PostForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public function render (
$modelObj = $composite->getModelObj();
$languageObj = $composite->getLanguageObj();
$local_cObj = \JambageCom\Div2007\Utility\FrontendUtility::getContentObjectRenderer();
$uid = $composite->getTtBoardUid();

if (
$modelObj->isAllowed($conf['memberOfGroups'])
Expand All @@ -65,29 +66,35 @@ public function render (

// Find parent, if any
if (
$composite->getTtBoardUid() ||
$uid ||
$ref != ''
) {
if ($conf['tree']) {
$parent = $composite->getTtBoardUid();
$parent = $uid;
}

$parentR =
$row =
$modelObj->getRootParent(
$composite->getTtBoardUid(),
$uid,
$ref
);

if (!$row) {
$row =
$modelObj->getCurrentPost(
$uid,
$ref
);
}

if (
is_array($parentR) &&
!$conf['tree']
) {
$parent = $parentR['uid'];
$parent = $row['uid'];
}

$wholeThread =
$modelObj->getSingleThread(
$parentR['uid'],
$row['uid'],
$ref,
1
);
Expand Down Expand Up @@ -324,9 +331,7 @@ public function render (
$content .= $out;
}
}

return $content;
}
}


0 comments on commit 3c624be

Please sign in to comment.