Project

General

Profile

Actions

Bug #16393

closed

Workspaces loses MM relations on saving a new record and publish a draft record.

Added by Zach Davis almost 18 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Workspaces
Target version:
-
Start date:
2006-07-21
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Steps to reproduce:
1. User makes new record with MM relations in draft workspace. User saves record.
2. On save, TCEMAIN calls $this->dbAnalysisStoreExec() to update the relations in any MM tables. Unforunfately, the local_uid that is stored in these tables is that of the placeholder record and not of the draft record. After saving, all MM relations in the draft record are lost.
3. On editing the draft record, user can add new MM relations and save the record. Because this is not a new record at this point, the MM relations in the draft will be saved.
4. On publishing the draft record, all MM relations between the draft and another record remain the same. The live version is not updated with the draft's MM relations.

Solution:

Part 1:
We need to update $this->substNEWwithIDs in TCEMAIN's process_datamap method with the UID of the draft record on save:

I believe this:

$phShadowId = $this->insertDB($table,$id,$fieldArray,TRUE,0,TRUE); // When inserted, $this->substNEWwithIDs[$id] will be changed to the uid of THIS version and so the interface will pick it up just nice!

should be changed to this:

$phShadowId = $this->insertDB($table,$id,$fieldArray,TRUE,0,TRUE); // When inserted, $this->substNEWwithIDs[$id] will be changed to the uid of THIS version and so the interface will pick it up just nice!
$this->substNEWwithIDs[$id] = $phShadowId;

Furthermore, on publishing, we need to replace the live (placeholder) record's MM relations with the relations of the draft record and, furthermore, the MM relations in the draft record need to be removed from the MM tables.

So, in TCEMAIN's version_swap method, immediately after the swapping is executed, we can add the following to acocmplish this:

$row = $this->recordInfo($table,intval($swapWith),'*');
foreach($row as $field => $value) {
$conf = $TCA[$table]['columns'][$field]['config'];
if (is_array($conf)) {
if($conf['MM'] == true) {
$str = $this->copyRecord_procBasedOnFieldType($table,$swapWith,$field,$value,$row,$conf);
$valueArr = explode(',',$str);
$this->checkValue_group_select_processDBdata($valueArr,$conf,$id,'update',$conf['type']);
}
}
}

I'm attaching a revised version of TCEMAIN -- search for ZACH to see my two changes. Hope this helps...

--Zach
(issue imported from #M3907)


Files

class.t3lib_tcemain.php (233 KB) class.t3lib_tcemain.php Administrator Admin, 2006-07-21 19:49
tcemain_patch4_1_1.diff (1.6 KB) tcemain_patch4_1_1.diff Administrator Admin, 2007-06-14 11:53
tt_news_patch2_5_0.diff (4.01 KB) tt_news_patch2_5_0.diff Administrator Admin, 2007-06-14 11:54
as_mmswap-typo3-4.1.3-0_0_1-z-200711150100.t3x (5.75 KB) as_mmswap-typo3-4.1.3-0_0_1-z-200711150100.t3x Administrator Admin, 2007-11-15 01:08
as_mmswap-typo3-4.2-0_0_1-z-200711150100.t3x (5.9 KB) as_mmswap-typo3-4.2-0_0_1-z-200711150100.t3x Administrator Admin, 2007-11-15 01:08
as_mmswap-typo3-4.1.3-ttnewssup-0_0_1-z-200711150100.t3x (5.86 KB) as_mmswap-typo3-4.1.3-ttnewssup-0_0_1-z-200711150100.t3x Administrator Admin, 2007-11-16 04:37

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #16166: Publishing a record breaks dam_ttcontent-relationsClosedKasper Skårhøj2006-05-22

Actions
Actions

Also available in: Atom PDF