Lines 32-44
use Koha::CsvProfiles;
Link Here
|
32 |
use Koha::Exporter::Record; |
32 |
use Koha::Exporter::Record; |
33 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
33 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
34 |
|
34 |
|
35 |
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 ); |
35 |
my ( $output_format, $timestamp, $dont_export_items, $csv_profile_id, $deleted_barcodes, $deleted_bibs, $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 ); |
36 |
GetOptions( |
36 |
GetOptions( |
37 |
'format=s' => \$output_format, |
37 |
'format=s' => \$output_format, |
38 |
'date=s' => \$timestamp, |
38 |
'date=s' => \$timestamp, |
39 |
'dont_export_items' => \$dont_export_items, |
39 |
'dont_export_items' => \$dont_export_items, |
40 |
'csv_profile_id=s' => \$csv_profile_id, |
40 |
'csv_profile_id=s' => \$csv_profile_id, |
41 |
'deleted_barcodes' => \$deleted_barcodes, |
41 |
'deleted_barcodes' => \$deleted_barcodes, |
|
|
42 |
'deleted_bibs' => \$deleted_bibs, |
42 |
'clean' => \$clean, |
43 |
'clean' => \$clean, |
43 |
'filename=s' => \$filename, |
44 |
'filename=s' => \$filename, |
44 |
'record-type=s' => \$record_type, |
45 |
'record-type=s' => \$record_type, |
Lines 84-89
if ( $deleted_barcodes and $record_type ne 'bibs' ) {
Link Here
|
84 |
pod2usage(q|--deleted_barcodes can only be used with biblios|); |
85 |
pod2usage(q|--deleted_barcodes can only be used with biblios|); |
85 |
} |
86 |
} |
86 |
|
87 |
|
|
|
88 |
if ( $deleted_bibs and $record_type ne 'bibs' ) { |
89 |
pod2usage(q|--deleted_bibs can only be used with biblios|); |
90 |
} |
91 |
|
87 |
$start_accession = dt_from_string( $start_accession ) if $start_accession; |
92 |
$start_accession = dt_from_string( $start_accession ) if $start_accession; |
88 |
$end_accession = dt_from_string( $end_accession ) if $end_accession; |
93 |
$end_accession = dt_from_string( $end_accession ) if $end_accession; |
89 |
|
94 |
|
Lines 98-103
my @record_ids;
Link Here
|
98 |
$timestamp = ($timestamp) ? output_pref({ dt => dt_from_string($timestamp), dateformat => 'iso', dateonly => 0, }): ''; |
103 |
$timestamp = ($timestamp) ? output_pref({ dt => dt_from_string($timestamp), dateformat => 'iso', dateonly => 0, }): ''; |
99 |
|
104 |
|
100 |
if ( $record_type eq 'bibs' ) { |
105 |
if ( $record_type eq 'bibs' ) { |
|
|
106 |
if ($deleted_bibs) { |
107 |
my $q = " |
108 |
SELECT DISTINCT biblionumber |
109 |
FROM deletedbiblio"; |
110 |
if ( $timestamp ) { |
111 |
$q .= " WHERE deletedbiblio.timestamp >= '$timestamp' "; |
112 |
} |
113 |
#print "Debug: $q\n"; |
114 |
my $sth = $dbh->prepare($q); |
115 |
$sth->execute(); |
116 |
while ( my $row = $sth->fetchrow_array ) { |
117 |
say $row; |
118 |
#print "$row\n"; |
119 |
} |
120 |
exit; |
121 |
} |
122 |
|
101 |
if ( $timestamp ) { |
123 |
if ( $timestamp ) { |
102 |
push @record_ids, $_->{biblionumber} for @{ |
124 |
push @record_ids, $_->{biblionumber} for @{ |
103 |
$dbh->selectall_arrayref(q| ( |
125 |
$dbh->selectall_arrayref(q| ( |
Lines 217-223
export records - This script exports record (biblios or authorities)
Link Here
|
217 |
|
239 |
|
218 |
=head1 SYNOPSIS |
240 |
=head1 SYNOPSIS |
219 |
|
241 |
|
220 |
export_records.pl [-h|--help] [--format=format] [--date=datetime] [--record-type=TYPE] [--dont_export_items] [--deleted_barcodes] [--clean] [--id_list_file=PATH] --filename=outputfile |
242 |
export_records.pl [-h|--help] [--format=format] [--date=datetime] [--record-type=TYPE] [--dont_export_items] [--deleted_barcodes] [--deleted_bibs] [--clean] [--id_list_file=PATH] --filename=outputfile |
221 |
|
243 |
|
222 |
=head1 OPTIONS |
244 |
=head1 OPTIONS |
223 |
|
245 |
|
Lines 236-242
Print a brief help message.
Link Here
|
236 |
--date=DATETIME DATETIME should be entered as the 'dateformat' syspref is |
258 |
--date=DATETIME DATETIME should be entered as the 'dateformat' syspref is |
237 |
set (dd/mm/yyyy[ hh:mm:ss] for metric, yyyy-mm-dd[ hh:mm:ss] for iso, |
259 |
set (dd/mm/yyyy[ hh:mm:ss] for metric, yyyy-mm-dd[ hh:mm:ss] for iso, |
238 |
mm/dd/yyyy[ hh:mm:ss] for us) records exported are the ones that |
260 |
mm/dd/yyyy[ hh:mm:ss] for us) records exported are the ones that |
239 |
have been modified since DATETIME. |
261 |
have been modified or deleted since DATETIME. |
240 |
|
262 |
|
241 |
=item B<--record-type> |
263 |
=item B<--record-type> |
242 |
|
264 |
|
Lines 258-263
Print a brief help message.
Link Here
|
258 |
is produced (or from all deleted items if no date is |
280 |
is produced (or from all deleted items if no date is |
259 |
specified). Used only if TYPE is 'bibs'. |
281 |
specified). Used only if TYPE is 'bibs'. |
260 |
|
282 |
|
|
|
283 |
=item B<--deleted_bibs> |
284 |
|
285 |
--deleted_bibs If used, a list of deleted biblionumbers since DATE |
286 |
is produced (or from all deleted bibs if no date is |
287 |
specified). Used only if TYPE is 'bibs'. |
288 |
|
261 |
=item B<--clean> |
289 |
=item B<--clean> |
262 |
|
290 |
|
263 |
--clean removes NSE/NSB. |
291 |
--clean removes NSE/NSB. |
264 |
- |
|
|