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

(-)a/opac/opac-downloadshelf.pl (-2 / +1 lines)
Lines 52-58 if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $sh Link Here
52
52
53
    if ($shelfid && $format) {
53
    if ($shelfid && $format) {
54
54
55
        my @shelf               = GetShelf($shelfid);
56
        my ($items, $totitems)  = GetShelfContents($shelfid);
55
        my ($items, $totitems)  = GetShelfContents($shelfid);
57
        my $marcflavour         = C4::Context->preference('marcflavour');
56
        my $marcflavour         = C4::Context->preference('marcflavour');
58
        my $output;
57
        my $output;
Lines 103-106 if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $sh Link Here
103
} else {
102
} else {
104
    $template->param(invalidlist => 1); 
103
    $template->param(invalidlist => 1); 
105
    output_html_with_http_headers $query, $cookie, $template->output;
104
    output_html_with_http_headers $query, $cookie, $template->output;
106
}
105
}
(-)a/virtualshelves/downloadshelf.pl (-22 / +17 lines)
Lines 50-59 my $dbh = C4::Context->dbh; Link Here
50
50
51
if ($shelfid && $format) {
51
if ($shelfid && $format) {
52
52
53
    my @shelf               = GetShelf($shelfid);
54
    my ($items, $totitems)  = GetShelfContents($shelfid);
53
    my ($items, $totitems)  = GetShelfContents($shelfid);
55
    my $marcflavour         = C4::Context->preference('marcflavour');
54
    my $marcflavour         = C4::Context->preference('marcflavour');
56
    my $output;
55
    my $output='';
57
56
58
    # CSV 
57
    # CSV 
59
    if ($format =~ /^\d+$/) {
58
    if ($format =~ /^\d+$/) {
Lines 62-86 if ($shelfid && $format) { Link Here
62
	    push @biblios, $_->{biblionumber};
61
	    push @biblios, $_->{biblionumber};
63
	}
62
	}
64
	$output = marc2csv(\@biblios, $format);
63
	$output = marc2csv(\@biblios, $format);
65
64
    }
66
    # Other formats
65
    else { #Other formats
67
} else {
66
        foreach my $biblio (@$items) {
68
    foreach my $biblio (@$items) {
67
            my $biblionumber = $biblio->{biblionumber};
69
        my $biblionumber = $biblio->{biblionumber};
68
            my $record = GetMarcBiblio($biblionumber, 1);
70
69
            if ($format eq 'iso2709') {
71
        my $record = GetMarcBiblio($biblionumber, 1);
70
                $output .= $record->as_usmarc();
72
71
            }
73
        if ($format eq 'iso2709') {
72
            elsif ($format eq 'ris') {
74
            $output .= $record->as_usmarc();
73
                $output .= marc2ris($record);
75
        }
74
            }
76
        elsif ($format eq 'ris') {
75
            elsif ($format eq 'bibtex') {
77
            $output .= marc2ris($record);
76
                $output .= marc2bibtex($record, $biblionumber);
78
        }
77
            }
79
        elsif ($format eq 'bibtex') {
80
            $output .= marc2bibtex($record, $biblionumber);
81
        }
78
        }
82
    }
79
    }
83
}
84
80
85
    # If it was a CSV export we change the format after the export so the file extension is fine
81
    # If it was a CSV export we change the format after the export so the file extension is fine
86
    $format = "csv" if ($format =~ m/^\d+$/);
82
    $format = "csv" if ($format =~ m/^\d+$/);
Lines 90-97 if ($shelfid && $format) { Link Here
90
	-'Content-Transfer-Encoding' => 'binary',
86
	-'Content-Transfer-Encoding' => 'binary',
91
	-attachment=>"shelf.$format");
87
	-attachment=>"shelf.$format");
92
    print $output;
88
    print $output;
93
89
}
94
} else {
90
else {
95
    $template->param(csv_profiles => GetCsvProfilesLoop());
91
    $template->param(csv_profiles => GetCsvProfilesLoop());
96
    $template->param(shelfid => $shelfid); 
92
    $template->param(shelfid => $shelfid); 
97
    output_html_with_http_headers $query, $cookie, $template->output;
93
    output_html_with_http_headers $query, $cookie, $template->output;
98
- 

Return to bug 7788