{
global $Refs;
- begin_transaction();
+ begin_transaction(__FUNCTION__, func_get_args());
$args = func_get_args();
$args = (object)array_combine(array('wo_ref', 'loc_code', 'units_reqd', 'stock_id',
'type', 'date_', 'required_by', 'memo_', 'costs', 'cr_acc', 'labour', 'cr_lab_acc'), $args);
function update_work_order($woid, $loc_code, $units_reqd, $stock_id,
$date_, $required_by, $memo_)
{
- begin_transaction();
+ begin_transaction(__FUNCTION__, func_get_args());
$args = func_get_args();
$args = (object)array_combine(array('woid', 'loc_code', 'units_reqd', 'stock_id',
'date_', 'required_by', 'memo_'), $args);
function delete_work_order($woid, $stock_id, $qty, $date)
{
- begin_transaction();
+ begin_transaction(__FUNCTION__, func_get_args());
hook_db_prevoid(ST_WORKORDER, $woid);
// delete the work order requirements
{
$sql = "SELECT wo.*,st.description As StockItemName,l.location_name,
l.delivery_address,l.email, l.contact, st.inventory_account, st.wip_account
- FROM ".TB_PREF."workorders wo, "
+ FROM ".TB_PREF."workorders wo
+ LEFT JOIN ".TB_PREF."voided v ON v.id=wo.id and v.type=".ST_WORKORDER.","
.TB_PREF."stock_master st, "
.TB_PREF."locations l
- WHERE st.stock_id=wo.stock_id
+ WHERE ISNULL(v.id)
+ AND st.stock_id=wo.stock_id
AND l.loc_code=wo.loc_code
AND wo.id=".db_escape($woid)."
GROUP BY wo.id";
- $result = db_query($sql, "The work order issues could not be retrieved");
+ $result = db_query($sql, "The work order could not be retrieved");
if (!$allow_null && db_num_rows($result) == 0)
{
- display_db_error("Could not find work order $woid", $sql);
+ display_db_error("Could not find work order ".(int)$woid, $sql);
return false;
}
function release_work_order($woid, $releaseDate, $memo_)
{
- begin_transaction();
+ begin_transaction(__FUNCTION__, func_get_args());
$myrow = get_work_order($woid);
$stock_id = $myrow["stock_id"];
*/
function void_work_order($woid)
{
- begin_transaction();
+ begin_transaction(__FUNCTION__, func_get_args());
hook_db_prevoid(ST_WORKORDER, $woid);
$work_order = get_work_order($woid);
void_wo_requirements($woid);
// close workorder
- // FIXME: due to bug in 2.4 db scheme (conflicting wo_ref unique key) we have to fix wo_ref here:
- $sql = "UPDATE ".TB_PREF."workorders SET closed=1,units_reqd=0,units_issued=0, wo_ref=CONCAT(wo_ref, ' ', '".uniqid()."') WHERE id = "
+ $sql = "UPDATE ".TB_PREF."workorders SET closed=1,units_reqd=0,units_issued=0 WHERE id = "
.db_escape($woid);
db_query($sql, "The work order couldn't be voided");