[open-ils-commits] r9812 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jun 10 22:27:23 EDT 2008
Author: erickson
Date: 2008-06-10 22:27:22 -0400 (Tue, 10 Jun 2008)
New Revision: 9812
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
Log:
disallowing create/update/delete on lineitem_details if the lineitem is in the approved state
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-06-11 01:59:21 UTC (rev 9811)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2008-06-11 02:27:22 UTC (rev 9812)
@@ -353,6 +353,9 @@
my $li = $e->retrieve_acq_lineitem($li_detail->lineitem)
or return $e->die_event;
+ my $evt = update_li_edit_time($e, $li);
+ return $evt if $evt;
+
# XXX check lineitem provider perms
if($li_detail->fund) {
@@ -392,12 +395,26 @@
# XXX check lineitem perms
+ my $li = $e->retrieve_acq_lineitem($li_detail->lineitem)
+ or return $e->die_event;
+ my $evt = update_li_edit_time($e, $li);
+ return $evt if $evt;
+
$e->update_acq_lineitem_detail($li_detail) or return $e->die_event;
$e->commit;
return 1;
}
+sub update_li_edit_time {
+ my ($e, $li) = @_;
+ return OpenILS::Event->new('ACQ_LINEITEM_APPROVED', payload => $li->id)
+ if $li->state eq 'approved';
+ $li->edit_time('now');
+ $e->update_acq_lineitem($li) or return $e->die_event;
+ return undef;
+}
+
__PACKAGE__->register_method(
method => 'delete_lineitem_detail',
api_name => 'open-ils.acq.lineitem_detail.delete',
@@ -423,8 +440,10 @@
]) or return $e->die_event;
my $li = $li_detail->lineitem;
- $e->update_acq_lineitem($li) or return $e->die_event;
+ my $evt = update_li_edit_time($e, $li);
+ return $evt if $evt;
+
return OpenILS::Event->new('BAD_PARAMS') unless
$li->state =~ /new|approved/;
More information about the open-ils-commits
mailing list