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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-1 lines)
Lines 774-780 No patron matched <span class="ex">[% message %]</span> Link Here
774
        [% ELSE %]
774
        [% ELSE %]
775
            <a href="#reserves" id="holds-tab">0 Holds</a>
775
            <a href="#reserves" id="holds-tab">0 Holds</a>
776
        [% END %]
776
        [% END %]
777
    </li>
778
777
779
    <li><a id="debarments-tab-link" href="#reldebarments">[% debarments.size %] Restrictions</a></li>
778
    <li><a id="debarments-tab-link" href="#reldebarments">[% debarments.size %] Restrictions</a></li>
780
</ul>
779
</ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt (-1 / +20 lines)
Lines 6-11 Link Here
6
//<![CDATA[
6
//<![CDATA[
7
$(document).ready(function() {
7
$(document).ready(function() {
8
    $('#exporttype').tabs();
8
    $('#exporttype').tabs();
9
10
    $("li.csv_profiles").hide();
11
12
    $("#bibs select[name='output_format']").on('change', function(){
13
        var format = $(this).val();
14
        if ( format == 'csv' ) {
15
            $("#bibs li.csv_profiles").show();
16
        } else {
17
            $("#bibs li.csv_profiles").hide();
18
        }
19
    });
9
});
20
});
10
//]]>
21
//]]>
11
</script>
22
</script>
Lines 130-137 $(document).ready(function() { Link Here
130
            <select id="output_format" name="output_format">
141
            <select id="output_format" name="output_format">
131
                <option value="iso2709">marc</option>
142
                <option value="iso2709">marc</option>
132
                <option value="xml">xml</option>
143
                <option value="xml">xml</option>
144
                <option value="csv">csv</option>
145
            </select>
146
        </li>
147
        <li class="csv_profiles">
148
            <label for="bibs_csv_profile">CSV profile: </label>
149
            <select id="bibs_csv_profile" name="csv_profile">
150
                [% FOR csv_profile IN csv_profiles %]
151
                    <option value="[% csv_profile.export_format_id %]">[% csv_profile.profile %]</option>
152
                [% END %]
133
            </select>
153
            </select>
134
            
135
        </li>
154
        </li>
136
        <li>
155
        <li>
137
        <label for="filename">File name:</label><input id="filename" type="text" name="filename" value="koha.mrc" />
156
        <label for="filename">File name:</label><input id="filename" type="text" name="filename" value="koha.mrc" />
(-)a/tools/export.pl (-6 / +31 lines)
Lines 48-53 my $output_format = $query->param("format") || $query->param("output_format") || Link Here
48
# Checks if the script is called from commandline
48
# Checks if the script is called from commandline
49
my $commandline = not defined $ENV{GATEWAY_INTERFACE};
49
my $commandline = not defined $ENV{GATEWAY_INTERFACE};
50
50
51
52
# @biblionumbers is only use for csv export from circulation.pl
53
my @biblionumbers = uniq $query->param("biblionumbers");
54
51
if ( $commandline ) {
55
if ( $commandline ) {
52
56
53
    # Getting parameters
57
    # Getting parameters
Lines 145-154 if ( C4::Context->preference("IndependentBranches") Link Here
145
my $backupdir = C4::Context->config('backupdir');
149
my $backupdir = C4::Context->config('backupdir');
146
150
147
if ( $op eq "export" ) {
151
if ( $op eq "export" ) {
148
    if ( $output_format eq "iso2709" or $output_format eq "xml" ) {
152
    if (
153
        $output_format eq "iso2709"
154
            or $output_format eq "xml"
155
            or (
156
                $output_format eq 'csv'
157
                    and not @biblionumbers
158
            )
159
    ) {
149
        my $charset  = 'utf-8';
160
        my $charset  = 'utf-8';
150
        my $mimetype = 'application/octet-stream';
161
        my $mimetype = 'application/octet-stream';
151
        binmode STDOUT, ':encoding(UTF-8)';
162
163
        binmode STDOUT, ':encoding(UTF-8)'
164
            if $filename =~ m/\.gz$/
165
                or $filename =~ m/\.bz2$/;
166
152
        if ( $filename =~ m/\.gz$/ ) {
167
        if ( $filename =~ m/\.gz$/ ) {
153
            $mimetype = 'application/x-gzip';
168
            $mimetype = 'application/x-gzip';
154
            $charset  = '';
169
            $charset  = '';
Lines 162-168 if ( $op eq "export" ) { Link Here
162
        print $query->header(
177
        print $query->header(
163
            -type       => $mimetype,
178
            -type       => $mimetype,
164
            -charset    => $charset,
179
            -charset    => $charset,
165
            -attachment => $filename
180
            -attachment => $filename,
166
        ) unless ($commandline);
181
        ) unless ($commandline);
167
182
168
        $record_type = $query->param("record_type") unless ($commandline);
183
        $record_type = $query->param("record_type") unless ($commandline);
Lines 416-422 if ( $op eq "export" ) { Link Here
416
                    print MARC::File::XML::record($record);
431
                    print MARC::File::XML::record($record);
417
                    print "\n";
432
                    print "\n";
418
                }
433
                }
419
                else {
434
                elsif ( $output_format eq 'iso2709' ) {
420
                    my $errorcount_on_decode = eval { scalar(MARC::File::USMARC->decode( $record->as_usmarc )->warnings()) };
435
                    my $errorcount_on_decode = eval { scalar(MARC::File::USMARC->decode( $record->as_usmarc )->warnings()) };
421
                    if ($errorcount_on_decode or $@){
436
                    if ($errorcount_on_decode or $@){
422
                        warn $@ if $@;
437
                        warn $@ if $@;
Lines 431-445 if ( $op eq "export" ) { Link Here
431
            print MARC::File::XML::footer();
446
            print MARC::File::XML::footer();
432
            print "\n";
447
            print "\n";
433
        }
448
        }
449
        if ( $output_format eq 'csv' ) {
450
            my $csv_profile_id = $query->param('csv_profile')
451
                || GetCsvProfileId( C4::Context->preference('ExportWithCsvProfile') );
452
            my $output =
453
              marc2csv( \@recordids,
454
                $csv_profile_id );
455
456
            print $output;
457
        }
434
458
435
        exit;
459
        exit;
436
    }
460
    }
437
    elsif ( $output_format eq "csv" ) {
461
    elsif ( $output_format eq "csv" ) {
438
        my @biblionumbers = uniq $query->param("biblionumbers");
462
        my @biblionumbers = uniq $query->param("biblionumbers");
439
        my @itemnumbers   = $query->param("itemnumbers");
463
        my @itemnumbers   = $query->param("itemnumbers");
464
        my $csv_profile_id = $query->param('csv_profile') || GetCsvProfileId( C4::Context->preference('ExportWithCsvProfile') );
440
        my $output =
465
        my $output =
441
          marc2csv( \@biblionumbers,
466
          marc2csv( \@biblionumbers,
442
            GetCsvProfileId( C4::Context->preference('ExportWithCsvProfile') ),
467
            $csv_profile_id,
443
            \@itemnumbers, );
468
            \@itemnumbers, );
444
        print $query->header(
469
        print $query->header(
445
            -type                        => 'application/octet-stream',
470
            -type                        => 'application/octet-stream',
Lines 513-518 else { Link Here
513
        itemtypeloop             => \@itemtypesloop,
538
        itemtypeloop             => \@itemtypesloop,
514
        authtypeloop             => \@authtypesloop,
539
        authtypeloop             => \@authtypesloop,
515
        export_remove_fields     => C4::Context->preference("ExportRemoveFields"),
540
        export_remove_fields     => C4::Context->preference("ExportRemoveFields"),
541
        csv_profiles             => C4::Csv::GetCsvProfiles('marc'),
516
    );
542
    );
517
543
518
    output_html_with_http_headers $query, $cookie, $template->output;
544
    output_html_with_http_headers $query, $cookie, $template->output;
519
- 

Return to bug 12404