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

(-)a/admin/import_export_framework.pl (-11 / +8 lines)
Lines 46-86 unless ($authenticated) { Link Here
46
    exit 0;
46
    exit 0;
47
}
47
}
48
48
49
my $frameworkcode = $input->param('frameworkcode') || 'default';
49
my $frameworkcode = $input->param('frameworkcode') || '';
50
my $framework_name = $frameworkcode || 'default';
50
my $action = $input->param('action') || 'export';
51
my $action = $input->param('action') || 'export';
51
52
52
## Exporting
53
## Exporting
53
if ($action eq 'export' && $input->request_method() eq 'GET') {
54
if ($action eq 'export' && $input->request_method() eq 'GET') {
54
    my $strXml = '';
55
    my $strXml = '';
55
    my $format = $input->param('type_export_' . $frameworkcode);
56
    my $format = $input->param('type_export_' . $framework_name);
56
    if ($frameworkcode eq 'default') {
57
    ExportFramework($frameworkcode, \$strXml, $format);
57
        ExportFramework('', \$strXml, $format);
58
    } else {
59
        ExportFramework($frameworkcode, \$strXml, $format);
60
    }
61
58
62
    if ($format eq 'csv') {
59
    if ($format eq 'csv') {
63
        # CSV file
60
        # CSV file
64
61
65
        # Correctly set the encoding to output plain text in UTF-8
62
        # Correctly set the encoding to output plain text in UTF-8
66
        binmode(STDOUT,':encoding(UTF-8)');
63
        binmode(STDOUT,':encoding(UTF-8)');
67
        print $input->header(-type => 'application/vnd.ms-excel', -attachment => 'export_' . $frameworkcode . '.csv');
64
        print $input->header(-type => 'application/vnd.ms-excel', -attachment => 'export_' . $framework_name . '.csv');
68
        print $strXml;
65
        print $strXml;
69
    } elsif ($format eq 'excel') {
66
    } elsif ($format eq 'excel') {
70
        # Excel-xml file
67
        # Excel-xml file
71
        print $input->header(-type => 'application/excel', -attachment => 'export_' . $frameworkcode . '.xml');
68
        print $input->header(-type => 'application/excel', -attachment => 'export_' . $framework_name . '.xml');
72
        print $strXml;
69
        print $strXml;
73
    } else {
70
    } else {
74
        # ODS file
71
        # ODS file
75
        my $strODS = '';
72
        my $strODS = '';
76
        createODS($strXml, 'en', \$strODS);
73
        createODS($strXml, 'en', \$strODS);
77
        print $input->header(-type => 'application/vnd.oasis.opendocument.spreadsheet', -attachment => 'export_' . $frameworkcode . '.ods');
74
        print $input->header(-type => 'application/vnd.oasis.opendocument.spreadsheet', -attachment => 'export_' . $framework_name . '.ods');
78
        print $strODS;
75
        print $strODS;
79
    }
76
    }
80
## Importing
77
## Importing
81
} elsif ($input->request_method() eq 'POST') {
78
} elsif ($input->request_method() eq 'POST') {
82
    my $ok = -1;
79
    my $ok = -1;
83
    my $fieldname = 'file_import_' . $frameworkcode;
80
    my $fieldname = 'file_import_' . $framework_name;
84
    my $filename = $input->param($fieldname);
81
    my $filename = $input->param($fieldname);
85
    # upload the input file
82
    # upload the input file
86
    if ($filename && $filename =~ /\.(csv|ods|xml)$/i) {
83
    if ($filename && $filename =~ /\.(csv|ods|xml)$/i) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt (-2 / +1 lines)
Lines 189-195 Link Here
189
              </div>
189
              </div>
190
              <form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_default" id="form_i_default" method="post" enctype="multipart/form-data" class="form_import">
190
              <form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_default" id="form_i_default" method="post" enctype="multipart/form-data" class="form_import">
191
                <div class="modal-body">
191
                <div class="modal-body">
192
                  <input type="hidden" name="frameworkcode" value="default" />
192
                  <input type="hidden" name="frameworkcode" value="" />
193
                  <input type="hidden" name="action" value="import" />
193
                  <input type="hidden" name="action" value="import" />
194
                  <p><label for="file_import_default">Upload file:</label> <input type="file" name="file_import_default" id="file_import_default" class="input_import" /></p>
194
                  <p><label for="file_import_default">Upload file:</label> <input type="file" name="file_import_default" id="file_import_default" class="input_import" /></p>
195
                    <div id="importing_default" style="display:none" class="importing"><img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /><span class="importing_msg"></span></div>
195
                    <div id="importing_default" style="display:none" class="importing"><img src="[% interface %]/[% theme %]/img/spinner-small.gif" alt="" /><span class="importing_msg"></span></div>
196
- 

Return to bug 18111