Lines 199-205
sub remove_duplicates {
Link Here
|
199 |
my %seen=(); |
199 |
my %seen=(); |
200 |
my $query = "DELETE FROM creator_batches WHERE label_id = ?;"; # ORDER BY timestamp ASC LIMIT ?;"; |
200 |
my $query = "DELETE FROM creator_batches WHERE label_id = ?;"; # ORDER BY timestamp ASC LIMIT ?;"; |
201 |
my $sth = C4::Context->dbh->prepare($query); |
201 |
my $sth = C4::Context->dbh->prepare($query); |
202 |
my @duplicate_items = grep{$seen{$_->{'item_number'}}++} @{$self->{'items'}}; |
202 |
my @duplicate_items = grep{ |
|
|
203 |
$_->{'item_number'} |
204 |
? $seen{$_->{'item_number'}}++ |
205 |
: $seen{$_->{'borrower_number'}}++ |
206 |
} @{$self->{'items'}}; |
203 |
foreach my $item (@duplicate_items) { |
207 |
foreach my $item (@duplicate_items) { |
204 |
$sth->execute($item->{'label_id'}); |
208 |
$sth->execute($item->{'label_id'}); |
205 |
if ($sth->err) { |
209 |
if ($sth->err) { |
206 |
- |
|
|