[open-ils-commits] r12799 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Apr 6 12:27:29 EDT 2009
Author: erickson
Date: 2009-04-06 12:27:27 -0400 (Mon, 06 Apr 2009)
New Revision: 12799
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
Log:
added a mark-po-received method
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm 2009-04-06 16:08:44 UTC (rev 12798)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm 2009-04-06 16:27:27 UTC (rev 12799)
@@ -1090,5 +1090,50 @@
}
+__PACKAGE__->register_method(
+ method => 'receive_po',
+ api_name => 'open-ils.acq.purchase_order.receive'
+);
+
+sub receive_po {
+ my($self, $conn, $auth, $po_id) = @_;
+ my $e = new_editor(xact => 1, authtoken => $auth);
+ return $e->die_event unless $e->checkauth;
+
+ my $po = $e->retrieve_acq_purchase_order($po_id) or return $e->die_event;
+ return $e->die_event unless $e->allowed('RECEIVE_PURCHASE_ORDER', $po->ordering_agency);
+
+ my $li_ids = $e->search_acq_lineitem({purchase_order => $po_id}, {idlist => 1});
+
+ my $progress = 0;
+ for my $li_id (@$li_ids) {
+ my $li = $e->retrieve_acq_lineitem($li_id);
+ my $lid_ids = $e->search_acq_lineitem_detail({lineitem => $li_id}, {idlist => 1});
+
+ for my $lid_id (@$lid_ids) {
+ my $evt = OpenILS::Application::Acq::Lineitem::receive_lineitem_detail_impl($e, $lid_id, 1);
+ return $evt if $evt;
+ $conn->respond({progress => ++$progress});
+ }
+
+ $li->state('received');
+ $li->edit_time('now');
+ $li->editor($e->requestor->id);
+ $e->update_acq_lineitem($li) or return $e->die_event;
+ $conn->respond({progress => ++$progress});
+ }
+
+ $po->state('received');
+ $po->edit_time('now');
+ $po->editor($e->requestor->id);
+ $e->update_acq_purchase_order($po) or return $e->die_event;
+
+ $e->commit;
+
+ return {complete => 1, progress => ++$progress};
+}
+
+
+
1;
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2009-04-06 16:08:44 UTC (rev 12798)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2009-04-06 16:27:27 UTC (rev 12799)
@@ -1,4 +1,4 @@
-package OpenILS::Application::Acq::Picklist;
+package OpenILS::Application::Acq::Lineitem;
use base qw/OpenILS::Application/;
use strict; use warnings;
@@ -668,7 +668,7 @@
}
sub receive_lineitem_detail_impl {
- my($e, $lid_id) = @_;
+ my($e, $lid_id, $skip_complete_check) = @_;
my $lid = $e->retrieve_acq_lineitem_detail([
$lid_id,
@@ -698,6 +698,8 @@
$e->update_acq_fund_debit($lid->fund_debit) or return $e->die_event;
}
+ return undef if $skip_complete_check;
+
# -------------------------------------------------------------
# if all of the lineitem details for this lineitem have
# been received, mark the lineitem as received
More information about the open-ils-commits
mailing list