Added the admin filter type switch to compiler gh-378. Moved the name_single and name_list to the view->name_list and view->name_list_code in the compiler (refactoring).

This commit is contained in:
Llewellyn van der Merwe 2020-11-17 06:06:34 +02:00
parent e7104d9c1c
commit d7233a1420
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
8 changed files with 469 additions and 339 deletions

View File

@ -144,7 +144,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 14th November, 2020 + *Last Build*: 17th November, 2020
+ *Version*: 2.11.7 + *Version*: 2.11.7
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -144,7 +144,7 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 14th November, 2020 + *Last Build*: 17th November, 2020
+ *Version*: 2.11.7 + *Version*: 2.11.7
+ *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt

View File

@ -453,6 +453,13 @@ class Get
*/ */
public $siteEditView = array(); public $siteEditView = array();
/**
* The admin list view filter type
*
* @var array
*/
public $adminFilterType = array();
/** /**
* The Language target * The Language target
* *
@ -1477,16 +1484,19 @@ class Get
$this->siteEditView[$array['adminview']] = true; $this->siteEditView[$array['adminview']] = true;
$this->lang = 'both'; $this->lang = 'both';
} }
// set the import/export option for this view
if (isset($array['port']) && $array['port'] if (isset($array['port']) && $array['port']
&& !$this->addEximport) && !$this->addEximport)
{ {
$this->addEximport = true; $this->addEximport = true;
} }
// set the history tracking option for this view
if (isset($array['history']) && $array['history'] if (isset($array['history']) && $array['history']
&& !$this->setTagHistory) && !$this->setTagHistory)
{ {
$this->setTagHistory = true; $this->setTagHistory = true;
} }
// set the custom field integration for this view
if (isset($array['joomla_fields']) if (isset($array['joomla_fields'])
&& $array['joomla_fields'] && $array['joomla_fields']
&& !$this->setJoomlaFields) && !$this->setJoomlaFields)
@ -1499,7 +1509,16 @@ class Get
$array['settings'] = $this->getAdminViewData( $array['settings'] = $this->getAdminViewData(
$array['view'] $array['view']
); );
// set the filter option for this view
$this->adminFilterType[$array['settings']->name_list_code] = 1; // Side (old) [default for now]
if (isset($array['filter'])
&& is_numeric(
$array['filter']
)
&& $array['filter'] > 0)
{
$this->adminFilterType[$array['settings']->name_list_code] = (int) $array['filter'];
}
return $array; return $array;
}, array_values($component->addadmin_views) }, array_values($component->addadmin_views)
); );
@ -2175,13 +2194,25 @@ class Get
// Load the results as a list of stdClass objects (see later for more options on retrieving data). // Load the results as a list of stdClass objects (see later for more options on retrieving data).
$view = $this->db->loadObject(); $view = $this->db->loadObject();
// setup view name to use in storing the data // setup single view code names to use in storing the data
$name_single = ComponentbuilderHelper::safeString( $view->name_single_code = 'oops_hmm_' . $id;
$view->name_single if (isset($view->name_single) && $view->name_single != 'null')
); {
$name_list = ComponentbuilderHelper::safeString($view->name_list); $view->name_single_code = ComponentbuilderHelper::safeString(
$view->name_single
);
}
// set upater // setup list view code name to use in storing the data
$view->name_list_code = 'oops_hmmm_' . $id;
if (isset($view->name_list) && $view->name_list != 'null')
{
$view->name_list_code = ComponentbuilderHelper::safeString(
$view->name_list
);
}
// set updater
$updater = array( $updater = array(
'unique' => array( 'unique' => array(
'addfields' => array('table' => 'admin_fields', 'addfields' => array('table' => 'admin_fields',
@ -2217,32 +2248,28 @@ class Get
{ {
$this->customScriptBuilder['token'] = array(); $this->customScriptBuilder['token'] = array();
} }
$this->customScriptBuilder['token'][$name_single] = false; $this->customScriptBuilder['token'][$view->name_single_code] = false;
$this->customScriptBuilder['token'][$name_list] = false; $this->customScriptBuilder['token'][$view->name_list_code] = false;
// set some placeholders // set some placeholders
$this->placeholders[$this->hhh . 'view' . $this->hhh] $this->placeholders[$this->hhh . 'view' . $this->hhh]
= ComponentbuilderHelper::safeString( = $view->name_single_code;
$name_single
);
$this->placeholders[$this->hhh . 'views' . $this->hhh] $this->placeholders[$this->hhh . 'views' . $this->hhh]
= ComponentbuilderHelper::safeString( = $view->name_list_code;
$name_list
);
$this->placeholders[$this->hhh . 'View' . $this->hhh] $this->placeholders[$this->hhh . 'View' . $this->hhh]
= ComponentbuilderHelper::safeString( = ComponentbuilderHelper::safeString(
$name_single, 'F' $view->name_single, 'F'
); );
$this->placeholders[$this->hhh . 'Views' . $this->hhh] $this->placeholders[$this->hhh . 'Views' . $this->hhh]
= ComponentbuilderHelper::safeString( = ComponentbuilderHelper::safeString(
$name_list, 'F' $view->name_list, 'F'
); );
$this->placeholders[$this->hhh . 'VIEW' . $this->hhh] $this->placeholders[$this->hhh . 'VIEW' . $this->hhh]
= ComponentbuilderHelper::safeString( = ComponentbuilderHelper::safeString(
$name_single, 'U' $view->name_single, 'U'
); );
$this->placeholders[$this->hhh . 'VIEWS' . $this->hhh] $this->placeholders[$this->hhh . 'VIEWS' . $this->hhh]
= ComponentbuilderHelper::safeString( = ComponentbuilderHelper::safeString(
$name_list, 'U' $view->name_list, 'U'
); );
$this->placeholders[$this->bbb . 'view' . $this->ddd] $this->placeholders[$this->bbb . 'view' . $this->ddd]
= $this->placeholders[$this->hhh . 'view' . $this->hhh]; = $this->placeholders[$this->hhh . 'view' . $this->hhh];
@ -2274,17 +2301,17 @@ class Get
unset($view->addtables); unset($view->addtables);
// set custom tabs // set custom tabs
$this->customTabs[$name_single] = null; $this->customTabs[$view->name_single_code] = null;
$view->customtabs = (isset($view->customtabs) $view->customtabs = (isset($view->customtabs)
&& ComponentbuilderHelper::checkJson($view->customtabs)) && ComponentbuilderHelper::checkJson($view->customtabs))
? json_decode($view->customtabs, true) : null; ? json_decode($view->customtabs, true) : null;
if (ComponentbuilderHelper::checkArray($view->customtabs)) if (ComponentbuilderHelper::checkArray($view->customtabs))
{ {
// setup custom tabs to global data sets // setup custom tabs to global data sets
$this->customTabs[$name_single] = array_map( $this->customTabs[$view->name_single_code] = array_map(
function ($tab) use ($name_single) { function ($tab) use (&$view) {
// set the view name // set the view name
$tab['view'] = $name_single; $tab['view'] = $view->name_single_code;
// load the dynamic data // load the dynamic data
$tab['html'] = $this->setPlaceholders( $tab['html'] = $this->setPlaceholders(
$this->setDynamicValues($tab['html']), $this->setDynamicValues($tab['html']),
@ -2445,11 +2472,11 @@ class Get
// load the field data // load the field data
$view->fields = array_map( $view->fields = array_map(
function ($field) use ( function ($field) use (
$name_single, $name_list, &$ignoreFields &$view, &$ignoreFields
) { ) {
// set the field details // set the field details
$this->setFieldDetails( $this->setFieldDetails(
$field, $name_single, $name_list $field, $view->name_single_code, $view->name_list_code
); );
// check if this field is a default field OR // check if this field is a default field OR
// check if this is none database related field // check if this is none database related field
@ -2480,7 +2507,7 @@ class Get
{ {
$this->setUpdateSQL( $this->setUpdateSQL(
json_decode($old_view->addfields, true), json_decode($old_view->addfields, true),
$view->addfields, 'field', $name_single, $view->addfields, 'field', $view->name_single_code,
$ignoreFields $ignoreFields
); );
} }
@ -2515,7 +2542,7 @@ class Get
foreach ($view->fields as $field) foreach ($view->fields as $field)
{ {
// so first we lock the field name in // so first we lock the field name in
$field_name = $this->getFieldName($field, $name_list); $field_name = $this->getFieldName($field, $view->name_list_code);
// check if the field changed since the last compilation (default fields never change and are always added) // check if the field changed since the last compilation (default fields never change and are always added)
if (!isset($ignoreFields[$field['field']]) if (!isset($ignoreFields[$field['field']])
&& ComponentbuilderHelper::checkObject( && ComponentbuilderHelper::checkObject(
@ -2528,7 +2555,7 @@ class Get
$this->setUpdateSQL( $this->setUpdateSQL(
$field['settings']->history->datatype, $field['settings']->history->datatype,
$field['settings']->datatype, 'field.datatype', $field['settings']->datatype, 'field.datatype',
$name_single . '.' . $field_name $view->name_single_code . '.' . $field_name
); );
} }
// check if the datatype lenght changed // check if the datatype lenght changed
@ -2540,7 +2567,7 @@ class Get
. $field['settings']->history->datalenght_other, . $field['settings']->history->datalenght_other,
$field['settings']->datalenght $field['settings']->datalenght
. $field['settings']->datalenght_other, . $field['settings']->datalenght_other,
'field.lenght', $name_single . '.' . $field_name 'field.lenght', $view->name_single_code . '.' . $field_name
); );
} }
// check if the name changed // check if the name changed
@ -2578,13 +2605,13 @@ class Get
); );
// only run this if not a multi field // only run this if not a multi field
if (!isset($this->uniqueNames[$name_list]['names'][$field_name])) if (!isset($this->uniqueNames[$view->name_list_code]['names'][$field_name]))
{ {
// this only works when the field is not multiple of the same field // this only works when the field is not multiple of the same field
$this->setUpdateSQL( $this->setUpdateSQL(
$old_field_name, $field_name, $old_field_name, $field_name,
'field.name', 'field.name',
$name_single . '.' . $field_name $view->name_single_code . '.' . $field_name
); );
} }
elseif ($old_field_name !== $field_name) elseif ($old_field_name !== $field_name)
@ -2597,7 +2624,7 @@ class Get
$this->app->enqueueMessage( $this->app->enqueueMessage(
JText::sprintf( JText::sprintf(
'You have a field called <b>%s</b> that has been added multiple times to the <b>%s</b> view, the name of that field has changed to <b>%s</b>. Normaly we would automaticly add the update SQL to your component, but with multiple fields this does not work automaticly since it could be that noting changed and it just seems like it did. Therefore you will have to do this manualy if it actualy did change!', 'You have a field called <b>%s</b> that has been added multiple times to the <b>%s</b> view, the name of that field has changed to <b>%s</b>. Normaly we would automaticly add the update SQL to your component, but with multiple fields this does not work automaticly since it could be that noting changed and it just seems like it did. Therefore you will have to do this manualy if it actualy did change!',
$field_name, $name_single, $field_name, $view->name_single_code,
$old_field_name $old_field_name
), 'Notice' ), 'Notice'
); );
@ -2619,7 +2646,7 @@ class Get
$this->setUpdateSQL( $this->setUpdateSQL(
ComponentbuilderHelper::safeString( ComponentbuilderHelper::safeString(
$old_view->name_single $old_view->name_single
), $name_single, 'table_name', $name_single ), $view->name_single_code, 'table_name', $view->name_single_code
); );
} }
// loop the mysql table settings // loop the mysql table settings
@ -2634,7 +2661,7 @@ class Get
$this->setUpdateSQL( $this->setUpdateSQL(
$old_view->{'mysql_table_' . $_mysqlTableKey}, $old_view->{'mysql_table_' . $_mysqlTableKey},
$view->{'mysql_table_' . $_mysqlTableKey}, $view->{'mysql_table_' . $_mysqlTableKey},
'table_' . $_mysqlTableKey, $name_single 'table_' . $_mysqlTableKey, $view->name_single_code
); );
} }
// check if there is no history on table engine, and it changed from the default/global // check if there is no history on table engine, and it changed from the default/global
@ -2649,7 +2676,7 @@ class Get
$this->setUpdateSQL( $this->setUpdateSQL(
$_mysqlTableVal['default'], $_mysqlTableVal['default'],
$view->{'mysql_table_' . $_mysqlTableKey}, $view->{'mysql_table_' . $_mysqlTableKey},
'table_' . $_mysqlTableKey, $name_single 'table_' . $_mysqlTableKey, $view->name_single_code
); );
} }
} }
@ -2702,7 +2729,7 @@ class Get
$conditionValue['target_field'][$fieldKey] $conditionValue['target_field'][$fieldKey]
= array( = array(
'name' => $this->getFieldName( 'name' => $this->getFieldName(
$fieldValues, $name_list $fieldValues, $view->name_list_code
), ),
'type' => $this->getFieldType( 'type' => $this->getFieldType(
$fieldValues $fieldValues
@ -2730,7 +2757,7 @@ class Get
// set the field details // set the field details
$conditionValue['match_name'] $conditionValue['match_name']
= $this->getFieldName( = $this->getFieldName(
$fieldValue, $name_list $fieldValue, $view->name_list_code
); );
$conditionValue['match_type'] = $type; $conditionValue['match_type'] = $type;
$conditionValue['match_xml'] $conditionValue['match_xml']
@ -2760,9 +2787,9 @@ class Get
unset($view->addconditions); unset($view->addconditions);
// prep the buckets // prep the buckets
$this->fieldRelations[$name_list] = array(); $this->fieldRelations[$view->name_list_code] = array();
$this->listJoinBuilder[$name_list] = array(); $this->listJoinBuilder[$view->name_list_code] = array();
$this->listHeadOverRide[$name_list] = array(); $this->listHeadOverRide[$view->name_list_code] = array();
// set the relations // set the relations
$view->addrelations = (isset($view->addrelations) $view->addrelations = (isset($view->addrelations)
&& ComponentbuilderHelper::checkJson($view->addrelations)) && ComponentbuilderHelper::checkJson($view->addrelations))
@ -2792,16 +2819,16 @@ class Get
); );
} }
// check that the arrays are set // check that the arrays are set
if (!isset($this->fieldRelations[$name_list][(int) $relationsValue['listfield']]) if (!isset($this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']])
|| !ComponentbuilderHelper::checkArray( || !ComponentbuilderHelper::checkArray(
$this->fieldRelations[$name_list][(int) $relationsValue['listfield']] $this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']]
)) ))
{ {
$this->fieldRelations[$name_list][(int) $relationsValue['listfield']] $this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']]
= array(); = array();
} }
// load the field relations // load the field relations
$this->fieldRelations[$name_list][(int) $relationsValue['listfield']][(int) $relationsValue['area']] $this->fieldRelations[$view->name_list_code][(int) $relationsValue['listfield']][(int) $relationsValue['area']]
= $relationsValue; = $relationsValue;
// load the list joints // load the list joints
if (isset($relationsValue['joinfields']) if (isset($relationsValue['joinfields'])
@ -2811,7 +2838,7 @@ class Get
{ {
foreach ($relationsValue['joinfields'] as $join) foreach ($relationsValue['joinfields'] as $join)
{ {
$this->listJoinBuilder[$name_list][(int) $join] $this->listJoinBuilder[$view->name_list_code][(int) $join]
= (int) $join; = (int) $join;
} }
} }
@ -2829,7 +2856,7 @@ class Get
{ {
$column_name_lang = $this->langPrefix . '_' $column_name_lang = $this->langPrefix . '_'
. ComponentbuilderHelper::safeString( . ComponentbuilderHelper::safeString(
$name_list, 'U' $view->name_list_code, 'U'
) . '_' ) . '_'
. ComponentbuilderHelper::safeString( . ComponentbuilderHelper::safeString(
$relationsValue['column_name'], 'U' $relationsValue['column_name'], 'U'
@ -2838,7 +2865,7 @@ class Get
'admin', $column_name_lang, 'admin', $column_name_lang,
$relationsValue['column_name'] $relationsValue['column_name']
); );
$this->listHeadOverRide[$name_list][(int) $relationsValue['listfield']] $this->listHeadOverRide[$view->name_list_code][(int) $relationsValue['listfield']]
= $column_name_lang; = $column_name_lang;
} }
} }
@ -2848,7 +2875,7 @@ class Get
unset($view->addrelations); unset($view->addrelations);
// set linked views // set linked views
$this->linkedAdminViews[$name_single] = null; $this->linkedAdminViews[$view->name_single_code] = null;
$view->addlinked_views $view->addlinked_views
= (isset($view->addlinked_views) = (isset($view->addlinked_views)
&& ComponentbuilderHelper::checkJson($view->addlinked_views)) && ComponentbuilderHelper::checkJson($view->addlinked_views))
@ -2856,7 +2883,7 @@ class Get
if (ComponentbuilderHelper::checkArray($view->addlinked_views)) if (ComponentbuilderHelper::checkArray($view->addlinked_views))
{ {
// setup linked views to global data sets // setup linked views to global data sets
$this->linkedAdminViews[$name_single] = array_values( $this->linkedAdminViews[$view->name_single_code] = array_values(
$view->addlinked_views $view->addlinked_views
); );
} }
@ -2890,7 +2917,7 @@ class Get
$this->setCustomScriptBuilder( $this->setCustomScriptBuilder(
$view->{$scripter}, $view->{$scripter},
$scripter_target, $scripter_target,
$name_single, $view->name_single_code,
false, false,
$guiMapper, $guiMapper,
true, true,
@ -2903,9 +2930,9 @@ class Get
$view->$scripter, "task=ajax" $view->$scripter, "task=ajax"
) !== false) ) !== false)
{ {
if (!$this->customScriptBuilder['token'][$name_single]) if (!$this->customScriptBuilder['token'][$view->name_single_code])
{ {
$this->customScriptBuilder['token'][$name_single] $this->customScriptBuilder['token'][$view->name_single_code]
= true; = true;
} }
} }
@ -2924,7 +2951,7 @@ class Get
$this->setCustomScriptBuilder( $this->setCustomScriptBuilder(
$view->{$scripter}, $view->{$scripter},
$scripter, $scripter,
$name_single, $view->name_single_code,
false, false,
array('prefix' => PHP_EOL), array('prefix' => PHP_EOL),
true, true,
@ -2956,13 +2983,13 @@ class Get
$this->setCustomScriptBuilder( $this->setCustomScriptBuilder(
$view->{$scripter}, $view->{$scripter},
$scripter, $scripter,
$name_single, $view->name_single_code,
false, false,
$guiMapper $guiMapper
); );
// check if we have template or layouts to load // check if we have template or layouts to load
$this->setTemplateAndLayoutData($view->{$scripter}, $name_single); $this->setTemplateAndLayoutData($view->{$scripter}, $view->name_single_code);
unset($view->{$scripter}); unset($view->{$scripter});
} }
@ -2996,7 +3023,7 @@ class Get
); );
// check if we have template or layouts to load // check if we have template or layouts to load
$this->setTemplateAndLayoutData($view->{$button_code_field}, $name_single); $this->setTemplateAndLayoutData($view->{$button_code_field}, $view->name_single_code);
} }
} }
// set the button array // set the button array
@ -3035,7 +3062,7 @@ class Get
$this->setCustomScriptBuilder( $this->setCustomScriptBuilder(
$view->$importScripter, $view->$importScripter,
$importScripter, $importScripter,
'import_' . $name_list, 'import_' . $view->name_list_code,
false, false,
$guiMapper $guiMapper
); );
@ -3045,7 +3072,7 @@ class Get
{ {
// load the default // load the default
$this->customScriptBuilder[$importScripter]['import_' $this->customScriptBuilder[$importScripter]['import_'
. $name_list] . $view->name_list_code]
= ComponentbuilderHelper::getDynamicScripts( = ComponentbuilderHelper::getDynamicScripts(
$importScripter, true $importScripter, true
); );
@ -3056,7 +3083,7 @@ class Get
if (isset($view->add_php_ajax) && $view->add_php_ajax == 1) if (isset($view->add_php_ajax) && $view->add_php_ajax == 1)
{ {
// insure the token is added to edit view atleast // insure the token is added to edit view atleast
$this->customScriptBuilder['token'][$name_single] = true; $this->customScriptBuilder['token'][$view->name_single_code] = true;
$addAjaxSite = false; $addAjaxSite = false;
if (isset($this->siteEditView[$id]) && $this->siteEditView[$id]) if (isset($this->siteEditView[$id]) && $this->siteEditView[$id])
{ {
@ -3075,10 +3102,10 @@ class Get
{ {
if ($addAjaxSite) if ($addAjaxSite)
{ {
$this->customScriptBuilder['site']['ajax_controller'][$name_single] $this->customScriptBuilder['site']['ajax_controller'][$view->name_single_code]
= array_values($view->ajax_input); = array_values($view->ajax_input);
} }
$this->customScriptBuilder['admin']['ajax_controller'][$name_single] $this->customScriptBuilder['admin']['ajax_controller'][$view->name_single_code]
= array_values($view->ajax_input); = array_values($view->ajax_input);
$this->addAjax = true; $this->addAjax = true;
unset($view->ajax_input); unset($view->ajax_input);
@ -3093,7 +3120,7 @@ class Get
$view->php_ajaxmethod, $view->php_ajaxmethod,
'admin', 'admin',
'ajax_model', 'ajax_model',
$name_single, $view->name_single_code,
$guiMapper $guiMapper
); );
@ -3103,7 +3130,7 @@ class Get
$view->php_ajaxmethod, $view->php_ajaxmethod,
'site', 'site',
'ajax_model', 'ajax_model',
$name_single, $view->name_single_code,
$guiMapper, $guiMapper,
false, false,
false false
@ -3115,7 +3142,7 @@ class Get
} }
} }
// activate alias builder // activate alias builder
if (!isset($this->customAliasBuilder[$name_single]) if (!isset($this->customAliasBuilder[$view->name_single_code])
&& isset($view->alias_builder_type) && isset($view->alias_builder_type)
&& 2 == $view->alias_builder_type && 2 == $view->alias_builder_type
&& isset($view->alias_builder) && isset($view->alias_builder)
@ -3139,9 +3166,9 @@ class Get
if (ComponentbuilderHelper::checkArray($alias_fields)) if (ComponentbuilderHelper::checkArray($alias_fields))
{ {
// load the field names // load the field names
$this->customAliasBuilder[$name_single] = (array) array_map( $this->customAliasBuilder[$view->name_single_code] = (array) array_map(
function ($field) use ($name_list) { function ($field) use (&$view) {
return $this->getFieldName($field, $name_list); return $this->getFieldName($field, $view->name_list_code);
}, $alias_fields }, $alias_fields
); );
} }
@ -3154,8 +3181,8 @@ class Get
if ($view->source == 1 && isset($view->tables)) if ($view->source == 1 && isset($view->tables))
{ {
// build and add the SQL dump // build and add the SQL dump
$this->customScriptBuilder['sql'][$name_single] $this->customScriptBuilder['sql'][$view->name_single_code]
= $this->buildSqlDump($view->tables, $name_single, $id); = $this->buildSqlDump($view->tables, $view->name_single_code, $id);
unset($view->tables); unset($view->tables);
} }
elseif ($view->source == 2 && isset($view->sql)) elseif ($view->source == 2 && isset($view->sql))
@ -3164,15 +3191,15 @@ class Get
$this->setCustomScriptBuilder( $this->setCustomScriptBuilder(
$view->sql, $view->sql,
'sql', 'sql',
$name_single $view->name_single_code
); );
unset($view->sql); unset($view->sql);
} }
} }
// load table settings // load table settings
if (!isset($this->mysqlTableSetting[$name_single])) if (!isset($this->mysqlTableSetting[$view->name_single_code]))
{ {
$this->mysqlTableSetting[$name_single] = array(); $this->mysqlTableSetting[$view->name_single_code] = array();
} }
// set mySql Table Settings // set mySql Table Settings
foreach ( foreach (
@ -3185,12 +3212,12 @@ class Get
) )
&& !is_numeric($view->{'mysql_table_' . $_mysqlTableKey})) && !is_numeric($view->{'mysql_table_' . $_mysqlTableKey}))
{ {
$this->mysqlTableSetting[$name_single][$_mysqlTableKey] $this->mysqlTableSetting[$view->name_single_code][$_mysqlTableKey]
= $view->{'mysql_table_' . $_mysqlTableKey}; = $view->{'mysql_table_' . $_mysqlTableKey};
} }
else else
{ {
$this->mysqlTableSetting[$name_single][$_mysqlTableKey] $this->mysqlTableSetting[$view->name_single_code][$_mysqlTableKey]
= $_mysqlTableVal['default']; = $_mysqlTableVal['default'];
} }
// remove the table values since we moved to another object // remove the table values since we moved to another object

View File

@ -4876,7 +4876,7 @@ class Fields extends Structure
'list' => $_list); 'list' => $_list);
} }
// build the filter values // build the filter values
if ($dbSwitch && (isset($field['filter']) && $field['filter'] == 1) if ($dbSwitch && (isset($field['filter']) && $field['filter'] >= 1)
&& ($listSwitch || $listJoin) && ($listSwitch || $listJoin)
&& (!$multiple && $typeName != 'checkbox' && (!$multiple && $typeName != 'checkbox'
&& $typeName != 'checkboxes' && $typeName != 'checkboxes'
@ -4884,6 +4884,7 @@ class Fields extends Structure
&& $typeName != 'subform')) && $typeName != 'subform'))
{ {
$this->filterBuilder[$view_name_list][] = array('type' => $typeName, $this->filterBuilder[$view_name_list][] = array('type' => $typeName,
'multi' => $field['filter'],
'code' => $name, 'code' => $name,
'lang' => $listLangName, 'lang' => $listLangName,
'database' => $view_name_single, 'database' => $view_name_single,

View File

@ -842,9 +842,8 @@ class Interpretation extends Fields
JText::_('<hr /><h3>WHMCS Error</h3>'), 'Error' JText::_('<hr /><h3>WHMCS Error</h3>'), 'Error'
); );
$this->app->enqueueMessage( $this->app->enqueueMessage(
JText::sprintf( JText::_(
'The <b>WHMCS class</b> could not be added to this component. You will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes. If you have done this, then please check that you have your own <b>Basic Encryption<b/> set in the global settings of JCB. Then open and save this component again, making sure that your WHMCS settings are still correct.', 'The <b>WHMCS class</b> could not be added to this component. You will need to enable the add-on in the Joomla Component area (Add WHMCS)->Yes. If you have done this, then please check that you have your own <b>Basic Encryption<b/> set in the global settings of JCB. Then open and save this component again, making sure that your WHMCS settings are still correct.'
$this->libraries[$id]->name
), 'Error' ), 'Error'
); );
@ -17233,7 +17232,10 @@ class Interpretation extends Fields
public function setFilterFunctions($viewName_single, $viewName_list) public function setFilterFunctions($viewName_single, $viewName_list)
{ {
if (isset($this->filterBuilder[$viewName_list]) // the old filter type uses these functions
if (isset($this->adminFilterType[$viewName_list])
&& $this->adminFilterType[$viewName_list] == 1
&& isset($this->filterBuilder[$viewName_list])
&& ComponentbuilderHelper::checkArray( && ComponentbuilderHelper::checkArray(
$this->filterBuilder[$viewName_list] $this->filterBuilder[$viewName_list]
)) ))
@ -21201,7 +21203,7 @@ class Interpretation extends Fields
{ {
$router = PHP_EOL . $this->_t(2) . "case '" . $viewName . "':"; $router = PHP_EOL . $this->_t(2) . "case '" . $viewName . "':";
$router .= PHP_EOL . $this->_t(3) $router .= PHP_EOL . $this->_t(3)
. "\$id = explode(':', \$segments[$count-1]);"; . "\$id = explode(':', \$segments[\$count-1]);";
$router .= PHP_EOL . $this->_t(3) . "\$vars['id'] = (int) \$id[0];"; $router .= PHP_EOL . $this->_t(3) . "\$vars['id'] = (int) \$id[0];";
$router .= PHP_EOL . $this->_t(3) . "\$vars['view'] = '" . $viewName $router .= PHP_EOL . $this->_t(3) . "\$vars['view'] = '" . $viewName
. "';"; . "';";

File diff suppressed because it is too large Load Diff

View File

@ -106,7 +106,7 @@
layout="repeatablejcb" layout="repeatablejcb"
multiple="true" multiple="true"
description="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDADMIN_VIEWS_DESCRIPTION" description="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADDADMIN_VIEWS_DESCRIPTION"
default="[{&quot;submenu&quot;:&quot;1&quot;,&quot;checkin&quot;:&quot;1&quot;,&quot;history&quot;:&quot;1&quot;,&quot;access&quot;:&quot;1&quot;,&quot;port&quot;:&quot;1&quot;,&quot;filter&quot;:&quot;1&quot;}]" default="[{&quot;submenu&quot;:&quot;1&quot;,&quot;checkin&quot;:&quot;1&quot;,&quot;history&quot;:&quot;1&quot;,&quot;access&quot;:&quot;1&quot;,&quot;port&quot;:&quot;1&quot;,&quot;filter&quot;:&quot;2&quot;}]"
icon="list" icon="list"
min="1"> min="1">
<form hidden="true" name="list_addadmin_views_modal" repeat="true"> <form hidden="true" name="list_addadmin_views_modal" repeat="true">
@ -661,7 +661,7 @@
description="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILTER_DESCRIPTION" description="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILTER_DESCRIPTION"
class="fieldMedium" class="fieldMedium"
multiple="false" multiple="false"
default="1"> default="2">
<!-- Option Set. --> <!-- Option Set. -->
<option value="1"> <option value="1">
COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SIDE_OLD</option> COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SIDE_OLD</option>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade"> <extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name> <name>COM_COMPONENTBUILDER</name>
<creationDate>14th November, 2020</creationDate> <creationDate>17th November, 2020</creationDate>
<author>Llewellyn van der Merwe</author> <author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail> <authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl> <authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>