Previously, Evergreen only considered lineitems not in a "received" status
when deciding whether to consider a purchase order to be "received". Now
items with cancel reasons that do not keep debits (e.g. not backordered)
are considered "done".
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
sub check_purchase_order_received {
my($mgr, $po_id) = @_;
- my $non_recv_li = $mgr->editor->search_acq_lineitem(
- { purchase_order => $po_id,
- state => {'!=' => 'received'}
- }, {idlist=>1});
+ my $non_recv_li = $mgr->editor->json_query({
+ "select" =>{
+ "jub" =>["id"]
+ },
+ "from" =>{
+ "jub" => {"acqcr" => {"type" => "left"}}
+ },
+ "where" =>{
+ "+jub" => {"id" => $po_id},
+ "-or" => [
+ {"+jub" => {"state" => "received"}},
+ {"+acqcr" => {"keep_debits" =>"t"}}
+ ]
+ }
+ });
my $po = $mgr->editor->retrieve_acq_purchase_order($po_id);
return $po if @$non_recv_li;