Skip to content

Commit

Permalink
Update ArticleModel.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Arpit-24 committed Jul 13, 2019
1 parent 284a094 commit 62a78a1
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions administrator/components/com_content/Model/ArticleModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class ArticleModel extends AdminModel
*
* @return array|boolean An array of new IDs on success, boolean false on failure.
*
* @since 4.0
* @since __DEPLOY_VERSION__
*/
protected function batchCopy($value, $pks, $contexts)
{
Expand Down Expand Up @@ -172,9 +172,9 @@ protected function batchCopy($value, $pks, $contexts)
// Add workflow_assosciations entry
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(array('stage_id','extension')))
->from($db->quoteName('#__workflow_associations'))
->where($db->quoteName('item_id') . ' = ' . $pk);
->select($db->quoteName(array('stage_id','extension')))
->from($db->quoteName('#__workflow_associations'))
->where($db->quoteName('item_id') . ' = ' . $pk);
$db->setQuery($query);

$results = $db->loadObject();
Expand All @@ -184,11 +184,22 @@ protected function batchCopy($value, $pks, $contexts)
$oldExtension = $results->extension;

$query->clear()
->insert($db->quoteName('#__workflow_associations'))
->columns(array($db->quoteName('item_id'), $db->quoteName('stage_id'), $db->quoteName('extension')))
->values($db->quote($newId) . ',' . $db->quote($old_stage_id) . ',' . $db->quote($oldExtension));
->insert($db->quoteName('#__workflow_associations'))
->columns(array($db->quoteName('item_id'), $db->quoteName('stage_id'), $db->quoteName('extension')))
->values($db->quote($newId) . ',' . $db->quote($old_stage_id) . ',' . $db->quote($oldExtension));

$db->setQuery($query);
$db->execute();

try
{
$db->execute();
}
catch (\RuntimeException $e)
{
$this->setError($e->getMessage());

return false;
}
}

// Clean the cache
Expand Down

0 comments on commit 62a78a1

Please sign in to comment.