References saved in refs table for all documents for easy access.
[fa-stable.git] / inventory / includes / db / items_units_db.inc
index 1f63252a3e932eef412790129c53b1d02165da2b..b5c98d9118f7afd5f39d2fcc0f9754618e16a9ed 100644 (file)
@@ -1,5 +1,14 @@
 <?php
-
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
 function write_item_unit($selected, $abbr, $description, $decimals)
 {
     if($selected!='')
@@ -49,8 +58,10 @@ function item_unit_used($unit) {
        return ($myrow[0] > 0);
 }
 
-function get_all_item_units() {
-    $sql = "SELECT * FROM ".TB_PREF."item_units ORDER BY name";
+function get_all_item_units($all=false) {
+    $sql = "SELECT * FROM ".TB_PREF."item_units";
+       if (!$all) $sql .= " WHERE !inactive";
+       $sql .= " ORDER BY name";
     return  db_query($sql, "could not get stock categories");
 }
 // 2008-06-15. Added Joe Hunt to get a measure of unit by given stock_id