Rerun of items attachments. Including fixed assets.
[fa-stable.git] / admin / db / transactions_db.inc
index d3e3cfc5626b1c6b64e9976b186a48199a0384be..6cc5ae31fb2e1f4ce123b1f8ca924ed91b770e7b 100644 (file)
@@ -31,13 +31,12 @@ function get_sql_for_view_transactions($filtertype, $from, $to, &$trans_ref)
                $sql .= " ,t.$trans_ref as ref ";
        else
                $sql .= ", r.reference as ref";
-       $sql .= ",t.$trans_date as trans_date";
+       if ($trans_date)
+               $sql .= ",t.$trans_date as trans_date";
        if ($type_name)
                $sql .= ", t.$type_name as type";
        $sql .= " FROM $table_name t LEFT JOIN ".TB_PREF."voided v ON"
-               ." t.$trans_no_name=v.id AND v.type=$filtertype";
-       if (!$trans_ref)
-               $sql .= " LEFT JOIN ".TB_PREF."refs r ON t.$trans_no_name=r.id AND r.type=$filtertype";
+               ." t.$trans_no_name=v.id AND v.type=".db_escape($filtertype);
 
        $sql .= " WHERE ISNULL(v.`memo_`)";
        if ($from != null && $to != null)
@@ -209,16 +208,13 @@ function get_systype_db_info($type)
         case     31              : return array(TB_PREF."service_orders", null, "order_no", "cust_ref", "date");
         case     ST_SALESQUOTE   : return array(TB_PREF."sales_orders", "trans_type", "order_no", "reference", "ord_date");
         case    ST_DIMENSION    : return array(TB_PREF."dimensions", null, "id", "reference", "date_");
-        case     ST_COSTUPDATE   : return array(TB_PREF."gl_trans", "type", "type_no", null, "tran_date");
+        case     ST_COSTUPDATE   : return array(TB_PREF."journal", "type", "trans_no", "reference", "tran_date");
+
+        case     ST_CUSTOMER    : return array(TB_PREF."debtors_master", null, "debtor_no", "debtor_ref", null);
+        case     ST_SUPPLIER    : return array(TB_PREF."suppliers", null, "supplier_id", "supp_ref", null);
+        case     ST_ITEM        : return array(TB_PREF."item_codes", null, "id", "stock_id", null);
+        case     ST_FIXEDASSET  : return array(TB_PREF."item_codes", null, "id", "stock_id", null);
        }
 
        display_db_error("invalid type ($type) sent to get_systype_db_info", "", true);
 }
-
-function get_systypes()
-{
-       $sql = "SELECT * FROM ".TB_PREF."sys_types";
-       $result = db_query($sql, "could not query systypes table");
-       return $result;
-}
-