Index: branches/unlabeled/unlabeled-1.66.2/core/units/general/cat_event_handler.php =================================================================== diff -u -r6451 -r6553 --- branches/unlabeled/unlabeled-1.66.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6451) +++ branches/unlabeled/unlabeled-1.66.2/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6553) @@ -129,6 +129,7 @@ if ($clipboard_data['copy']) { $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); + $this->Application->SetVar('ResetCatBeforeClone', 1); $temp->CloneItems($event->Prefix, $event->Special, $clipboard_data['copy']); } @@ -1871,6 +1872,21 @@ } /** + * Occures before an item is cloneded + * Id of ORIGINAL item is passed as event' 'id' param + * Do not call object' Update method in this event, just set needed fields! + * + * @param kEvent $event + */ + function OnBeforeClone(&$event) + { + if ($this->Application->GetVar('ResetCatBeforeClone')) { + $object =& $event->getObject(); + $object->SetDBField('CategoryId', null); + } + } + + /** * Apply same processing to each item beeing selected in grid * * @param kEvent $event Index: branches/unlabeled/unlabeled-1.66.2/kernel/units/general/cat_event_handler.php =================================================================== diff -u -r6451 -r6553 --- branches/unlabeled/unlabeled-1.66.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6451) +++ branches/unlabeled/unlabeled-1.66.2/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 6553) @@ -129,6 +129,7 @@ if ($clipboard_data['copy']) { $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); + $this->Application->SetVar('ResetCatBeforeClone', 1); $temp->CloneItems($event->Prefix, $event->Special, $clipboard_data['copy']); } @@ -1871,6 +1872,21 @@ } /** + * Occures before an item is cloneded + * Id of ORIGINAL item is passed as event' 'id' param + * Do not call object' Update method in this event, just set needed fields! + * + * @param kEvent $event + */ + function OnBeforeClone(&$event) + { + if ($this->Application->GetVar('ResetCatBeforeClone')) { + $object =& $event->getObject(); + $object->SetDBField('CategoryId', null); + } + } + + /** * Apply same processing to each item beeing selected in grid * * @param kEvent $event