diff --git a/administrator/components/com_categories/models/category.php b/administrator/components/com_categories/models/category.php index 98d5463086a95..2e7ddff290e0c 100644 --- a/administrator/components/com_categories/models/category.php +++ b/administrator/components/com_categories/models/category.php @@ -1018,9 +1018,10 @@ protected function batchCopy($value, $pks, $contexts) } } - // Make a copy of the old ID and Parent ID - $oldId = $this->table->id; + // Make a copy of the old ID, Parent ID and Asset ID + $oldId = $this->table->id; $oldParentId = $this->table->parent_id; + $oldAssetId = $this->table->asset_id; // Reset the id because we are making a copy. $this->table->id = 0; @@ -1062,6 +1063,16 @@ protected function batchCopy($value, $pks, $contexts) // Add the new ID to the array $newIds[$pk] = $newId; + + // Copy rules + $query->clear() + ->update($db->quoteName('#__assets', 't')) + ->join('INNER', $db->quoteName('#__assets', 's') . + ' ON ' . $db->quoteName('s.id') . ' = ' . $oldAssetId + ) + ->set($db->quoteName('t.rules') . ' = ' . $db->quoteName('s.rules')) + ->where($db->quoteName('t.id') . ' = ' . $this->table->asset_id); + $db->setQuery($query)->execute(); // Now we log the old 'parent' to the new 'parent' $parents[$oldId] = $this->table->id;