From e3153b6e853d5f2f6879dcb4813662f1db2f87dc Mon Sep 17 00:00:00 2001 From: Giuseppe Passanisi Date: Mon, 26 Mar 2018 23:53:24 +0000 Subject: [PATCH] Bug 20465: misc/export_records.pl add possibility to export by branchcode There was no way to export all books held by a library, in a multi-libraries/single-instance context. This patch supports that. Tested with: libri-koha@ec101041:~$ /usr/share/koha/bin/export_records.pl --holdingbranch=MI-ISL --format=xml --filename=test0003.xml Signed-off-by: Mark Tompsett --- misc/export_records.pl | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/misc/export_records.pl b/misc/export_records.pl index 6e36368..86101a5 100755 --- a/misc/export_records.pl +++ b/misc/export_records.pl @@ -32,7 +32,7 @@ use Koha::CsvProfiles; use Koha::Exporter::Record; use Koha::DateUtils qw( dt_from_string output_pref ); -my ( $output_format, $timestamp, $dont_export_items, $csv_profile_id, $deleted_barcodes, $clean, $filename, $record_type, $id_list_file, $starting_authid, $ending_authid, $authtype, $starting_biblionumber, $ending_biblionumber, $itemtype, $starting_callnumber, $ending_callnumber, $start_accession, $end_accession, $help ); +my ( $output_format, $timestamp, $dont_export_items, $csv_profile_id, $deleted_barcodes, $clean, $filename, $record_type, $id_list_file, $starting_authid, $ending_authid, $authtype, $starting_biblionumber, $ending_biblionumber, $itemtype, $starting_callnumber, $ending_callnumber, $start_accession, $end_accession, $homebranch, $holdingbranch, $help ); GetOptions( 'format=s' => \$output_format, 'date=s' => \$timestamp, @@ -53,6 +53,8 @@ GetOptions( 'ending_callnumber=s' => \$ending_callnumber, 'start_accession=s' => \$start_accession, 'end_accession=s' => \$end_accession, + 'homebranch=s' => \$homebranch, + 'holdingbranch=s' => \$holdingbranch, 'h|help|?' => \$help ) || pod2usage(1); @@ -150,6 +152,14 @@ if ( $record_type eq 'bibs' ) { : ( 'me.itemtype' => $itemtype ) : () ), + ( $homebranch + ? ( "items.homebranch" => $homebranch ) + : () + ), + ( $holdingbranch + ? ( "items.holdingbranch" => $holdingbranch ) + : () + ), }; my $biblioitems = Koha::Biblioitems->search( $conditions, { join => 'items' } ); @@ -310,6 +320,14 @@ Print a brief help message. --end_accession=DATE Export biblio with an item accessionned after DATE +=item B<--homebranch> + + --homebranch=BRANCHCODE Export biblio owned by a specific library given by BRANCHCODE + +=item B<--holdingbranch> + + --holdingbranch=BRANCHCODE Export biblio hold by a specific library given by BRANCHCODE + =back =head1 AUTHOR -- 2.1.4