# update these on the LI when we alter an LID?
$mgr->editor->update_acq_lineitem_detail($lid) or return 0;
+ my $query = { "select" => {
+ "acqlid" => [
+ "lineitem", {
+ "column" => "lineitem",
+ "transform" => "count",
+ "alias" => "lineitem_count",
+ "aggregate" => "true"
+ }]
+ },
+ "from" => { "jub" => "acqlid" },
+ "where" => [{
+ "+acqlid" => { "lineitem" => $lid->lineitem->id, "cancel_reason" => null }
+ },
+ {"purchase_order" => $lid->lineitem->purchase_order}
+ ]};
+ my $lineitem_query = $e->json_query($query);
+
+ if ($lineitem_query->lineitem_count == 0) {
+ cancel_lineitem_api($lid->lineitem->id, "Canceled: No Copies");
+ }
+
return {"lid" => {$lid_id => {"cancel_reason" => $cancel_reason}}};
}