[open-ils-commits] r10054 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jul 15 22:03:56 EDT 2008
Author: erickson
Date: 2008-07-15 22:03:55 -0400 (Tue, 15 Jul 2008)
New Revision: 10054
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
Log:
added lineitem_detail delete when lineitem is deleted. need to add some additional state checks. also, only checking picklist perms when picklist is set
Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2008-07-15 14:50:34 UTC (rev 10053)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2008-07-16 02:03:55 UTC (rev 10054)
@@ -305,13 +305,27 @@
my $li = $e->retrieve_acq_lineitem($li_id)
or return $e->die_event;
- my $picklist = $e->retrieve_acq_picklist($li->picklist)
- or return $e->die_event;
+ # XXX check state
- # don't let anyone delete someone else's lineitem
- return OpenILS::Event->new('BAD_PARAMS')
- if $picklist->owner != $e->requestor->id;
+ if($li->picklist) {
+ my $picklist = $e->retrieve_acq_picklist($li->picklist)
+ or return $e->die_event;
+ return OpenILS::Event->new('BAD_PARAMS')
+ if $picklist->owner != $e->requestor->id;
+ } else {
+ # check PO perms
+ }
+ # delete the attached lineitem_details
+ my $lid_ids = $e->search_acq_lineitem_detail(
+ {lineitem => $li_id}, {idlist=>1});
+
+ for my $lid_id (@$lid_ids) {
+ $e->delete_acq_lineitem_detail(
+ $e->retrieve_acq_lineitem_detail($lid_id))
+ or return $e->die_event;
+ }
+
$e->delete_acq_lineitem($li) or return $e->die_event;
$e->commit;
return 1;
More information about the open-ils-commits
mailing list