Fixed the sql dump import issue that broke when import values not set correctly. Made more corrections to the whmcs implementation.

This commit is contained in:
2018-07-09 00:49:50 +02:00
parent a62476d260
commit 21254738a8
3 changed files with 86 additions and 112 deletions

View File

@ -99,52 +99,64 @@ class Mapping
*/
public function __construct($data = false)
{
// set the app to insure messages can be set
$this->app = JFactory::getApplication();
// check that we have data
if (ComponentbuilderHelper::checkArray($data))
{
if (isset($data['buildcomp']) && 1 == $data['buildcomp'] && isset($data['buildcompsql']))
// make sure we have an id
if (isset($data['id']) && $data['id'] > 0)
{
foreach ($data as $key => $value)
if (isset($data['buildcomp']) && 1 == $data['buildcomp'] && isset($data['buildcompsql']))
{
if (isset($this->setting[$key]))
foreach ($data as $key => $value)
{
switch($this->setting[$key])
if (isset($this->setting[$key]))
{
case 'base64':
// set needed value
$this->$key = base64_decode($value);
break;
case 'json':
// set needed value
$this->$key = json_decode($value, true);
break;
case 'safeString':
// set needed value
$this->$key = ComponentbuilderHelper::safeString($value);
break;
default :
$this->$key = $value;
break;
switch($this->setting[$key])
{
case 'base64':
// set needed value
$this->$key = base64_decode($value);
break;
case 'json':
// set needed value
$this->$key = json_decode($value, true);
break;
case 'safeString':
// set needed value
$this->$key = ComponentbuilderHelper::safeString($value);
break;
default :
$this->$key = $value;
break;
}
}
}
// get linked admin views
$addadmin_views = ComponentbuilderHelper::getVar('component_admin_views', $data['id'], 'joomla_component', 'addadmin_views');
if (ComponentbuilderHelper::checkJson($addadmin_views))
{
$this->addadmin_views = json_decode($addadmin_views, true);
}
// set the map of the views needed
if ($this->setMap())
{
return true;
}
$this->app->enqueueMessage(
JText::_('No "CREATE TABLE.." were found, please check your sql.'),
'Error'
);
return false;
}
// get linked admin views
$addadmin_views = ComponentbuilderHelper::getVar('component_admin_views', $data['id'], 'joomla_component', 'addadmin_views');
if (ComponentbuilderHelper::checkJson($addadmin_views))
{
$this->addadmin_views = json_decode($addadmin_views, true);
}
// set the map of the views needed
if ($this->setMap())
{
return true;
}
$this->app->enqueueMessage(
JText::_('No "CREATE TABLE.." were found, please check your sql.'),
'Error'
);
return false;
return false; // not set so just return without any error
}
return false; // not set so just return without any error
$this->app->enqueueMessage(
JText::_('Please try again, this error usualy happens if it is a new component, beacues we need a component ID to do this build with your sql dump.'),
'Error'
);
return false;
}
$this->app->enqueueMessage(
JText::_('Could not find the data needed to continue.'),

View File

@ -36,30 +36,19 @@ class Extrusion extends Builder
*/
public function __construct(&$data)
{
// set the app to insure messages can be set
$this->app = JFactory::getApplication();
// make sure we have an id
if (isset($data['id']) && $data['id'] > 0)
// first we run the perent constructor
if (parent::__construct($data))
{
// first we run the perent constructor
if (parent::__construct($data))
// link the view data to the component
if ($this->setAdminViews($data['id']))
{
// link the view data to the component
if ($this->setAdminViews($data['id']))
{
$this->app->enqueueMessage(
JText::_('All the fields and views from your sql dump has been created and linked to this component.'),
'Success'
);
return true;
}
$this->app->enqueueMessage(
JText::_('All the fields and views from your sql dump has been created and linked to this component.'),
'Success'
);
return true;
}
return false;
}
$this->app->enqueueMessage(
JText::_('Please try again, this error usualy happens if it is a new component, beacues we need a component ID to do this build with your sql dump.'),
'Error'
);
return false;
}