Skip to content

Commit

Permalink
Merge pull request #262 from ankush-maherwal/release-1.2.3
Browse files Browse the repository at this point in the history
Release 1.2.3
  • Loading branch information
ankush-maherwal authored Dec 2, 2019
2 parents 2f5a86e + e667786 commit 7c30600
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,18 @@ public function migrate()
$db->setQuery($query);
$ucmTypes = $db->loadObjectlist();

$session = JFactory::getSession();
$updatedTypes = (empty($session->get('updatedTypes'))) ? array() : $session->get('updatedTypes');

if (!empty($ucmTypes))
{
foreach ($ucmTypes as $ucmType)
{
if (in_array($ucmType->id, $updatedTypes))
{
continue;
}

$ucmTypeTable = JTable::getInstance('Type', 'TjucmTable', array('dbo', $db));
$ucmTypeTable->load($ucmType->id);
$updatedUniqueIdentifier = 'com_tjucm.' . preg_replace("/[^a-zA-Z0-9]/", "", str_replace('com_tjucm.', '', $ucmTypeTable->unique_identifier));
Expand Down Expand Up @@ -101,15 +109,15 @@ public function migrate()

if ($tjfieldsFieldTable->type == 'cluster')
{
$tjfieldsFieldTable->name = str_replace('.', '_', $updatedUniqueIdentifier) . '_clusterid';
$tjfieldsFieldTable->name = str_replace('.', '_', $updatedUniqueIdentifier) . '_clusterclusterid';
}
elseif ($tjfieldsFieldTable->type == 'ownership')
{
$tjfieldsFieldTable->name = str_replace('.', '_', $updatedUniqueIdentifier) . '_createdby';
$tjfieldsFieldTable->name = str_replace('.', '_', $updatedUniqueIdentifier) . '_ownershipcreatedby';
}
elseif ($tjfieldsFieldTable->type == 'itemcategory')
{
$tjfieldsFieldTable->name = str_replace('.', '_', $updatedUniqueIdentifier) . '_itemcategory';
$tjfieldsFieldTable->name = str_replace('.', '_', $updatedUniqueIdentifier) . '_itemcategoryitemcategory';
}
else
{
Expand Down Expand Up @@ -226,9 +234,19 @@ public function migrate()
// Regenerate the XML files
$tjfieldsHelper->generateXml(array('client' => $updatedUniqueIdentifier, 'client_type' => $newClientParts[1]));
}

$updatedTypes[] = $ucmType->id;
$session->set('updatedTypes', $updatedTypes);

$result['status'] = '';
$result['message'] = "Migration in progress";

return $result;
}
}

$session->set('updatedTypes', '');

$result['status'] = true;
$result['message'] = "Migration successful";
}
Expand Down

0 comments on commit 7c30600

Please sign in to comment.