Skip to content

Commit

Permalink
fixing invalid query when editing db join element and default cnn not…
Browse files Browse the repository at this point in the history
… J cnn
  • Loading branch information
pollen8 committed Sep 13, 2011
1 parent cb330e3 commit cd665d6
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 214 deletions.
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*.jpg
cache/*
administrator/*
!administrator/components/com_fabrik/*
!administrator/components/com_fabrik/
cache/*
components/*
!components/com_fabrik
Expand All @@ -26,7 +26,13 @@ plugins/*
plugins/search/*
!plugins/search/fabrik
plugins/system/*
!plugins/system/fabrikcron/
!plugins/fabrik_element/
!plugins/fabrik_form/
!plugins/fabrik_list/
!plugins/fabrik_cron/
!plugins/fabrik_validationrule/
!plugins/fabrik_visualization/
!tttplugins/system/fabrikcron/
robots.txt
sql/*
tests/*
Expand Down
12 changes: 6 additions & 6 deletions administrator/components/com_fabrik/models/fields/popupforms.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ function getOptions()
// Initialize variables.
$options = array();

$db = FabrikWorker::getDbo();
$db = FabrikWorker::getDbo(true);
$query = $db->getQuery(true);
$query->select('f.id AS value, f.label AS text, l.id AS listid');
$query->from('#__fabrik_forms AS f');
$query->join('LEFT', '#__fabrik_lists As l ON f.id = l.form_id');
$query->where('f.published = 1 AND l.db_table_name =' . $db->Quote($this->form->getValue('params.join_db_name')));
$query->order('f.label');
$query->select('f.id AS value, f.label AS text, l.id AS listid')
->from('#__{package}_forms AS f')
->join('LEFT', '#__{package}_lists As l ON f.id = l.form_id')
->where('f.published = 1 AND l.db_table_name = '.$db->Quote($this->form->getValue('params.join_db_name')))
->order('f.label');

// Get the options.
$db->setQuery($query);
Expand Down
6 changes: 3 additions & 3 deletions administrator/components/com_fabrik/models/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -925,15 +925,15 @@ function makeElementsFromFields($groupId, $tableName)
$elementModel = new plgFabrik_Element($dispatcher);
$pluginManager = $this->getFormModel()->getPluginManager();
$user = JFactory::getUser();
$elementTypes = JRequest::getVar('elementtype', array(), 'default', 'array');
$elementTypes = JRequest::getVar('elementtype', array());
$fields = $fabrikDb->getTableFields(array($tableName));
$fields = $fields[$tableName];
$createdate = JFactory::getDate()->toMySQL();
$key = $this->getFEModel()->getPrimaryKeyAndExtra($tableName);
$ordering = 0;
// no existing fabrik table so we take a guess at the most
//relavent element types to create
$elementLabels = JRequest::getVar('elementlabels', array(), 'default', 'array');
$elementLabels = JRequest::getVar('elementlabels', array());
foreach ($fields as $label => $type) {
$element = FabTable::getInstance('Element', 'FabrikTable');
if (array_key_exists($ordering, $elementTypes)) {
Expand Down Expand Up @@ -1155,7 +1155,7 @@ public function copy()
{
$db = FabrikWorker::getDbo(true);
$user = JFactory::getUser();
$pks = JRequest::getVar('cid', array(), 'default', 'array');
$pks = JRequest::getVar('cid', array());
$post = JRequest::get('post');
foreach ($pks as $i => $pk) {
$item =& $this->getTable();
Expand Down
23 changes: 16 additions & 7 deletions plugins/fabrik_element/databasejoin/databasejoin.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,15 +707,24 @@ function getTitlePart($data, $repeatCounter = 0, $opts = array())
protected function getLinkedForms()
{
if (!isset($this->_linkedForms)) {
$db =& FabrikWorker::getDbo();
$params =& $this->getParams();
$db = FabrikWorker::getDbo(true);
$params = $this->getParams();
//forms for potential add record pop up form
$db->setQuery("SELECT f.id AS value, f.label AS text, l.id AS listid FROM
#__{package}_forms AS f LEFT JOIN #__{package}_lists As l
ON f.id = l.form_id
WHERE f.published = 1 AND l.db_table_name = '" . $params->get('join_db_name') . "'
ORDER BY f.label");

$query = $db->getQuery(true);
$query->select('f.id AS value, f.label AS text, l.id AS listid')
->from('#__{package}_forms AS f')
->join('LEFT', '#__{package}_lists As l ON f.id = l.form_id')
->where('f.published = 1 AND l.db_table_name = '.$db->Quote($params->get('join_db_name')))
->order('f.label');
$db->setQuery($query);

$this->_linkedForms = $db->loadObjectList('value');

// Check for a database error.
if ($db->getErrorNum()) {
JError::raiseError(500, $db->getErrorMsg());
}
}
return $this->_linkedForms;
}
Expand Down
29 changes: 0 additions & 29 deletions plugins/fabrik_form/pingdotfm/.svn/all-wcprops

This file was deleted.

167 changes: 0 additions & 167 deletions plugins/fabrik_form/pingdotfm/.svn/entries

This file was deleted.

0 comments on commit cd665d6

Please sign in to comment.