I cannot reproduce this error.
The error is thrown in the file /sales/includes/db/sales_order_db.inc
function delete_sales_order($order_no, $trans_type)
{
begin_transaction();
hook_db_prevoid($trans_type, $order_no);
$sql = "DELETE FROM ".TB_PREF."sales_orders WHERE order_no=" . db_escape($order_no)
. " AND trans_type=".db_escape($trans_type);
db_query($sql, "order Header Delete");
$sql = "DELETE FROM ".TB_PREF."sales_order_details WHERE order_no ="
.db_escape($order_no) . " AND trans_type=".db_escape($trans_type);
db_query($sql, "order Detail Delete");
delete_reference($trans_type, $order_no);
add_audit_trail($trans_type, $order_no, Today(), _("Deleted."));
commit_transaction();
}
If the $order_no is empty, the error should have been trown in one of the prior database calls.
The file /includes/db/audit_trail_db.inc shows the
function add_audit_trail($trans_type, $trans_no, $trans_date, $descr='')
{
$sql = "INSERT INTO ".TB_PREF."audit_trail"
. " (type, trans_no, user, fiscal_year, gl_date, description, gl_seq)
VALUES(".db_escape($trans_type).", ".db_escape($trans_no).","
. $_SESSION["wa_current_user"]->user. ","
. get_company_pref('f_year') .","
. "'". date2sql($trans_date) ."',"
. db_escape($descr). ", 0)";
db_query($sql, "Cannot add audit info");
// all audit records beside latest one should have gl_seq set to NULL
// to avoid need for subqueries (not existing in MySQL 3) all over the code
$sql = "UPDATE ".TB_PREF."audit_trail SET gl_seq = NULL"
. " WHERE type=".db_escape($trans_type)." AND trans_no="
.db_escape($trans_no)." AND id!=".db_insert_id();
db_query($sql, "Cannot update audit gl_seq");
}
The sql sentence INSERT INTO ... throws the empty result. This is strange
Please can somebody help me to track this, if possible?
/Joe