X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fincludes%2Fdb%2Fpo_db.inc;fp=purchasing%2Fincludes%2Fdb%2Fpo_db.inc;h=38703adf3e834dd3a9c26e05730734b278bce39e;hb=168c5beaa04a25f31face788f8030c5d08f8e998;hp=e182cd09d9c75d4ac753ea12a20de3ff69570241;hpb=7198643c8d4301fe41c70f202c6316a2880c9f52;p=fa-stable.git diff --git a/purchasing/includes/db/po_db.inc b/purchasing/includes/db/po_db.inc index e182cd09..38703adf 100644 --- a/purchasing/includes/db/po_db.inc +++ b/purchasing/includes/db/po_db.inc @@ -13,12 +13,18 @@ function delete_po($po) { + global $Refs; + + begin_transaction(); hook_db_prevoid($po, ST_PURCHORDER); $sql = "DELETE FROM ".TB_PREF."purch_orders WHERE order_no=".db_escape($po); db_query($sql, "The order header could not be deleted"); $sql = "DELETE FROM ".TB_PREF."purch_order_details WHERE order_no =".db_escape($po); db_query($sql, "The order detail lines could not be deleted"); + + $Refs->restore_last(ST_PURCHORDER, $po); + commit_transaction(); } //----------------------------------------------------------------------------------------