CoreCommunity ExtensionsIncubatorDistributionsTYPO3 4.5 ProjectsTYPO3 4.7 ProjectsTYPO3 6.0 ProjectsTYPO3 6.1 ProjectsTYPO3 6.2 Projects (+)

Bug #26733

Workspace Issues

Added by Torsten no-lastname-given about 2 years ago. Updated 8 months ago.

Status:Resolved Start date:2011-05-10
Priority:Must have Due date:
Assignee:Michael Birchler % Done:

0%

Category:-
Target version:-
TYPO3 Version: PHP Version:
Votes: 1 (View)

Description

Editing an nested content in a workspace results in doubeling the content after saving. You get two content-elements (in the correct column) with the same content. However, publishing the whole site results in publishing the correct element. But switching back to the workspace you surprisingly still see two elements, one with the new and one with the old content.

I use Typo3 4.5.2 and the latest multicolumn.

Thx!

History

Updated by z.c about 2 years ago

i've found a temporary fix for this problem.

@Extension-Developer: please review and merge this into the extension.

File: multicolumn/lib/class.tx_multicolumn_db.php
Function: public static function getContentElementsFromContainer

Line: 73
Change: if(!$isWorkspace) $whereClause .= self::enableFields($fromTable, $showHidden);
To: $whereClause .= self::enableFields($fromTable, $showHidden);

Line: 83
After: array_pop($output);
Add: if ($GLOBALS['TSFE']->sys_page->versioningPreview) foreach ($output AS &$row) t3lib_BEfunc::workspaceOL("tt_content",$row);

Updated by Michael Birchler about 2 years ago

  • Status changed from New to Accepted
  • Priority changed from Should have to Must have

Updated by Michael Birchler over 1 year ago

  • Status changed from Accepted to Resolved
  • Assignee set to Michael Birchler

New Version sent to TER.

Updated by Torsten no-lastname-given over 1 year ago

Thank you!

Updated by Markus Timtner 11 months ago

Problem is still or again there with multicolumn 2.1.13 and TYPO3 v4.7.1

I see function getWorkspaceClause in file class.tx_multicolumn_db.php,
but there doesn't seem to be any t3lib_BEfunc::workspaceOL() in there.

Updated by Robert Becker 9 months ago

Confirmed. The Problem is there in 2.1.13.
It isn't easy to fix because if you use workspaces the "where"-clause in the select can only be "pid >= 0" or "pid = ".$someNumber
So i made 2 seperate queries... if someone knows a better way that does it, write it down here :)
EDIT: seems that i had a little bug in my fix... corrected that and raised the performance, from the FE there will be only 1 DB Select.

File: multicolumn/lib/class.tx_multicolumn_db.php
Function: public static function getContentElementsFromContainer
Change: the whole method
To:

  public static function getContentElementsFromContainer($colPos = null, $pid = null, $mulitColumnParentId, $sysLanguageUid = 0, $showHidden = false, $additionalWhere = null, tx_cms_layout &$cmsLayout = null) {
    $selectFields = '*';
        $fromTable = 'tt_content';
        $whereClause = '';
    if($pid)
      $whereClause .= 'pid = ' . intval($pid);
    else
      $whereClause .= $additionalWhere; 
        $orderBy = 'sorting ASC';

    $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($selectFields, $fromTable, $whereClause, null, $orderBy);

    $whereClause = null;
    while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
      switch(TYPO3_MODE) {
        case 'FE':
          $GLOBALS['TSFE']->sys_page->versionOL($fromTable, $row);
          break;
        case 'BE':
          t3lib_BEfunc::workspaceOL($fromTable, $row);
          break;

      }

      if (is_array($row)
          && $row['deleted'] == 0
          && $row['tx_multicolumn_parentid'] == intval($mulitColumnParentId)
          && (!$colPos || $colPos && $row['colPos'] == intval($colPos))
          && $row['sys_language_uid'] == intval($sysLanguageUid)) {

        if (!$whereClause)
          $whereClause = 'uid = '.$row['uid'];
        else
          $whereClause .= ' || uid = '.$row['uid'];

        $output[] = $row;
      }
    }

    if ($cmsLayout && $whereClause) {
      $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($selectFields, $fromTable, $whereClause, null, $orderBy);

      if (!$GLOBALS['TYPO3_DB']->sql_error()) {
        //use cms layout object for correct icons
        $output = $cmsLayout->getResult($res,'tt_content');

        $GLOBALS['TYPO3_DB']->sql_free_result($res);
      }
    }

    return $output;
  }

Updated by Torsten no-lastname-given 8 months ago

When using the solution of Robert Becker you can not hide nested Content Elements any more. They are shown in frontend anyway, whether they are hidden or not.

Updated by JHe 8 months ago

There is one line missing. After the row

&& $row['deleted']  0

you just have to add

&& $row['hidden']  0

to check, if an element is hidden or not.

Also available in: Atom PDF