Merged changes up to 2.3.16 into unstable
[fa-stable.git] / inventory / manage / items.php
index f4d3b988e4623e86114ad837783ebe77c6341799..20e331c125b6b4f700682de93af4e9447912a070 100644 (file)
@@ -12,6 +12,7 @@
 $page_security = 'SA_ITEM';
 $path_to_root = "../..";
 include($path_to_root . "/includes/session.inc");
+
 $js = "";
 if ($use_popup_windows)
        $js .= get_js_open_window(900, 500);
@@ -85,6 +86,11 @@ if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '')
                display_warning(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $max_image_size);
                $upload_file ='No';
        } 
+       elseif ( $_FILES['pic']['type'] == "text/plain" ) 
+       {  //File type Check
+               display_warning( _('Only graphics files can be uploaded'));
+               $upload_file ='No';
+       } 
        elseif (file_exists($filename))
        {
                $result = unlink($filename);
@@ -119,6 +125,7 @@ function clear_data()
        unset($_POST['dimension_id']);
        unset($_POST['dimension2_id']);
        unset($_POST['no_sale']);
+       unset($_POST['no_purchase']);
 }
 
 //------------------------------------------------------------------------------------
@@ -175,7 +182,7 @@ if (isset($_POST['addupdate']))
                                $_POST['inventory_account'], $_POST['cogs_account'],
                                $_POST['adjustment_account'], $_POST['assembly_account'], 
                                $_POST['dimension_id'], $_POST['dimension2_id'],
-                               check_value('no_sale'), check_value('editable'));
+                               check_value('no_sale'), check_value('editable'), check_value('no_purchase'));
                        update_record_status($_POST['NewStockID'], $_POST['inactive'],
                                'stock_master', 'stock_id');
                        update_record_status($_POST['NewStockID'], $_POST['inactive'],
@@ -193,12 +200,12 @@ if (isset($_POST['addupdate']))
                                $_POST['inventory_account'], $_POST['cogs_account'],
                                $_POST['adjustment_account'], $_POST['assembly_account'], 
                                $_POST['dimension_id'], $_POST['dimension2_id'],
-                               check_value('no_sale'), check_value('editable'));
+                               check_value('no_sale'), check_value('editable'), check_value('no_purchase'));
 
                        display_notification(_("A new item has been added."));
                        $_POST['stock_id'] = $_POST['NewStockID'] = 
                        $_POST['description'] = $_POST['long_description'] = '';
-                       $_POST['no_sale'] = $_POST['editable'] = 0;
+                       $_POST['no_sale'] = $_POST['editable'] = $_POST['no_purchase'] =0;
                        set_focus('NewStockID');
                }
                $Ajax->activate('_page_body');
@@ -287,7 +294,8 @@ function item_settings(&$stock_id)
                        $_POST['dimension_id']  = $myrow['dimension_id'];
                        $_POST['dimension2_id'] = $myrow['dimension2_id'];
                        $_POST['no_sale']       = $myrow['no_sale'];
-                       $_POST['del_image'] = 0;        
+                       $_POST['no_purchase']   = $myrow['no_purchase'];
+                       $_POST['del_image'] = 0;
                        $_POST['inactive'] = $myrow["inactive"];
                        $_POST['editable'] = $myrow["editable"];
                }
@@ -317,6 +325,7 @@ function item_settings(&$stock_id)
                $_POST['dimension_id'] = $category_record["dflt_dim1"];
                $_POST['dimension2_id'] = $category_record["dflt_dim2"];
                $_POST['no_sale'] = $category_record["dflt_no_sale"];
+               $_POST['no_purchase'] = $category_record["dflt_no_purchase"];
                $_POST['editable'] = 0;
 
        }
@@ -333,6 +342,8 @@ function item_settings(&$stock_id)
 
        check_row(_("Exclude from sales:"), 'no_sale');
 
+       check_row(_("Exclude from purchases:"), 'no_purchase');
+
        table_section(2);
 
        $dim = get_company_pref('use_dimension');
@@ -505,7 +516,6 @@ tabbed_content_end();
 
 div_end();
 
-
 hidden('popup', @$_REQUEST['popup']);
 end_form();