diff --git a/application/controllers/config.php b/application/controllers/config.php index 679c748da..aa708f59f 100644 --- a/application/controllers/config.php +++ b/application/controllers/config.php @@ -18,6 +18,9 @@ class Config extends Secure_area function save() { + $upload_success = $this->_handle_logo_upload(); + $upload_data = $this->upload->data(); + $batch_save_data=array( 'company'=>$this->input->post('company'), 'address'=>$this->input->post('address'), @@ -53,9 +56,16 @@ class Config extends Secure_area 'custom10_name'=>$this->input->post('custom10_name')/**GARRISON ADDED 4/20/2013**/ ); + if (!empty($upload_data['orig_name'])) + { + $batch_save_data['company_logo'] = $upload_data['raw_name']; + } + $result = $this->Appconfig->batch_save( $batch_save_data ); - $success = $result ? true : false; - echo json_encode(array('success'=>$success,'message'=>$this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully'))); + $success = $upload_success && $result ? true : false; + $message = $this->lang->line('config_saved_' . ($success ? '' : 'un') . 'successfully'); + $message = $upload_success ? $message : $this->upload->display_errors(); + echo json_encode(array('success'=>$success,'message'=>$message)); $this->_remove_duplicate_cookies(); } @@ -129,6 +139,23 @@ class Config extends Secure_area } + function _handle_logo_upload() + { + $this->load->helper('directory'); + // load upload library + $config = array('upload_path' => './uploads/', + 'allowed_types' => 'gif|jpg|png', + 'max_size' => '100', + 'max_width' => '640', + 'max_height' => '480', + 'file_name' => 'company_logo'); + $this->load->library('upload', $config); + $this->upload->do_upload('company_logo'); + return strlen($this->upload->display_errors()) == 0 || + !strcmp($this->upload->display_errors(), + '

'.$this->lang->line('upload_no_file_selected').'

'); + } + function backup_db() { $employee_id=$this->Employee->get_logged_in_employee_info()->person_id; diff --git a/application/language/en/config_lang.php b/application/language/en/config_lang.php index ca9e659d4..604467125 100644 --- a/application/language/en/config_lang.php +++ b/application/language/en/config_lang.php @@ -90,3 +90,4 @@ $lang["config_thousands_separator"] = "Thousands Separator"; $lang["config_decimal_point"] = "Decimal Point"; $lang["config_backup_button"] = "Backup"; $lang["config_stock_location_invalid_chars"] = "The stock location name can not contain '_'"; +$lang["config_company_logo"] = "Company Logo"; diff --git a/application/language/es/config_lang.php b/application/language/es/config_lang.php index f3368f517..fd71711e9 100644 --- a/application/language/es/config_lang.php +++ b/application/language/es/config_lang.php @@ -90,3 +90,4 @@ $lang["config_thousands_separator"] = " Thousands Separator"; $lang["config_decimal_point"] = " Decimal Point"; $lang["config_backup_button"] = "Backup"; $lang["config_stock_location_invalid_chars"] = "The stock location name can not contain '_'"; +$lang["config_company_logo"] = "Company Logo"; diff --git a/application/language/fr/config_lang.php b/application/language/fr/config_lang.php index ccbb8977c..dc21c4c66 100644 --- a/application/language/fr/config_lang.php +++ b/application/language/fr/config_lang.php @@ -90,3 +90,4 @@ $lang["config_thousands_separator"] = " Thousands Separator"; $lang["config_decimal_point"] = " Decimal Point"; $lang["config_backup_button"] = "Backup"; $lang["config_stock_location_invalid_chars"] = "The stock location name can not contain '_'"; +$lang["config_company_logo"] = "Company Logo"; diff --git a/application/language/id/config_lang.php b/application/language/id/config_lang.php index 667aa1683..bf3431889 100644 --- a/application/language/id/config_lang.php +++ b/application/language/id/config_lang.php @@ -90,3 +90,4 @@ $lang["config_thousands_separator"] = "Pemisah Ribuan"; $lang["config_decimal_point"] = "Titik Desimal"; $lang["config_backup_button"] = "Backup"; $lang["config_stock_location_invalid_chars"] = "The stock location name can not contain '_'"; +$lang["config_company_logo"] = "Company Logo"; diff --git a/application/language/nl-BE/config_lang.php b/application/language/nl-BE/config_lang.php index be0231f8c..cfb8518cd 100755 --- a/application/language/nl-BE/config_lang.php +++ b/application/language/nl-BE/config_lang.php @@ -90,3 +90,4 @@ $lang["config_thousands_separator"] = "Thousands Separator"; $lang["config_decimal_point"] = "Decimal Point"; $lang["config_backup_button"] = "Backup"; $lang["config_stock_location_invalid_chars"] = "De bedrijfsnaam moet ingevuld worden"; +$lang["config_company_logo"] = "Logo"; diff --git a/application/language/ru/config_lang.php b/application/language/ru/config_lang.php index 7a0cf2ee5..e570155a4 100644 --- a/application/language/ru/config_lang.php +++ b/application/language/ru/config_lang.php @@ -90,3 +90,4 @@ $lang["config_thousands_separator"] = " Thousands Separator"; $lang["config_decimal_point"] = " Decimal Point"; $lang["config_backup_button"] = "Backup"; $lang["config_stock_location_invalid_chars"] = "The stock location name can not contain '_'"; +$lang["config_company_logo"] = "Company Logo"; diff --git a/application/language/th/config_lang.php b/application/language/th/config_lang.php index 7c05180fc..d3fec0624 100644 --- a/application/language/th/config_lang.php +++ b/application/language/th/config_lang.php @@ -90,3 +90,4 @@ $lang["config_thousands_separator"] = "Thousands Separator"; $lang["config_decimal_point"] = "Decimal Point"; $lang["config_backup_button"] = "Backup"; $lang["config_stock_location_invalid_chars"] = "The stock location name can not contain '_'"; +$lang["config_company_logo"] = "Company Logo"; diff --git a/application/language/tr/config_lang.php b/application/language/tr/config_lang.php index d8678b7e1..95547636c 100644 --- a/application/language/tr/config_lang.php +++ b/application/language/tr/config_lang.php @@ -90,3 +90,4 @@ $lang["config_thousands_separator"] = " Thousands Separator"; $lang["config_decimal_point"] = " Decimal Point"; $lang["config_backup_button"] = "Backup"; $lang["config_stock_location_invalid_chars"] = "The stock location name can not contain '_'"; +$lang["config_company_logo"] = "Company Logo"; diff --git a/application/language/zh/config_lang.php b/application/language/zh/config_lang.php index dcb94340d..20a30fd68 100755 --- a/application/language/zh/config_lang.php +++ b/application/language/zh/config_lang.php @@ -90,3 +90,4 @@ $lang["config_thousands_separator"] = "Thousands Separator"; $lang["config_decimal_point"] = "Decimal Point"; $lang["config_backup_button"] = "Backup"; $lang["config_stock_location_invalid_chars"] = "The stock location name can not contain '_'"; +$lang["config_company_logo"] = "Company Logo"; diff --git a/application/views/configs/general_config.php b/application/views/configs/general_config.php index aeecde7a2..af9882f3d 100644 --- a/application/views/configs/general_config.php +++ b/application/views/configs/general_config.php @@ -1,6 +1,6 @@
lang->line('config_general_configuration'); ?>
'config_form')); +echo form_open('config/save/',array('id'=>'config_form','enctype'=>'multipart/form-data')); ?>
@@ -11,10 +11,18 @@ echo form_open('config/save/',array('id'=>'config_form'));
lang->line('config_company').':', 'company',array('class'=>'wide required')); ?>
- 'company', - 'id'=>'company', - 'value'=>$this->config->item('company')));?> + 'company', + 'id'=>'company', + 'value'=>$this->config->item('company')));?> + +
+
+ +
+lang->line('config_company_logo').':', 'company_logo',array('class'=>'wide')); ?> +
+
@@ -443,8 +451,8 @@ echo form_open('config/save/',array('id'=>'config_form')); 'submit', - 'id'=>'submit', + 'name'=>'submit_form', + 'id'=>'submit_form', 'value'=>$this->lang->line('common_submit'), 'class'=>'submit_button float_right') ); diff --git a/application/views/sales/receipt.php b/application/views/sales/receipt.php index 15bf2fead..191d32e65 100644 --- a/application/views/sales/receipt.php +++ b/application/views/sales/receipt.php @@ -8,7 +8,19 @@ if (isset($error_message)) ?>
-
config->item('company'); ?>
+ Appconfig->get('company_logo') == '') + { + ?> +
config->item('company_logo'); ?>
+ +
company_logo
+
config->item('address')); ?>
config->item('phone'); ?>
@@ -138,4 +150,4 @@ $(window).load(function() \ No newline at end of file +?> diff --git a/database/2.3.1_to_2.3.2.sql b/database/2.3.1_to_2.3.2.sql index d03e35ab0..e4fc4097e 100644 --- a/database/2.3.1_to_2.3.2.sql +++ b/database/2.3.1_to_2.3.2.sql @@ -4,6 +4,7 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('barcode_second_row', 'item_code'), ('barcode_third_row', 'cost_price'), ('barcode_num_in_row', '2'), +('company_logo', ''), ('barcode_page_width', '100'), ('barcode_page_cellspacing', '20'); diff --git a/database/database.sql b/database/database.sql index b03e097ea..611706988 100644 --- a/database/database.sql +++ b/database/database.sql @@ -40,6 +40,7 @@ INSERT INTO `ospos_app_config` (`key`, `value`) VALUES ('recv_invoice_format', '$CO'), ('sales_invoice_format', '$CO'), ('tax_included', '0'), +('company_logo', ''), ('barcode_content', 'id'), ('barcode_type', 'id'), ('barcode_width', '250'), diff --git a/translations/config_lang.csv b/translations/config_lang.csv index 7688ec1cc..8e1dde9e6 100644 --- a/translations/config_lang.csv +++ b/translations/config_lang.csv @@ -89,3 +89,4 @@ config_thousands_separator,Thousands Separator, Thousands Separator,Thousands Se config_decimal_point,Decimal Point, Decimal Point,Decimal Point, Decimal Point,Decimal Point, Decimal Point,Decimal Point, Decimal Point,Titik Desimal config_backup_button,Backup,Backup,Backup,Backup,Backup,Backup,Backup,Backup,Backup config_stock_location_invalid_chars,De bedrijfsnaam moet ingevuld worden,The stock location name can not contain '_',The stock location name can not contain '_',The stock location name can not contain '_',The stock location name can not contain '_',The stock location name can not contain '_',The stock location name can not contain '_',The stock location name can not contain '_',The stock location name can not contain '_' +config_company_logo,Logo,Company Logo,Company Logo,Company Logo,Company Logo,Company Logo,Company Logo,Company Logo,Company Logo