forked from joomla/Component-Builder
Fixed gh-518 to allow decimal for SQL to work properly. Fixed database relationship mapping in dynamicGet area.
This commit is contained in:
parent
12c456ca6b
commit
4664d89d0e
@ -144,11 +144,11 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 4th February, 2020
|
||||
+ *Last Build*: 9th February, 2020
|
||||
+ *Version*: 2.10.11
|
||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **281315**
|
||||
+ *Line count*: **281319**
|
||||
+ *Field count*: **1505**
|
||||
+ *File count*: **1770**
|
||||
+ *Folder count*: **280**
|
||||
|
@ -144,11 +144,11 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 4th February, 2020
|
||||
+ *Last Build*: 9th February, 2020
|
||||
+ *Version*: 2.10.11
|
||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
+ *Line count*: **281315**
|
||||
+ *Line count*: **281319**
|
||||
+ *Field count*: **1505**
|
||||
+ *File count*: **1770**
|
||||
+ *Folder count*: **280**
|
||||
|
@ -3613,15 +3613,14 @@ class Get
|
||||
// array(join_field_as, join_field)
|
||||
$bucket['join_field'] = array_map('trim', explode('.', $op['join_field']));
|
||||
// triget filed that has table a relationship
|
||||
if ($bucket['on_field'][0] === 'a' ||
|
||||
if ($op['row_type'] == 1 && ($bucket['on_field'][0] === 'a' ||
|
||||
isset($_part_of_a[$bucket['on_field'][0]]) ||
|
||||
isset($_part_of_a[$bucket['join_field'][0]]))
|
||||
isset($_part_of_a[$bucket['join_field'][0]])))
|
||||
{
|
||||
$_part_of_a[$op['as']] = $op['as'];
|
||||
}
|
||||
return $bucket;
|
||||
}, $result->join_view_table);
|
||||
|
||||
// loop joints
|
||||
foreach ($result->join_view_table as $nr => &$option)
|
||||
{
|
||||
@ -3679,9 +3678,9 @@ class Get
|
||||
// array(join_field_as, join_field)
|
||||
$bucket['join_field'] = array_map('trim', explode('.', $op['join_field']));
|
||||
// triget filed that has table a relationship
|
||||
if ($bucket['on_field'][0] === 'a' ||
|
||||
if ($op['row_type'] == 1 && ($bucket['on_field'][0] === 'a' ||
|
||||
isset($_part_of_a[$bucket['on_field'][0]]) ||
|
||||
isset($_part_of_a[$bucket['join_field'][0]]))
|
||||
isset($_part_of_a[$bucket['join_field'][0]])))
|
||||
{
|
||||
$_part_of_a[$op['as']] = $op['as'];
|
||||
}
|
||||
|
@ -2734,12 +2734,25 @@ class Fields extends Structure
|
||||
elseif (isset($field['settings']->datatype))
|
||||
{
|
||||
// insure default not none if number type
|
||||
$intKeys = array('INT', 'TINYINT', 'BIGINT', 'FLOAT', 'DECIMAL', 'DOUBLE');
|
||||
if (in_array($field['settings']->datatype, $intKeys))
|
||||
$numberKeys = array('INT', 'TINYINT', 'BIGINT', 'FLOAT', 'DECIMAL', 'DOUBLE');
|
||||
// don't use these as index or uniqe keys
|
||||
$textKeys = array('TEXT', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', 'BLOB', 'TINYBLOB', 'MEDIUMBLOB', 'LONGBLOB');
|
||||
// build the query values
|
||||
$this->queryBuilder[$view_name_single][$name]['type'] = $field['settings']->datatype;
|
||||
// check if this is a number
|
||||
if (in_array($field['settings']->datatype, $numberKeys))
|
||||
{
|
||||
if ($field['settings']->datadefault === 'Other')
|
||||
{
|
||||
if (!is_numeric($field['settings']->datadefault_other) || $field['settings']->datadefault_other !== '0000-00-00 00:00:00')
|
||||
// setup the checking
|
||||
$number_check = $field['settings']->datadefault_other;
|
||||
// Decimals in SQL needs some help
|
||||
if ('DECIMAL' === $field['settings']->datatype && !is_numeric($number_check))
|
||||
{
|
||||
$number_check = str_replace(',', '.', $field['settings']->datadefault_other);
|
||||
}
|
||||
// check if we have a valid number value
|
||||
if (!is_numeric($number_check))
|
||||
{
|
||||
$field['settings']->datadefault_other = '0';
|
||||
}
|
||||
@ -2749,10 +2762,7 @@ class Fields extends Structure
|
||||
$field['settings']->datadefault = '0';
|
||||
}
|
||||
}
|
||||
// don't use these as index or uniqe keys
|
||||
$textKeys = array('TEXT', 'TINYTEXT', 'MEDIUMTEXT', 'LONGTEXT', 'BLOB', 'TINYBLOB', 'MEDIUMBLOB', 'LONGBLOB');
|
||||
// build the query values
|
||||
$this->queryBuilder[$view_name_single][$name]['type'] = $field['settings']->datatype;
|
||||
// check if this is not text
|
||||
if (!in_array($field['settings']->datatype, $textKeys))
|
||||
{
|
||||
$this->queryBuilder[$view_name_single][$name]['lenght'] = $field['settings']->datalenght;
|
||||
@ -2760,6 +2770,7 @@ class Fields extends Structure
|
||||
$this->queryBuilder[$view_name_single][$name]['default'] = $field['settings']->datadefault;
|
||||
$this->queryBuilder[$view_name_single][$name]['other'] = $field['settings']->datadefault_other;
|
||||
}
|
||||
// fall back unto EMPTY for text
|
||||
else
|
||||
{
|
||||
$this->queryBuilder[$view_name_single][$name]['default'] = 'EMPTY';
|
||||
|
@ -1637,10 +1637,10 @@ class Interpretation extends Fields
|
||||
{
|
||||
// to insure that there be no double entries of a call
|
||||
$checker = md5(serialize($the_get) . $code);
|
||||
if (!isset($this->customViewQueryChecker[$this->target]) || !in_array($checker, $this->customViewQueryChecker[$this->target]))
|
||||
if (!isset($this->customViewQueryChecker[$this->target]) || !isset($checker, $this->customViewQueryChecker[$this->target][$checker]))
|
||||
{
|
||||
// load this unuiqe key
|
||||
$this->customViewQueryChecker[$this->target][] = $checker;
|
||||
$this->customViewQueryChecker[$this->target][$checker] = true;
|
||||
if (isset($the_get['selection']['type']) && ComponentbuilderHelper::checkString($the_get['selection']['type']))
|
||||
{
|
||||
$getItem = PHP_EOL . PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . "//" . $this->setLine(__LINE__) . " Get from " . $the_get['selection']['table'] . " as " . $the_get['as'];
|
||||
@ -1673,7 +1673,9 @@ class Interpretation extends Fields
|
||||
// set the method defaults
|
||||
if (($default = $this->setCustomViewMethodDefaults($the_get, $code)) !== false)
|
||||
{
|
||||
if (isset($this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']]) && ComponentbuilderHelper::checkString($this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']]) && !in_array($check, $mainAsArray))
|
||||
if (isset($this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']])
|
||||
&& ComponentbuilderHelper::checkString($this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']])
|
||||
&& !in_array($check, $mainAsArray))
|
||||
{
|
||||
// load to other query
|
||||
if (!isset($this->otherQuery[$this->target][$default['code']][$this->siteDynamicGet[$this->target][$default['code']][$default['as']][$default['join_field']]][$default['valueName']]))
|
||||
@ -4458,7 +4460,7 @@ class Interpretation extends Fields
|
||||
else
|
||||
{
|
||||
// insure the form is added (only if no form exist)
|
||||
if ('admin' === $this->target && strpos($view['settings']->default, '<form') === false)
|
||||
if ('site' !== $this->target && strpos($view['settings']->default, '<form') === false)
|
||||
{
|
||||
$this->addCustomForm[$this->target][$view['settings']->code] = true;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ JHtml::_('behavior.keepalive');
|
||||
}
|
||||
</script>
|
||||
<?php $urlId = (isset($this->item->id)) ? '&id='. (int) $this->item->id : ''; ?>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=assistant' . $urlId); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
|
||||
<script type="text/javascript">
|
||||
// Add spindle-wheel for importations:
|
||||
@ -123,7 +124,10 @@ function JRouter(link) {
|
||||
?>
|
||||
return url+link;
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<h1><?php echo JText::_('COM_COMPONENTBUILDER_NO_ACCESS_GRANTED'); ?></h1>
|
||||
<?php endif; ?>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.2" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>4th February, 2020</creationDate>
|
||||
<creationDate>9th February, 2020</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
||||
|
Loading…
Reference in New Issue
Block a user