Bugzilla – Attachment 17130 Details for
Bug 9535
Patron card creator "Remove duplicates" function doesn't work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed Fix
0001-Bug-9535-Patron-card-creator-Remove-duplicates-funct.patch (text/plain), 1.52 KB, created by
Chris Nighswonger
on 2013-04-02 14:10:04 UTC
(
hide
)
Description:
Proposed Fix
Filename:
MIME Type:
Creator:
Chris Nighswonger
Created:
2013-04-02 14:10:04 UTC
Size:
1.52 KB
patch
obsolete
>From 9c583e133b8dceeef5e97d2b4fb41e6f9ffe446d Mon Sep 17 00:00:00 2001 >From: Chris Nighswonger <cnighswonger@foundations.edu> >Date: Tue, 2 Apr 2013 10:05:46 -0400 >Subject: [PATCH] Bug 9535 - Patron card creator "Remove duplicates" function > doesn't work > >This bug was due to a difference in field names used in the item data >for items versus patrons. This patch adds a ternary to discern between >the two. > >To test: > >Before applying patch: > >1. Create a batch of patroncards with one duplicate. >2. Run the de-duplication on the batch. >3. Note that all patrons beyond the first in the batch are now > deleted. > >After applying patch: >4. Repeat steps 1-2. >5. Note that only the duplicate patron is removed. > >Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu> >--- > C4/Creators/Batch.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/C4/Creators/Batch.pm b/C4/Creators/Batch.pm >index 9306263..3402e66 100644 >--- a/C4/Creators/Batch.pm >+++ b/C4/Creators/Batch.pm >@@ -199,7 +199,7 @@ sub remove_duplicates { > my %seen=(); > my $query = "DELETE FROM creator_batches WHERE label_id = ?;"; # ORDER BY timestamp ASC LIMIT ?;"; > my $sth = C4::Context->dbh->prepare($query); >- my @duplicate_items = grep{$seen{$_->{'item_number'}}++} @{$self->{'items'}}; >+ my @duplicate_items = grep{$_->{'item_number'} ? $seen{$_->{'item_number'}}++ : $seen{$_->{'borrower_number'}}++} @{$self->{'items'}}; > foreach my $item (@duplicate_items) { > $sth->execute($item->{'label_id'}); > if ($sth->err) { >-- >1.7.10.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9535
:
17130
|
17132
|
17161