[TYPO3-core] RFC: Bug 5718: IRRE - Copying a page with related child records leads to duplicates of each children

Franz Holzinger franz at fholzinger.com
Tue Jun 12 06:10:51 CEST 2007


Hello Oliver, 

> Problem:
> When a page that contains several IRRE children gets copied, currenty to
> following happens:
> * copy record of table "pages"
> * copy each record with the pid of the source page to the new page
>   (also all IRRE children)
> * when an IRRE parent get copied, this calls recursively the copying of
>   its children
> Thus, the IRRE children get copied twice - by their parent record and by
> the page. 
> 
> Solution:
> Prevent IRRE children from being copied twice on checking TCEmain's
> $copyMappingArray which holds the table and uid of records that were
> already copied. 
> 
> Comments:
> This is a bugfix concerning IRRE: If nobody objects within one week,
> I'll commit this change to SVN.

I have stepped through the code called by this and think something is wrong 
here: 

function 
copyRecord_procBasedOnFieldType($table,$uid,$field,$value,$row,$conf,$realDe 
stPid) {
	global $TCA; 

		// Process references and files, currently that means only the files, 
prepending absolute paths (so the TCEmain engine will detect the file as new 
and one that should be made into a copy)
	$value = $this->copyRecord_procFilesRefs($conf, $uid, $value);
	$inlineSubType = $this->getInlineFieldType($conf); 

		// Register if there are references to take care of or MM is used on an 
inline field (no change to value):
	if ($this->isReferenceField($conf) || $inlineSubType == 'mm')	{ 


==> FALSE == 0 could be TRUE
 ----------------------------------------------
line 2858: 

	// if another inline subtype is used (foreign_field, mm with attributes or 
simply item list)
} elseif ($inlineSubType !== false) {
	$dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
	$dbAnalysis->start($value, $conf['foreign_table'], $conf['MM'], $uid, 
$table, $conf); 

I think this never will be reached when MM has been set, because it always 
goes to the first if. 


 - Franz 




More information about the TYPO3-team-core mailing list