Index: branches/RC/core/kernel/db/dbitem.php =================================================================== diff -u -N -r9973 -r10005 --- branches/RC/core/kernel/db/dbitem.php (.../dbitem.php) (revision 9973) +++ branches/RC/core/kernel/db/dbitem.php (.../dbitem.php) (revision 10005) @@ -833,21 +833,25 @@ * * @param array $master Table data from TempHandler * @param int $foreign_key ForeignKey value to filter name check query by + * @param string $title_field FieldName to alter, by default - TitleField of the prefix + * @param string $format sprintf-style format of renaming pattern, by default Copy %1$s of %2$s which makes it Copy [Number] of Original Name * @access private */ - function NameCopy($master=null, $foreign_key=null) + function NameCopy($master=null, $foreign_key=null, $title_field=null, $format='Copy %1$s of %2$s') { + if (!isset($title_field)) { $title_field = $this->Application->getUnitOption($this->Prefix, 'TitleField'); if (!$title_field || isset($this->CalculatedFields[$title_field]) ) return; + } $new_name = $this->GetDBField($title_field); $original_checked = false; do { - if ( preg_match('/Copy ([0-9]*) *of (.*)/', $new_name, $regs) ) { - $new_name = 'Copy '.($regs[1]+1).' of '.$regs[2]; + if ( preg_match('/'.sprintf($format, '([0-9]*) *', '(.*)').'/', $new_name, $regs) ) { + $new_name = sprintf($format, ($regs[1]+1), $regs[2]); } elseif ($original_checked) { - $new_name = 'Copy of '.$new_name; + $new_name = sprintf($format, '', $new_name); } // if we are cloning in temp table this will look for names in temp table,