View | Details | Raw Unified | Return to bug 13952
Collapse All | Expand All

(-)a/admin/import_export_framework.pl (-6 / +4 lines)
Lines 40-47 unless ($auth_status eq 'ok') { Link Here
40
    exit 0;
40
    exit 0;
41
}
41
}
42
42
43
my $framework_name = $input->param('frameworkcode') || 'default';
43
my $frameworkcode = $input->param('frameworkcode') || 'default';
44
my $frameworkcode = ($framework_name eq 'default') ? q{} : $framework_name;
45
my $action = $input->param('action') || 'export';
44
my $action = $input->param('action') || 'export';
46
45
47
## Exporting
46
## Exporting
Lines 59-77 if ($action eq 'export' && $input->request_method() eq 'GET') { Link Here
59
58
60
        # Correctly set the encoding to output plain text in UTF-8
59
        # Correctly set the encoding to output plain text in UTF-8
61
        binmode(STDOUT,':encoding(UTF-8)');
60
        binmode(STDOUT,':encoding(UTF-8)');
62
        print $input->header(-type => 'application/vnd.ms-excel', -attachment => 'export_' . $framework_name . '.csv');
61
        print $input->header(-type => 'application/vnd.ms-excel', -attachment => 'export_' . $frameworkcode . '.csv');
63
        print $strXml;
62
        print $strXml;
64
    } else {
63
    } else {
65
        # ODS file
64
        # ODS file
66
        my $strODS = '';
65
        my $strODS = '';
67
        createODS($strXml, 'en', \$strODS);
66
        createODS($strXml, 'en', \$strODS);
68
        print $input->header(-type => 'application/vnd.oasis.opendocument.spreadsheet', -attachment => 'export_' . $framework_name . '.ods');
67
        print $input->header(-type => 'application/vnd.oasis.opendocument.spreadsheet', -attachment => 'export_' . $frameworkcode . '.ods');
69
        print $strODS;
68
        print $strODS;
70
    }
69
    }
71
## Importing
70
## Importing
72
} elsif ($input->request_method() eq 'POST') {
71
} elsif ($input->request_method() eq 'POST') {
73
    my $ok = -1;
72
    my $ok = -1;
74
    my $fieldname = 'file_import_' . $framework_name;
73
    my $fieldname = 'file_import_' . $frameworkcode;
75
    my $filename = $input->param($fieldname);
74
    my $filename = $input->param($fieldname);
76
    # upload the input file
75
    # upload the input file
77
    if ($filename && $filename =~ /\.(csv|ods)$/i) {
76
    if ($filename && $filename =~ /\.(csv|ods)$/i) {
78
- 

Return to bug 13952