-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch copy: copy permission too #24736
Changes from all commits
c72d6f2
420618c
8f2b75f
2e23232
c8e399d
e2f6555
c243230
d11936d
c0fbbeb
7b6861a
7f8bad8
1c47a41
5f6f1b9
d8372ff
69197d8
49226ba
baee4e5
639b9b9
7fa45d3
6b24187
5404e19
d6c3f4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -408,6 +408,7 @@ protected function batchCopy($value, $pks, $contexts) | |||||||
} | ||||||||
|
||||||||
$newIds = array(); | ||||||||
$db = $this->getDbo(); | ||||||||
|
||||||||
// Parent exists so let's proceed | ||||||||
while (!empty($pks)) | ||||||||
|
@@ -435,6 +436,12 @@ protected function batchCopy($value, $pks, $contexts) | |||||||
} | ||||||||
} | ||||||||
|
||||||||
// Check for asset_id | ||||||||
if ($this->table->hasField($this->table->getColumnAlias('asset_id'))) | ||||||||
{ | ||||||||
$oldAssetId = $this->table->asset_id; | ||||||||
} | ||||||||
|
||||||||
$this->generateTitle($categoryId, $this->table); | ||||||||
|
||||||||
// Reset the ID because we are making a copy | ||||||||
|
@@ -487,6 +494,21 @@ protected function batchCopy($value, $pks, $contexts) | |||||||
// Get the new item ID | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After this point There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok maybe I missed something in the code. |
||||||||
$newId = $this->table->get('id'); | ||||||||
|
||||||||
if (!empty($oldAssetId)) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
{ | ||||||||
// Copy rules | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
$query = $db->getQuery(true); | ||||||||
$query->clear() | ||||||||
->update($db->quoteName('#__assets', 't')) | ||||||||
->join('INNER', $db->quoteName('#__assets', 's') . | ||||||||
' ON ' . $db->quoteName('s.id') . ' = ' . $oldAssetId | ||||||||
HLeithner marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
) | ||||||||
->set($db->quoteName('t.rules') . ' = ' . $db->quoteName('s.rules')) | ||||||||
->where($db->quoteName('t.id') . ' = ' . $this->table->asset_id); | ||||||||
HLeithner marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
|
||||||||
$db->setQuery($query)->execute(); | ||||||||
} | ||||||||
|
||||||||
$this->cleanupPostBatchCopy($this->table, $newId, $pk); | ||||||||
|
||||||||
// Add the new ID to the array | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just move this down. Put
$oldAssetId
directly in the query and this if statement just down there