fixed form reset after error in company prefs, added support for png
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 17 Jun 2009 09:04:51 +0000 (09:04 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 17 Jun 2009 09:04:51 +0000 (09:04 +0000)
logo files.

CHANGELOG.txt
admin/company_preferences.php

index 601a41657768ff55adbcbac9d27091d83b057887..9db96ef05975652a706203effbf6e64bfc1add3f 100644 (file)
@@ -19,6 +19,10 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+17-Jun-2009 Janusz Dobrowolski
+# Fixed form reset after error, allowed png logo files.
+$ /admin/company_preferences.php
+
 17-Jun-2009 Joe Hunt/Tu Nguyen
 # [0000136] view_po on invoices and credits shows transactions from other suppliers
 $ /purchasing/includes/db/invoice_db.inc
index d020398a8bd94937751d10ec5b36a8fe23c9d8f6..4f1f548c3df2935a6fcd7797af3188c35ffa3382 100644 (file)
@@ -44,9 +44,10 @@ if (isset($_POST['update']) && $_POST['update'] != "")
                $filename .= "/".$_FILES['pic']['name'];
 
                 //But check for the worst
-               if (strtoupper(substr(trim($_FILES['pic']['name']), strlen($_FILES['pic']['name']) - 3)) != 'JPG')
+               if (!in_array((substr(trim($_FILES['pic']['name']),-3)), 
+                       array('jpg','JPG','png','PNG')))
                {
-                       display_error(_('Only jpg files are supported - a file extension of .jpg is expected'));
+                       display_error(_('Only jpg and png files are supported - a file extension of .jpg or .png is expected'));
                        $input_error = 1;
                }
                elseif ( $_FILES['pic']['size'] > ($max_image_size * 1024))
@@ -112,33 +113,34 @@ if (isset($_POST['update']) && $_POST['update'] != "")
 
 
 start_form(true);
-
-$myrow = get_company_prefs();
-
-$_POST['coy_name'] = $myrow["coy_name"];
-$_POST['gst_no'] = $myrow["gst_no"];
-$_POST['tax_prd'] = $myrow["tax_prd"];
-$_POST['tax_last'] = $myrow["tax_last"];
-$_POST['coy_no']  = $myrow["coy_no"];
-$_POST['postal_address']  = $myrow["postal_address"];
-$_POST['phone']  = $myrow["phone"];
-$_POST['fax']  = $myrow["fax"];
-$_POST['email']  = $myrow["email"];
-$_POST['coy_logo']  = $myrow["coy_logo"];
-$_POST['domicile']  = $myrow["domicile"];
-$_POST['use_dimension']  = $myrow["use_dimension"];
-$_POST['base_sales']  = $myrow["base_sales"];
-$_POST['no_item_list']  = $myrow["no_item_list"];
-$_POST['no_customer_list']  = $myrow["no_customer_list"];
-$_POST['no_supplier_list']  = $myrow["no_supplier_list"];
-$_POST['custom1_name']  = $myrow["custom1_name"];
-$_POST['custom2_name']  = $myrow["custom2_name"];
-$_POST['custom3_name']  = $myrow["custom3_name"];
-$_POST['custom1_value']  = $myrow["custom1_value"];
-$_POST['custom2_value']  = $myrow["custom2_value"];
-$_POST['custom3_value']  = $myrow["custom3_value"];
-$_POST['curr_default']  = $myrow["curr_default"];
-$_POST['f_year']  = $myrow["f_year"];
+if (!isset($_POST['coy_name'])) {
+       $myrow = get_company_prefs();
+
+       $_POST['coy_name'] = $myrow["coy_name"];
+       $_POST['gst_no'] = $myrow["gst_no"];
+       $_POST['tax_prd'] = $myrow["tax_prd"];
+       $_POST['tax_last'] = $myrow["tax_last"];
+       $_POST['coy_no']  = $myrow["coy_no"];
+       $_POST['postal_address']  = $myrow["postal_address"];
+       $_POST['phone']  = $myrow["phone"];
+       $_POST['fax']  = $myrow["fax"];
+       $_POST['email']  = $myrow["email"];
+       $_POST['coy_logo']  = $myrow["coy_logo"];
+       $_POST['domicile']  = $myrow["domicile"];
+       $_POST['use_dimension']  = $myrow["use_dimension"];
+       $_POST['base_sales']  = $myrow["base_sales"];
+       $_POST['no_item_list']  = $myrow["no_item_list"];
+       $_POST['no_customer_list']  = $myrow["no_customer_list"];
+       $_POST['no_supplier_list']  = $myrow["no_supplier_list"];
+       $_POST['custom1_name']  = $myrow["custom1_name"];
+       $_POST['custom2_name']  = $myrow["custom2_name"];
+       $_POST['custom3_name']  = $myrow["custom3_name"];
+       $_POST['custom1_value']  = $myrow["custom1_value"];
+       $_POST['custom2_value']  = $myrow["custom2_value"];
+       $_POST['custom3_value']  = $myrow["custom3_value"];
+       $_POST['curr_default']  = $myrow["curr_default"];
+       $_POST['f_year']  = $myrow["f_year"];
+}
 $_POST['del_coy_logo']  = 0;
 
 start_outer_table($table_style2);