Lines 21-26
use MARC::File::XML;
Link Here
|
21 |
use List::MoreUtils qw(uniq); |
21 |
use List::MoreUtils qw(uniq); |
22 |
use Getopt::Long; |
22 |
use Getopt::Long; |
23 |
use Pod::Usage; |
23 |
use Pod::Usage; |
|
|
24 |
use Carp; |
24 |
|
25 |
|
25 |
use Koha::Script; |
26 |
use Koha::Script; |
26 |
use C4::Auth; |
27 |
use C4::Auth; |
Lines 56-61
my (
Link Here
|
56 |
$start_accession, |
57 |
$start_accession, |
57 |
$end_accession, |
58 |
$end_accession, |
58 |
$marc_conditions, |
59 |
$marc_conditions, |
|
|
60 |
$deleted_marc_conditions, |
59 |
$help |
61 |
$help |
60 |
); |
62 |
); |
61 |
|
63 |
|
Lines 82-87
GetOptions(
Link Here
|
82 |
'start_accession=s' => \$start_accession, |
84 |
'start_accession=s' => \$start_accession, |
83 |
'end_accession=s' => \$end_accession, |
85 |
'end_accession=s' => \$end_accession, |
84 |
'marc_conditions=s' => \$marc_conditions, |
86 |
'marc_conditions=s' => \$marc_conditions, |
|
|
87 |
'deleted_marc_conditions=s' => \$deleted_marc_conditions, |
85 |
'h|help|?' => \$help |
88 |
'h|help|?' => \$help |
86 |
) || pod2usage(1); |
89 |
) || pod2usage(1); |
87 |
|
90 |
|
Lines 131-139
if ( $deleted_barcodes and $record_type ne 'bibs' ) {
Link Here
|
131 |
$start_accession = dt_from_string( $start_accession ) if $start_accession; |
134 |
$start_accession = dt_from_string( $start_accession ) if $start_accession; |
132 |
$end_accession = dt_from_string( $end_accession ) if $end_accession; |
135 |
$end_accession = dt_from_string( $end_accession ) if $end_accession; |
133 |
|
136 |
|
134 |
# Parse marc conditions |
137 |
|
135 |
my @marc_conditions; |
138 |
sub _parse_marc_conditions { |
136 |
if ($marc_conditions) { |
139 |
my ($marc_conditions) = @_; |
|
|
140 |
my @marc_conditions; |
137 |
foreach my $condition (split(/,\s*/, $marc_conditions)) { |
141 |
foreach my $condition (split(/,\s*/, $marc_conditions)) { |
138 |
if ($condition =~ /^(\d{3})([\w\d]?)(=|(?:!=)|>|<)([^,]+)$/) { |
142 |
if ($condition =~ /^(\d{3})([\w\d]?)(=|(?:!=)|>|<)([^,]+)$/) { |
139 |
push @marc_conditions, [$1, $2, $3, $4]; |
143 |
push @marc_conditions, [$1, $2, $3, $4]; |
Lines 142-150
if ($marc_conditions) {
Link Here
|
142 |
push @marc_conditions, [$2, $3, $1 eq 'exists' ? '?' : '!?']; |
146 |
push @marc_conditions, [$2, $3, $1 eq 'exists' ? '?' : '!?']; |
143 |
} |
147 |
} |
144 |
else { |
148 |
else { |
145 |
die("Invalid condititon: $condition"); |
149 |
croak "Invalid condititon: $condition"; |
146 |
} |
150 |
} |
147 |
} |
151 |
} |
|
|
152 |
return @marc_conditions; |
153 |
} |
154 |
|
155 |
# Parse marc conditions |
156 |
my @marc_conditions; |
157 |
if ($marc_conditions) { |
158 |
@marc_conditions = _parse_marc_conditions($marc_conditions); |
159 |
} |
160 |
|
161 |
my @deleted_marc_conditions; |
162 |
if ($deleted_marc_conditions) { |
163 |
@deleted_marc_conditions = _parse_marc_conditions($deleted_marc_conditions); |
148 |
} |
164 |
} |
149 |
|
165 |
|
150 |
my $dbh = C4::Context->dbh; |
166 |
my $dbh = C4::Context->dbh; |
Lines 280-285
else {
Link Here
|
280 |
{ record_type => $record_type, |
296 |
{ record_type => $record_type, |
281 |
record_ids => \@record_ids, |
297 |
record_ids => \@record_ids, |
282 |
record_conditions => @marc_conditions ? \@marc_conditions : undef, |
298 |
record_conditions => @marc_conditions ? \@marc_conditions : undef, |
|
|
299 |
deleted_record_conditions => @deleted_marc_conditions ? \@deleted_marc_conditions : undef, |
283 |
deleted_record_ids => \@deleted_record_ids, |
300 |
deleted_record_ids => \@deleted_record_ids, |
284 |
format => $output_format, |
301 |
format => $output_format, |
285 |
csv_profile_id => $csv_profile_id, |
302 |
csv_profile_id => $csv_profile_id, |
Lines 423-428
Print a brief help message.
Link Here
|
423 |
<marc_target> exists regardless of target value, and |
440 |
<marc_target> exists regardless of target value, and |
424 |
"exists(<marc_target>)" will include marc records where |
441 |
"exists(<marc_target>)" will include marc records where |
425 |
no <marc_target> exists. |
442 |
no <marc_target> exists. |
|
|
443 |
=item B<--deleted_marc_conditions> |
444 |
|
445 |
--deleted_marc_conditions=CONDITIONS Set record deleted flag for biblios with MARC |
446 |
data matching CONDITIONS.Only include biblios with MARC data matching CONDITIONS. |
447 |
See --marc_conditions for more information about the CONDITIONS format. |
426 |
|
448 |
|
427 |
=back |
449 |
=back |
428 |
|
450 |
|