# updatePurchaseOrder

## Overview

Updates a DRAFT purchase order — modifies quantities, adds/removes line items, changes supplier. DRAFT-only enforcement is delegated to erp-kit's `purchase.UpdatePurchaseOrder` command.

## Modules Commands Used

- [purchase] UpdatePurchaseOrder

## Exception Handling

| Error Code | Description |
| --- | --- |
| PURCHASE_PURCHASE_ORDER_NOT_FOUND | The specified purchase order does not exist |
| PURCHASE_PURCHASE_ORDER_NOT_DRAFT | The purchase order is not in DRAFT status and cannot be edited |
| PURCHASE_ITEM_NOT_FOUND | A referenced item does not exist |
| PURCHASE_ITEM_NOT_ACTIVE | A referenced item is not in active status |
| PURCHASE_ITEM_NOT_PURCHASABLE | A referenced item has no purchasing record |
| PURCHASE_INVALID_QUANTITY | Line item quantity is zero or negative |
| PURCHASE_INVALID_UNIT_PRICE | Line item unit price is zero or negative |
| PURCHASE_RECEIVING_SITE_NOT_FOUND | The specified receiving site does not exist |
| PURCHASE_RECEIVING_SITE_REQUIRED | Receiving site is mandatory but was not provided |
