[open-ils-commits] r15572 - in trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger: . Validator (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Feb 18 09:21:06 EST 2010
Author: erickson
Date: 2010-02-18 09:21:04 -0500 (Thu, 18 Feb 2010)
New Revision: 15572
Added:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator/
trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator/Acq.pm
Log:
Added ACQ validator module, starting with user request status validation. seed data to follow
Added: trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator/Acq.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator/Acq.pm (rev 0)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator/Acq.pm 2010-02-18 14:21:04 UTC (rev 15572)
@@ -0,0 +1,30 @@
+package OpenILS::Application::Trigger::Validator::Acq;
+use strict; use warnings;
+use OpenSRF::Utils::Logger qw/:logger/;
+
+sub UserRequestOrdered {
+ my $self = shift;
+ my $env = shift;
+ return get_lineitem_from_req($self, $env)->state eq 'on-order';
+}
+
+sub UserRequestReceived {
+ my $self = shift;
+ my $env = shift;
+ return get_lineitem_from_req($self, $env)->state eq 'received';
+}
+
+sub UserRequestCancelled {
+ my $self = shift;
+ my $env = shift;
+ return get_lineitem_from_req($self, $env)->state eq 'cancelled';
+}
+
+sub get_lineitem_from_req {
+ my($self, $env) = @_;
+ my $req = $env->{target};
+ return (ref $env->{target}->lineitem) ?
+ $env->{target}->lineitem :
+ $self->editor->retrieve_acq_lineitem($$env->{target}->lineitem);
+}
+
More information about the open-ils-commits
mailing list