projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added access exetensions hook method, cleanup.
[fa-stable.git]
/
manufacturing
/
includes
/
db
/
work_order_produce_items_db.inc
diff --git
a/manufacturing/includes/db/work_order_produce_items_db.inc
b/manufacturing/includes/db/work_order_produce_items_db.inc
index 6f5c001f3df137da8b039d45749195ac6b8f63a8..9b2095c076141fdce58e949a8ab2c5ed1999d4d7 100644
(file)
--- a/
manufacturing/includes/db/work_order_produce_items_db.inc
+++ b/
manufacturing/includes/db/work_order_produce_items_db.inc
@@
-14,6
+14,11
@@
function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo)
global $Refs;
begin_transaction();
global $Refs;
begin_transaction();
+ $args = func_get_args();
+ $args = (object)array_combine(array('woid', 'ref', 'quantity', 'date_', 'memo_','close_wo'),
+ $args);
+ $args->trans_no = 0;
+ hook_db_prewrite($args, ST_MANURECEIVE);
$details = get_work_order($woid);
$details = get_work_order($woid);
@@
-42,13
+47,13
@@
function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo)
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
- work_order_quick_costs($woid, $details["stock_id"], $quantity, $date_,
true
);
+ work_order_quick_costs($woid, $details["stock_id"], $quantity, $date_,
$id
);
// -------------------------------------------------------------------------
// insert a +ve stock move for the item being manufactured
// negative means "unproduce" or unassemble
add_stock_move(ST_MANURECEIVE, $details["stock_id"], $id,
// -------------------------------------------------------------------------
// insert a +ve stock move for the item being manufactured
// negative means "unproduce" or unassemble
add_stock_move(ST_MANURECEIVE, $details["stock_id"], $id,
- $details["loc_code"], $date_, $
memo_
, $quantity, 0);
+ $details["loc_code"], $date_, $
ref
, $quantity, 0);
// update wo quantity and close wo if requested
work_order_update_finished_quantity($woid, $quantity, $close_wo);
// update wo quantity and close wo if requested
work_order_update_finished_quantity($woid, $quantity, $close_wo);
@@
-59,6
+64,8
@@
function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo)
$Refs->save(ST_MANURECEIVE, $id, $ref);
add_audit_trail(ST_MANURECEIVE, $id, $date_, _("Production."));
$Refs->save(ST_MANURECEIVE, $id, $ref);
add_audit_trail(ST_MANURECEIVE, $id, $date_, _("Production."));
+ $args->trans_no = $id;
+ hook_db_postwrite($args, ST_MANURECEIVE);
commit_transaction();
}
commit_transaction();
}
@@
-101,12
+108,15
@@
function exists_work_order_produce($id)
function void_work_order_produce($type_no)
{
begin_transaction();
function void_work_order_produce($type_no)
{
begin_transaction();
+ hook_db_prevoid(ST_MANURECEIVE, $type_no);
$row = get_work_order_produce($type_no);
// deduct the quantity of this production from the parent work order
work_order_update_finished_quantity($row["workorder_id"], -$row["quantity"]);
$row = get_work_order_produce($type_no);
// deduct the quantity of this production from the parent work order
work_order_update_finished_quantity($row["workorder_id"], -$row["quantity"]);
+ work_order_quick_costs($row['workorder_id'], $row['stock_id'], -$row['quantity'], sql2date($row['date_']), $type_no);
+
// clear the production record
$sql = "UPDATE ".TB_PREF."wo_manufacture SET quantity=0 WHERE id=".db_escape($type_no);
db_query($sql, "Cannot void a wo production");
// clear the production record
$sql = "UPDATE ".TB_PREF."wo_manufacture SET quantity=0 WHERE id=".db_escape($type_no);
db_query($sql, "Cannot void a wo production");