From 5bd210333705f8e339ddf4337b55fba8587b349a Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Thu, 6 Oct 2011 18:06:22 -0400 Subject: [PATCH] Avoid a possible bug in selection list deletion This particularly matters for the "ephemeral," unnamed selection list that Acquisitions General Search uses to hold bib records represented as lineitems, as that list is deleted for the next run of that kind of search. It's possible to get lineitems onto that list that are in a state other than "new". Code that deletes this list first deletes the lineitems that belong to it, but that code formerly assumed that there are two types of lineitems. "new" ones (that should be deleted) and ones that belong to purchase orders (that should be deatched). That doesn't necessarily cover all possible lineitems on the picklist, so deletion ultimately fails. This fixes that. [update: now this bugfix incorporates a bugfix, the need for which was detected by Ben Shum. See LP #869581] Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Bill Erickson --- Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm index dafa288e6e..699a6bbb9e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm @@ -851,7 +851,13 @@ sub delete_picklist { $picklist = $mgr->editor->retrieve_acq_picklist($picklist) unless ref $picklist; # delete all 'new' lineitems - my $li_ids = $mgr->editor->search_acq_lineitem({picklist => $picklist->id, state => 'new'}, {idlist => 1}); + my $li_ids = $mgr->editor->search_acq_lineitem( + { + picklist => $picklist->id, + "-or" => {state => "new", purchase_order => undef} + }, + {idlist => 1} + ); for my $li_id (@$li_ids) { my $li = $mgr->editor->retrieve_acq_lineitem($li_id); return 0 unless delete_lineitem($mgr, $li); -- 2.11.0