From 8d967625fb6ef309ffb7e1a4098121665bf0767e Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Wed, 17 Jun 2009 09:04:51 +0000 Subject: [PATCH] fixed form reset after error in company prefs, added support for png logo files. --- CHANGELOG.txt | 4 +++ admin/company_preferences.php | 60 ++++++++++++++++++----------------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 601a4165..9db96ef0 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/admin/company_preferences.php b/admin/company_preferences.php index d020398a..4f1f548c 100644 --- a/admin/company_preferences.php +++ b/admin/company_preferences.php @@ -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); -- 2.30.2