Added the option to import JCB packages with GUID mapping. Resolved gh-657 to allow for painless fieldtype change in the field area.
This commit is contained in:
@ -176,12 +176,12 @@ class Get
|
||||
* New Replace Code = /xxx[REPLACE<>$$$$]xxx/ /xxx[/REPLACE<>$$$$]xxx/
|
||||
*
|
||||
* //////////////////////////////// when JCB adds it back //////////////////////////////////
|
||||
* JCB Add Inserted Code = /xxx[INSERTED$$$$]xxx//x23x/ /xxx[/INSERTED$$$$]xxx/
|
||||
* JCB Add Replaced Code = /xxx[REPLACED$$$$]xxx//x25x/ /xxx[/REPLACED$$$$]xxx/
|
||||
* JCB Add Inserted Code = /xxx[INSERTED$$$$]xxx//xx23xx/ /xxx[/INSERTED$$$$]xxx/
|
||||
* JCB Add Replaced Code = /xxx[REPLACED$$$$]xxx//xx25xx/ /xxx[/REPLACED$$$$]xxx/
|
||||
*
|
||||
* /////////////////////////////// changeing existing custom code /////////////////////////
|
||||
* Update Inserted Code = /xxx[INSERTED<>$$$$]xxx//x23x/ /xxx[/INSERTED<>$$$$]xxx/
|
||||
* Update Replaced Code = /xxx[REPLACED<>$$$$]xxx//x25x/ /xxx[/REPLACED<>$$$$]xxx/
|
||||
* Update Inserted Code = /xxx[INSERTED<>$$$$]xxx//xx23xx/ /xxx[/INSERTED<>$$$$]xxx/
|
||||
* Update Replaced Code = /xxx[REPLACED<>$$$$]xxx//xx25xx/ /xxx[/REPLACED<>$$$$]xxx/
|
||||
*
|
||||
* The custom script placeholders - we use the (==) to avoid detection it should be (--)
|
||||
* ###################################---> HTML <---#####################################
|
||||
@ -11423,11 +11423,11 @@ class Get
|
||||
switch ($type)
|
||||
{
|
||||
case 11:
|
||||
//***[REPLACED$$$$]***//*1*/
|
||||
//***[REPLACED$$$$]***//**1**/
|
||||
if ($this->addPlaceholders === true)
|
||||
{
|
||||
return array(
|
||||
'start' => '/***[REPLACED$$$$]***//*' . $id . '*/',
|
||||
'start' => '/***[REPLACED$$$$]***//**' . $id . '**/',
|
||||
'end' => '/***[/REPLACED$$$$]***/');
|
||||
}
|
||||
else
|
||||
@ -11438,11 +11438,11 @@ class Get
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
//***[INSERTED$$$$]***//*1*/
|
||||
//***[INSERTED$$$$]***//**1**/
|
||||
if ($this->addPlaceholders === true)
|
||||
{
|
||||
return array(
|
||||
'start' => '/***[INSERTED$$$$]***//*' . $id . '*/',
|
||||
'start' => '/***[INSERTED$$$$]***//**' . $id . '**/',
|
||||
'end' => '/***[/INSERTED$$$$]***/');
|
||||
}
|
||||
else
|
||||
|
@ -5042,7 +5042,7 @@ class Fields extends Structure
|
||||
);
|
||||
break;
|
||||
case 4:
|
||||
// WHMCS_ENCRYPTION_VDMKEY
|
||||
// WHMCS_ENCRYPTION_VDMKEY (DUE REMOVAL)
|
||||
$this->whmcsFieldModeling[$nameSingleCode][] = $name;
|
||||
// Site settings of each field if needed
|
||||
$this->buildSiteFieldData(
|
||||
|
@ -465,7 +465,7 @@ class Interpretation extends Fields
|
||||
$bool[] = $this->_t(2) . "return false;";
|
||||
$bool[] = $this->_t(1) . "}";
|
||||
|
||||
// return the genuine mentod statement
|
||||
// return the genuine method statement
|
||||
return implode(PHP_EOL, $bool);
|
||||
}
|
||||
|
||||
|
@ -2305,6 +2305,57 @@ abstract class ComponentbuilderHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the ITEM of a GUID by table
|
||||
*
|
||||
* @param string $guid
|
||||
* @param string $table
|
||||
* @param string/array $what
|
||||
*
|
||||
* @return mix
|
||||
*/
|
||||
public static function getGUID ($guid, $table, $what = 'a.id')
|
||||
{
|
||||
// check if we have a string
|
||||
if (self::validateGUID($guid))
|
||||
{
|
||||
// check if table already has this identifier
|
||||
if (self::checkString($table))
|
||||
{
|
||||
// Get the database object and a new query object.
|
||||
$db = \JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
if (self::checkArray($what))
|
||||
{
|
||||
$query->select($db->quoteName($what));
|
||||
}
|
||||
else
|
||||
{
|
||||
$query->select($what);
|
||||
}
|
||||
$query->from($db->quoteName('#__componentbuilder_' . (string) $table, 'a'))
|
||||
->where($db->quoteName('a.guid') . ' = ' . $db->quote($guid));
|
||||
|
||||
// Set and query the database.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
if (self::checkArray($what) || $what === 'a.*')
|
||||
{
|
||||
return $db->loadObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $db->loadResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the Globally Unique Identifier
|
||||
*
|
||||
@ -2423,7 +2474,7 @@ abstract class ComponentbuilderHelper
|
||||
* @return array on success
|
||||
*
|
||||
*/
|
||||
public static function getFieldTypeProperties($value, $type, $settings = array(), $xml = null, $db_defaults = false)
|
||||
public static function getFieldTypeProperties($value, $type, $settings = array(), $xml = null, $dbDefaults = false)
|
||||
{
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
@ -2432,7 +2483,7 @@ abstract class ComponentbuilderHelper
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('properties', 'short_description', 'description')));
|
||||
// load database default values
|
||||
if ($db_defaults)
|
||||
if ($dbDefaults)
|
||||
{
|
||||
$query->select($db->quoteName(array('datadefault', 'datadefault_other', 'datalenght', 'datalenght_other', 'datatype', 'has_defaults', 'indexes', 'null_switch', 'store')));
|
||||
}
|
||||
@ -2459,6 +2510,12 @@ abstract class ComponentbuilderHelper
|
||||
$nr = 0;
|
||||
// php tracker (we must try to load alteast 17 rows
|
||||
$phpTracker = array();
|
||||
// force load all properties
|
||||
$forceAll = false;
|
||||
if ($xml && strpos($xml, '..__FORCE_LOAD_ALL_PROPERTIES__..') !== false)
|
||||
{
|
||||
$forceAll = true;
|
||||
}
|
||||
// value to check since there are false and null values even 0 in the values returned
|
||||
$confirmation = '8qvZHoyuFYQqpj0YQbc6F3o5DhBlmS-_-a8pmCZfOVSfANjkmV5LG8pCdAY2JNYu6cB';
|
||||
// set the headers
|
||||
@ -2504,7 +2561,7 @@ abstract class ComponentbuilderHelper
|
||||
$field['subform']['properties'.$nr] = array('name' => $property['name'], 'value' => $settings[$property['name']], 'desc' => $property['description']);
|
||||
}
|
||||
}
|
||||
elseif (!$xml || $confirmation !== $value)
|
||||
elseif ($forceAll || !$xml || $confirmation !== $value)
|
||||
{
|
||||
// add the xml values
|
||||
$field['values'] .= PHP_EOL."\t" . $property['name'] . '="' . ($confirmation !== $value) ? $value : $example .'" ';
|
||||
|
Reference in New Issue
Block a user