~fabiocbalbuquerque/sahana-agasti/web-services

« back to all changes in this revision

Viewing changes to apps/frontend/lib/util/agImportHelper.class.php

  • Committer: Chad Heuschober
  • Date: 2011-08-03 23:10:59 UTC
  • mto: (1.26.1 push-trunk)
  • mto: This revision was merged to the branch mainline in revision 25.
  • Revision ID: chad.heuschober@mail.cuny.edu-20110803231059-mel2ic5rhlaldqc5
Fixed facility import to uniquely create facilities.

Show diffs side-by-side

added added

removed removed

Lines of Context:
137
137
    switch($columnDefinition['type']) {
138
138
      case 'integer':
139
139
      case 'int':
140
 
        return strlen(pow(256, $columnDefinition['length']));
 
140
        return strlen(pow(256, $columnDefinition['length'])) + 1;
 
141
        break;
 
142
      case 'decimal':
 
143
      case 'dec':
 
144
        return $columnDefinition['length'] + 2;
141
145
        break;
142
146
      default:
143
147
        return $columnDefinition['length'];
371
375
          for ($col = 1; $col <= $numCols; $col++) {
372
376
            // try to grab the raw value
373
377
            $val = $xlsObj->raw($row, $col, $sheet);
374
 
            if (!($val)) {
 
378
            if (!$val) {
375
379
              // failing that, grab its formatted value
376
380
              $val = $xlsObj->val($row, $col, $sheet);
377
381
            }
392
396
            // add the data, either way, to our importRow variable using the column name we picked up
393
397
            // off the first sheet
394
398
            $importRow[$currentSheetHeaders[$col]] = $val;
 
399
            unset($val);
395
400
          }
396
401
 
397
402
          // check for empty rows early to prevent