Rerun of connect_db_mysqli.inc.
[fa-stable.git] / inventory / includes / db / items_db.inc
index 07fde0d172768d1872dc80aead3876a361edcb7c..b61f4140e2f47b157749bf1bde269b85f9e15c9f 100644 (file)
@@ -10,7 +10,7 @@
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
 function update_item($stock_id, $description, $long_description, $category_id, 
-       $tax_type_id, $units='', $mb_flag='', $sales_account, $inventory_account, 
+       $tax_type_id, $units, $mb_flag, $sales_account, $inventory_account, 
        $cogs_account,  $adjustment_account, $wip_account, $dimension_id, 
        $dimension2_id, $no_sale, $editable, $no_purchase,
        $depreciation_method = 'D', $depreciation_rate=100, $depreciation_factor=1,
@@ -228,3 +228,15 @@ function get_items_search($description, $type)
        return db_query($sql, "Failed in retreiving item list.");
 }
 
+function get_item_code_id($stock_id)
+{
+       $sql = "SELECT ic.id
+               FROM ".TB_PREF."item_codes ic, ".TB_PREF."stock_master sm
+               WHERE ic.item_code = ".db_escape($stock_id)." AND ic.item_code = ic.stock_id AND
+       ic.stock_id = sm.stock_id";
+
+       $result = db_query($sql, "could not get item id");
+       $row = db_fetch_row($result);
+
+       return is_array($row) ? $row[0] : false;
+}
\ No newline at end of file