[open-ils-commits] SPAM: r10120 -
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Jul 24 14:58:31 EDT 2008
Author: erickson
Date: 2008-07-24 14:58:23 -0400 (Thu, 24 Jul 2008)
New Revision: 10120
Modified:
branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
Log:
setting fund debit as non-encumbrance at receive time. marking lineitem and po as received where appropriate
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-24 17:58:20 UTC (rev 10119)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2008-07-24 18:58:23 UTC (rev 10120)
@@ -476,8 +476,9 @@
sub update_li_edit_time {
my ($e, $li) = @_;
- return OpenILS::Event->new('ACQ_LINEITEM_APPROVED', payload => $li->id)
- if $li->state eq 'approved';
+ # some lineitem edits are allowed after approval time...
+# 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;
@@ -627,8 +628,14 @@
sub receive_lineitem_detail_impl {
my($e, $lid_id) = @_;
- my $lid = $e->retrieve_acq_lineitem_detail($lid_id)
- or return $e->die_event;
+ my $lid = $e->retrieve_acq_lineitem_detail([
+ $lid_id,
+ { flesh => 1,
+ flesh_fields => {
+ acqlid => ['fund_debit']
+ }
+ }
+ ]) or return $e->die_event;
return OpenILS::Event->new(
'ACQ_LINEITEM_DETAIL_RECEIVED') if $lid->recv_time;
@@ -644,20 +651,39 @@
$copy->editor($e->requestor->id);
$e->update_asset_copy($copy) or return $e->die_event;
- # XXX update the fund_debit to encumbrance=false
+ $lid->fund_debit->encumbrance('f');
+ $e->update_acq_fund_debit($lid->fund_debit) or return $e->die_event;
+ # -------------------------------------------------------------
+ # if all of the lineitem details for this lineitem have
+ # been received, mark the lineitem as received
+ # -------------------------------------------------------------
my $non_recv = $e->search_acq_lineitem_detail(
{recv_time => undef, lineitem => $lid->lineitem}, {idlist=>1});
- unless(@$non_recv) {
- # if all of the lineitem details for this lineitem have
- # been received, mark the lineitem as received
- my $li = $e->retrieve_acq_lineitem($lid->lineitem);
- $li->state('received');
- $li->edit_time('now');
- $e->update_acq_lineitem($li) or return $e->die_event;
- }
+ return undef if @$non_recv;
+ my $li = $e->retrieve_acq_lineitem($lid->lineitem);
+ $li->state('received');
+ $li->edit_time('now');
+ $e->update_acq_lineitem($li) or return $e->die_event;
+
+ # -------------------------------------------------------------
+ # if all of the lineitems for this PO are received,
+ # mark the PO as received
+ # -------------------------------------------------------------
+ my $non_recv_li = $e->search_acq_lineitem(
+ { purchase_order => $li->purchase_order,
+ state => {'!=' => 'received'}
+ }, {idlist=>1});
+
+ return undef if @$non_recv_li;
+
+ my $po = $e->retrieve_acq_purchase_order($li->purchase_order);
+ $po->state('received');
+ $po->edit_time('now');
+ $e->update_acq_purchase_order($po) or return $e->die_event;
+
return undef;
}
More information about the open-ils-commits
mailing list