Skip to content

Commit

Permalink
Fixed issue #3536: SPSS export incorrectly exports numerical only lab…
Browse files Browse the repository at this point in the history
…elsets as alpha fields

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@7406 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
mennodekker committed Aug 5, 2009
1 parent 8be35a8 commit 88ed87b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions admin/export_data_functions.php
Expand Up @@ -257,14 +257,17 @@ function spss_getvalues ($field = array()) {
if (count($answers)>0) {
//check the max width of the answers
$size = 0;
$answers['SPSStype'] = $field['SPSStype'];
$spssType = 'F'; //Try if we can use num and use alpha as fallback
$size = 1;
foreach ($answers as $answer) {
$len = mb_strlen($answer['code']);
if ($len>$size) $size = $len;
if ($answers['SPSStype']=='F' && (my_is_numeric($answer['code'])===false || $size>16)) $answers['SPSStype']='A';
if ($spssType =='F' && (my_is_numeric($answer['code'])===false || $size>16)) $spssType='A';
}
$answers['size'] = $size;
$answers['SPSStype'] = $spssType;
return $answers;

} else {
return false;
}
Expand Down

0 comments on commit 88ed87b

Please sign in to comment.