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

(-)a/admin/import_export_framework.pl (-7 / +5 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-81 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
    } elsif ($format eq 'excel') {
63
    } elsif ($format eq 'excel') {
65
        # Excel-xml file
64
        # Excel-xml file
66
        print $input->header(-type => 'application/excel', -attachment => 'export_' . $framework_name . '.xml');
65
        print $input->header(-type => 'application/excel', -attachment => 'export_' . $frameworkcode . '.xml');
67
        print $strXml;
66
        print $strXml;
68
    } else {
67
    } else {
69
        # ODS file
68
        # ODS file
70
        my $strODS = '';
69
        my $strODS = '';
71
        createODS($strXml, 'en', \$strODS);
70
        createODS($strXml, 'en', \$strODS);
72
        print $input->header(-type => 'application/vnd.oasis.opendocument.spreadsheet', -attachment => 'export_' . $framework_name . '.ods');
71
        print $input->header(-type => 'application/vnd.oasis.opendocument.spreadsheet', -attachment => 'export_' . $frameworkcode . '.ods');
73
        print $strODS;
72
        print $strODS;
74
    }
73
    }
75
## Importing
74
## Importing
76
} elsif ($input->request_method() eq 'POST') {
75
} elsif ($input->request_method() eq 'POST') {
77
    my $ok = -1;
76
    my $ok = -1;
78
    my $fieldname = 'file_import_' . $framework_name;
77
    my $fieldname = 'file_import_' . $frameworkcode;
79
    my $filename = $input->param($fieldname);
78
    my $filename = $input->param($fieldname);
80
    # upload the input file
79
    # upload the input file
81
    if ($filename && $filename =~ /\.(csv|ods|xml)$/i) {
80
    if ($filename && $filename =~ /\.(csv|ods|xml)$/i) {
82
- 

Return to bug 13952