Skip to content

Commit

Permalink
Fixed issue #6386: Importing CSV labels sets from LS website throws S…
Browse files Browse the repository at this point in the history
…QL exception
  • Loading branch information
c-schmitz committed Jul 26, 2012
1 parent 81eb823 commit 945dc7f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
3 changes: 0 additions & 3 deletions application/controllers/admin/labels.php
Expand Up @@ -12,8 +12,6 @@
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id$
*/

/**
Expand All @@ -22,7 +20,6 @@
* @package LimeSurvey
* @author
* @copyright 2011
* @version $Id$
* @access public
*/
class labels extends Survey_Common_Action
Expand Down
13 changes: 3 additions & 10 deletions application/helpers/admin/import_helper.php
Expand Up @@ -9,7 +9,6 @@
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
*/


Expand Down Expand Up @@ -2024,15 +2023,12 @@ function CSVImportLabelset($sFullFilepath, $options)

unset($labelsetrowdata['lid']);

$newvalues=array_values($labelsetrowdata);
if ($xssfilter)
XSSFilterArray($newvalues);
$lsainsert = "insert INTO {{labelsets}} (".implode(',',array_keys($labelsetrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix
$lsiresult= Yii::app()->db->createCommand($lsainsert)->query();
// Insert the label set entry and get the new insert id for the labels inside this labelset
$newlid=Labelsets::model()->insertRecords($labelsetrowdata);
$results['labelsets']++;

// Get the new insert id for the labels inside this labelset
$newlid=Yii::app()->db->getLastInsertID();

if ($labelsarray) {
$count=0;
Expand All @@ -2055,12 +2051,9 @@ function CSVImportLabelset($sFullFilepath, $options)
$labelrowdata["assessment_value"]=(int)$labelrowdata["code"];
}

$newvalues=array_values($labelrowdata);
if ($xssfilter)
XSSFilterArray($newvalues);
$lainsert = "insert INTO {{labels}} (".implode(',',array_keys($labelrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix
$liresult=Yii::app()->db->createCommand($lainsert)->query();

Label::model()->insertRecords($labelrowdata);
$results['labels']++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/common_helper.php
Expand Up @@ -2916,7 +2916,7 @@ function buildLabelSetCheckSumArray()
/**$query = "SELECT lid
FROM ".db_table_name('labelsets')."
ORDER BY lid"; */
$result = Labelsets::getLID();//($query) or safeDie("safe_died collecting labelset ids<br />$query<br />"); //Checked)
$result = Labelsets::model()->getLID();//($query) or safeDie("safe_died collecting labelset ids<br />$query<br />"); //Checked)
$csarray=array();
foreach($result as $row)
{
Expand Down

0 comments on commit 945dc7f

Please sign in to comment.