pod2usage(q|CSV output is only available for biblio records|);
}
+if ( $output_format eq 'csv' and not $csv_profile_id ) {
+ pod2usage(q|Define a csv profile to export in CSV|);
+}
if ( $timestamp and $record_type ne 'bibs' ) {
pod2usage(q|--timestamp can only be used with biblios|);
if ( $timestamp ) {
push @record_ids, $_->{biblionumber} for @{
$dbh->selectall_arrayref(q| (
- SELECT biblionumber
- FROM biblioitems
+ SELECT biblio_metadata.biblionumber
+ FROM biblio_metadata
LEFT JOIN items USING(biblionumber)
- WHERE biblioitems.timestamp >= ?
+ WHERE biblio_metadata.timestamp >= ?
OR items.timestamp >= ?
) UNION (
- SELECT biblionumber
- FROM biblioitems
+ SELECT biblio_metadata.biblionumber
+ FROM biblio_metadata
LEFT JOIN deleteditems USING(biblionumber)
- WHERE biblioitems.timestamp >= ?
+ WHERE biblio_metadata.timestamp >= ?
OR deleteditems.timestamp >= ?
) |, { Slice => {} }, ( $timestamp ) x 4 );
};
?
C4::Context->preference('item-level_itypes')
? ( 'items.itype' => $itemtype )
- : ( 'biblioitems.itemtype' => $itemtype )
+ : ( 'me.itemtype' => $itemtype )
: ()
),
if ($deleted_barcodes) {
for my $record_id ( @record_ids ) {
- my $q = q|
- |;
- my $barcode = $dbh->selectall_arrayref(q| (
+ my $barcode = $dbh->selectall_arrayref(q|
SELECT DISTINCT barcode
FROM deleteditems
WHERE deleteditems.biblionumber = ?
|, { Slice => {} }, $record_id );
- say $_->{barcode} for @$barcode
+ say $_->{barcode} for @$barcode;
}
}
else {
- unless ( $csv_profile_id ) {
- # FIXME export_format.profile should be a unique key
- my $default_csv_profiles = Koha::CsvProfiles->search({ profile => C4::Context->preference('ExportWithCsvProfile') });
- $csv_profile_id = $default_csv_profiles->count ? $default_csv_profiles->next->export_format_id : undef;
- }
Koha::Exporter::Record::export(
{ record_type => $record_type,
record_ids => \@record_ids,
=item B<--csv_profile_id>
--csv_profile_id=ID Generate a CSV file with the given CSV profile id (see tools/csv-profiles.pl)
- Unless provided, the one defined in the system preference 'ExportWithCsvProfile' will be used.
This can only be used to export biblio records.
=item B<--deleted_barcodes>