table('goods_receipts')->value('id');$request=(int)$db->table('purchase_orders')->where('id',$db->table('goods_receipts')->where('id',$id)->value('purchase_order_id'))->value('requisition_id');$docs='/api/purchasing-receipts/history/'.$id.'/documents';$statuses=[200,201]; $enter('validator',1,['module'=>'commercial']);$ok($call('validator',$docs,null,1)['status']===403,'other module cannot reuse document capability');$enter('validator',1,['foreign'=>1]);$ok($call('validator',$docs,null,1)['status']===403,'unmapped unit cannot read private attachments'); $ok($db->table('goods_receipts')->count()===1&&$db->table('stock_movements')->count()===1&&(int)$db->table('stock_movements')->sum('quantity_milli')===1000,'attachment book retains one complete receipt and its original1000milli movement');$ok($db->table('invoices')->count()===0&&$db->table('pa_obligations')->count()===0&&$db->table('external_payments')->count()===0,'attachment decisions introduce no invoice debt payment or accounting effect'); file_put_contents($out,json_encode(['passed'=>true,'checks'=>$checks,'transport_documents'=>1,'native_volume_documents'=>15,'documents'=>16,'permanent_files'=>16,'staged_files'=>0,'concurrency_statuses'=>$statuses,'new_right_names'=>[],'visual_review'=>false,'deployment_capacity_validated'=>false],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));echo count($checks)." receipt document checks passed.\n";