mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-02-23 18:36:26 -05:00
Add company logo upload feature in config (will show on receipts)
This commit is contained in:
@@ -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(),
|
||||
'<p>'.$this->lang->line('upload_no_file_selected').'</p>');
|
||||
}
|
||||
|
||||
function backup_db()
|
||||
{
|
||||
$employee_id=$this->Employee->get_logged_in_employee_info()->person_id;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="page_title"><?php echo $this->lang->line('config_general_configuration'); ?></div>
|
||||
<?php
|
||||
echo form_open('config/save/',array('id'=>'config_form'));
|
||||
echo form_open('config/save/',array('id'=>'config_form','enctype'=>'multipart/form-data'));
|
||||
?>
|
||||
<div id="config_wrapper">
|
||||
<fieldset id="config_info">
|
||||
@@ -11,10 +11,18 @@ echo form_open('config/save/',array('id'=>'config_form'));
|
||||
<div class="field_row clearfix">
|
||||
<?php echo form_label($this->lang->line('config_company').':', 'company',array('class'=>'wide required')); ?>
|
||||
<div class='form_field'>
|
||||
<?php echo form_input(array(
|
||||
'name'=>'company',
|
||||
'id'=>'company',
|
||||
'value'=>$this->config->item('company')));?>
|
||||
<?php echo form_input(array(
|
||||
'name'=>'company',
|
||||
'id'=>'company',
|
||||
'value'=>$this->config->item('company')));?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field_row clearfix">
|
||||
<?php echo form_label($this->lang->line('config_company_logo').':', 'company_logo',array('class'=>'wide')); ?>
|
||||
<div class='form_field'>
|
||||
<?php echo form_upload('company_logo');?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -443,8 +451,8 @@ echo form_open('config/save/',array('id'=>'config_form'));
|
||||
|
||||
<?php
|
||||
echo form_submit(array(
|
||||
'name'=>'submit',
|
||||
'id'=>'submit',
|
||||
'name'=>'submit_form',
|
||||
'id'=>'submit_form',
|
||||
'value'=>$this->lang->line('common_submit'),
|
||||
'class'=>'submit_button float_right')
|
||||
);
|
||||
|
||||
@@ -8,7 +8,19 @@ if (isset($error_message))
|
||||
?>
|
||||
<div id="receipt_wrapper">
|
||||
<div id="receipt_header">
|
||||
<div id="company_name"><?php echo $this->config->item('company'); ?></div>
|
||||
<?php if ($this->Appconfig->get('company_logo') == '')
|
||||
{
|
||||
?>
|
||||
<div id="company_name"><?php echo $this->config->item('company_logo'); ?></div>
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
?>
|
||||
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->Appconfig->get('company_logo')); ?>" alt="company_logo" /></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div id="company_address"><?php echo nl2br($this->config->item('address')); ?></div>
|
||||
<div id="company_phone"><?php echo $this->config->item('phone'); ?></div>
|
||||
<div id="sale_receipt"><?php echo $receipt_title; ?></div>
|
||||
@@ -138,4 +150,4 @@ $(window).load(function()
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user