mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-24 08:20:54 -04:00
Replace Appconfig->get with config->item to reduce database calls
This commit is contained in:
@@ -193,7 +193,7 @@ class Config extends Secure_Controller
|
||||
{
|
||||
$data['stock_locations'] = $this->Stock_location->get_all()->result_array();
|
||||
$data['support_barcode'] = $this->barcode_lib->get_list_barcodes();
|
||||
$data['logo_exists'] = $this->Appconfig->get('company_logo') != '';
|
||||
$data['logo_exists'] = $this->config->item('company_logo') != '';
|
||||
|
||||
$data = $this->xss_clean($data);
|
||||
|
||||
|
||||
@@ -172,8 +172,8 @@ class Items extends Secure_Controller
|
||||
|
||||
if($item_id == -1)
|
||||
{
|
||||
$data['default_tax_1_rate'] = $this->Appconfig->get('default_tax_1_rate');
|
||||
$data['default_tax_2_rate'] = $this->Appconfig->get('default_tax_2_rate');
|
||||
$data['default_tax_1_rate'] = $this->config->item('default_tax_1_rate');
|
||||
$data['default_tax_2_rate'] = $this->config->item('default_tax_2_rate');
|
||||
|
||||
$item_info->receiving_quantity = 0;
|
||||
$item_info->reorder_level = 0;
|
||||
@@ -269,7 +269,7 @@ class Items extends Secure_Controller
|
||||
$item = $this->xss_clean($item);
|
||||
|
||||
// update the UPC/EAN/ISBN field if empty / NULL with the newly generated barcode
|
||||
if(empty($item['item_number']) && $this->Appconfig->get('barcode_generate_if_empty'))
|
||||
if(empty($item['item_number']) && $this->config->item('barcode_generate_if_empty'))
|
||||
{
|
||||
// get the newly generated barcode
|
||||
$barcode_instance = Barcode_lib::barcode_instance($item, $config);
|
||||
|
||||
@@ -24,28 +24,28 @@ class Barcode_lib
|
||||
|
||||
public function get_barcode_config()
|
||||
{
|
||||
$data['company'] = $this->CI->Appconfig->get('company');
|
||||
$data['barcode_content'] = $this->CI->Appconfig->get('barcode_content');
|
||||
$data['barcode_type'] = $this->CI->Appconfig->get('barcode_type');
|
||||
$data['barcode_font'] = $this->CI->Appconfig->get('barcode_font');
|
||||
$data['barcode_font_size'] = $this->CI->Appconfig->get('barcode_font_size');
|
||||
$data['barcode_height'] = $this->CI->Appconfig->get('barcode_height');
|
||||
$data['barcode_width'] = $this->CI->Appconfig->get('barcode_width');
|
||||
$data['barcode_quality'] = $this->CI->Appconfig->get('barcode_quality');
|
||||
$data['barcode_first_row'] = $this->CI->Appconfig->get('barcode_first_row');
|
||||
$data['barcode_second_row'] = $this->CI->Appconfig->get('barcode_second_row');
|
||||
$data['barcode_third_row'] = $this->CI->Appconfig->get('barcode_third_row');
|
||||
$data['barcode_num_in_row'] = $this->CI->Appconfig->get('barcode_num_in_row');
|
||||
$data['barcode_page_width'] = $this->CI->Appconfig->get('barcode_page_width');
|
||||
$data['barcode_page_cellspacing'] = $this->CI->Appconfig->get('barcode_page_cellspacing');
|
||||
$data['barcode_generate_if_empty'] = $this->CI->Appconfig->get('barcode_generate_if_empty');
|
||||
$data['company'] = $this->CI->config->item('company');
|
||||
$data['barcode_content'] = $this->CI->config->item('barcode_content');
|
||||
$data['barcode_type'] = $this->CI->config->item('barcode_type');
|
||||
$data['barcode_font'] = $this->CI->config->item('barcode_font');
|
||||
$data['barcode_font_size'] = $this->CI->config->item('barcode_font_size');
|
||||
$data['barcode_height'] = $this->CI->config->item('barcode_height');
|
||||
$data['barcode_width'] = $this->CI->config->item('barcode_width');
|
||||
$data['barcode_quality'] = $this->CI->config->item('barcode_quality');
|
||||
$data['barcode_first_row'] = $this->CI->config->item('barcode_first_row');
|
||||
$data['barcode_second_row'] = $this->CI->config->item('barcode_second_row');
|
||||
$data['barcode_third_row'] = $this->CI->config->item('barcode_third_row');
|
||||
$data['barcode_num_in_row'] = $this->CI->config->item('barcode_num_in_row');
|
||||
$data['barcode_page_width'] = $this->CI->config->item('barcode_page_width');
|
||||
$data['barcode_page_cellspacing'] = $this->CI->config->item('barcode_page_cellspacing');
|
||||
$data['barcode_generate_if_empty'] = $this->CI->config->item('barcode_generate_if_empty');
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function validate_barcode($barcode)
|
||||
{
|
||||
$barcode_type = $this->CI->Appconfig->get('barcode_type');
|
||||
$barcode_type = $this->CI->config->item('barcode_type');
|
||||
$barcode_instance = $this->get_barcode_instance($barcode_type);
|
||||
return $barcode_instance->validate($barcode);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="fileinput-new thumbnail" style="width: 200px; height: 200px;"></div>
|
||||
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 200px;">
|
||||
<img data-src="holder.js/100%x100%" alt="<?php echo $this->lang->line('config_company_logo'); ?>"
|
||||
src="<?php if($logo_exists) echo base_url('uploads/' . $this->Appconfig->get('company_logo')); else echo ''; ?>"
|
||||
src="<?php if($logo_exists) echo base_url('uploads/' . $this->config->item('company_logo')); else echo ''; ?>"
|
||||
style="max-height: 100%; max-width: 100%;">
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -8,12 +8,12 @@ function printdoc()
|
||||
if (window.jsPrintSetup)
|
||||
{
|
||||
// set top margins in millimeters
|
||||
jsPrintSetup.setOption('marginTop', '<?php echo $this->Appconfig->get('print_top_margin'); ?>');
|
||||
jsPrintSetup.setOption('marginLeft', '<?php echo $this->Appconfig->get('print_left_margin'); ?>');
|
||||
jsPrintSetup.setOption('marginBottom', '<?php echo $this->Appconfig->get('print_bottom_margin'); ?>');
|
||||
jsPrintSetup.setOption('marginRight', '<?php echo $this->Appconfig->get('print_right_margin'); ?>');
|
||||
jsPrintSetup.setOption('marginTop', '<?php echo $this->config->item('print_top_margin'); ?>');
|
||||
jsPrintSetup.setOption('marginLeft', '<?php echo $this->config->item('print_left_margin'); ?>');
|
||||
jsPrintSetup.setOption('marginBottom', '<?php echo $this->config->item('print_bottom_margin'); ?>');
|
||||
jsPrintSetup.setOption('marginRight', '<?php echo $this->config->item('print_right_margin'); ?>');
|
||||
|
||||
<?php if (!$this->Appconfig->get('print_header'))
|
||||
<?php if (!$this->config->item('print_header'))
|
||||
{
|
||||
?>
|
||||
// set page header
|
||||
@@ -22,7 +22,7 @@ function printdoc()
|
||||
jsPrintSetup.setOption('headerStrRight', '');
|
||||
<?php
|
||||
}
|
||||
if (!$this->Appconfig->get('print_footer'))
|
||||
if (!$this->config->item('print_footer'))
|
||||
{
|
||||
?>
|
||||
// set empty page footer
|
||||
@@ -44,7 +44,7 @@ function printdoc()
|
||||
// clears user preferences always silent print value
|
||||
// to enable using 'printSilent' option
|
||||
jsPrintSetup.clearSilentPrint();
|
||||
<?php if (!$this->Appconfig->get('print_silently'))
|
||||
<?php if (!$this->config->item('print_silently'))
|
||||
{
|
||||
?>
|
||||
// Suppress print dialog (for this context only)
|
||||
|
||||
@@ -18,7 +18,7 @@ if (isset($error_message))
|
||||
<div id="receipt_wrapper">
|
||||
<div id="receipt_header">
|
||||
<?php
|
||||
if ($this->Appconfig->get('company_logo') == '')
|
||||
if ($this->config->item('company_logo') == '')
|
||||
{
|
||||
?>
|
||||
<div id="company_name"><?php echo $this->config->item('company'); ?></div>
|
||||
@@ -27,7 +27,7 @@ if (isset($error_message))
|
||||
else
|
||||
{
|
||||
?>
|
||||
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->Appconfig->get('company_logo')); ?>" alt="company_logo" /></div>
|
||||
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->config->item('company_logo')); ?>" alt="company_logo" /></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -19,10 +19,10 @@ if (isset($error_message))
|
||||
<table id="info">
|
||||
<tr>
|
||||
<td id="logo">
|
||||
<?php if($this->Appconfig->get('company_logo') != '')
|
||||
<?php if($this->config->item('company_logo') != '')
|
||||
{
|
||||
?>
|
||||
<img id="image" src="<?php echo 'uploads/' . $this->Appconfig->get('company_logo'); ?>" alt="company_logo" />
|
||||
<img id="image" src="<?php echo 'uploads/' . $this->config->item('company_logo'); ?>" alt="company_logo" />
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<div id="receipt_wrapper">
|
||||
<div id="receipt_header">
|
||||
<?php
|
||||
if ($this->Appconfig->get('company_logo') != '')
|
||||
if ($this->config->item('company_logo') != '')
|
||||
{
|
||||
?>
|
||||
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->Appconfig->get('company_logo')); ?>" alt="company_logo" /></div>
|
||||
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->config->item('company_logo')); ?>" alt="company_logo" /></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@@ -55,11 +55,11 @@
|
||||
<td><?php echo ucfirst($item['name']); ?></td>
|
||||
<td><?php echo to_currency($item['price']); ?></td>
|
||||
<td><?php echo to_quantity_decimals($item['quantity']); ?></td>
|
||||
<td class="total-value"><?php echo to_currency($item[($this->Appconfig->get('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
|
||||
<td class="total-value"><?php echo to_currency($item[($this->config->item('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
if($this->Appconfig->get('receipt_show_description'))
|
||||
if($this->config->item('receipt_show_description'))
|
||||
{
|
||||
?>
|
||||
<td colspan="2"><?php echo $item['description']; ?></td>
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if($this->Appconfig->get('receipt_show_serialnumber'))
|
||||
if($this->config->item('receipt_show_serialnumber'))
|
||||
{
|
||||
?>
|
||||
<td><?php echo $item['serialnumber']; ?></td>
|
||||
@@ -91,7 +91,7 @@
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)
|
||||
if ($this->config->item('receipt_show_total_discount') && $discount > 0)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
@@ -107,7 +107,7 @@
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($this->Appconfig->get('receipt_show_taxes'))
|
||||
if ($this->config->item('receipt_show_taxes'))
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
@@ -132,7 +132,7 @@
|
||||
<tr>
|
||||
</tr>
|
||||
|
||||
<?php $border = (!$this->Appconfig->get('receipt_show_taxes') && !($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)); ?>
|
||||
<?php $border = (!$this->config->item('receipt_show_taxes') && !($this->config->item('receipt_show_total_discount') && $discount > 0)); ?>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align:right;<?php echo $border? 'border-top: 2px solid black;' :''; ?>"><?php echo $this->lang->line('sales_total'); ?></td>
|
||||
<td style="text-align:right;<?php echo $border? 'border-top: 2px solid black;' :''; ?>"><?php echo to_currency($total); ?></td>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<div id="receipt_wrapper" style="width:100%;">
|
||||
<div id="receipt_header" style="text-align:center;">
|
||||
<?php
|
||||
if ($this->Appconfig->get('company_logo') != '')
|
||||
if ($this->config->item('company_logo') != '')
|
||||
{
|
||||
?>
|
||||
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->Appconfig->get('company_logo')); ?>" alt="company_logo" /></div>
|
||||
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->config->item('company_logo')); ?>" alt="company_logo" /></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@@ -50,11 +50,11 @@
|
||||
<td><?php echo ucfirst($item['name']); ?></td>
|
||||
<td><?php echo to_currency($item['price']); ?></td>
|
||||
<td><?php echo to_quantity_decimals($item['quantity']); ?></td>
|
||||
<td style="text-align:right;"><?php echo to_currency($item[($this->Appconfig->get('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
|
||||
<td style="text-align:right;"><?php echo to_currency($item[($this->config->item('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
if($this->Appconfig->get('receipt_show_description'))
|
||||
if($this->config->item('receipt_show_description'))
|
||||
{
|
||||
?>
|
||||
<td colspan="2"><?php echo $item['description']; ?></td>
|
||||
@@ -62,7 +62,7 @@
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if($this->Appconfig->get('receipt_show_serialnumber'))
|
||||
if($this->config->item('receipt_show_serialnumber'))
|
||||
{
|
||||
?>
|
||||
<td><?php echo $item['serialnumber']; ?></td>
|
||||
@@ -86,7 +86,7 @@
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)
|
||||
if ($this->config->item('receipt_show_total_discount') && $discount > 0)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
@@ -102,7 +102,7 @@
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($this->Appconfig->get('receipt_show_taxes'))
|
||||
if ($this->config->item('receipt_show_taxes'))
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
@@ -127,7 +127,7 @@
|
||||
<tr>
|
||||
</tr>
|
||||
|
||||
<?php $border = (!$this->Appconfig->get('receipt_show_taxes') && !($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)); ?>
|
||||
<?php $border = (!$this->config->item('receipt_show_taxes') && !($this->config->item('receipt_show_total_discount') && $discount > 0)); ?>
|
||||
<tr>
|
||||
<td colspan="3" style="<?php echo $border? 'border-top: 2px solid black;' :''; ?>text-align:right;"><?php echo $this->lang->line('sales_total'); ?></td>
|
||||
<td style="<?php echo $border? 'border-top: 2px solid black;' :''; ?>text-align:right"><?php echo to_currency($total); ?></td>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<div id="receipt_wrapper">
|
||||
<div id="receipt_header">
|
||||
<?php
|
||||
if ($this->Appconfig->get('company_logo') != '')
|
||||
if ($this->config->item('company_logo') != '')
|
||||
{
|
||||
?>
|
||||
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->Appconfig->get('company_logo')); ?>" alt="company_logo" /></div>
|
||||
<div id="company_name"><img id="image" src="<?php echo base_url('uploads/' . $this->config->item('company_logo')); ?>" alt="company_logo" /></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
@@ -56,11 +56,11 @@
|
||||
<tr>
|
||||
<td><?php echo to_currency($item['price']); ?></td>
|
||||
<td><?php echo to_quantity_decimals($item['quantity']); ?></td>
|
||||
<td class="total-value"><?php echo to_currency($item[($this->Appconfig->get('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
|
||||
<td class="total-value"><?php echo to_currency($item[($this->config->item('receipt_show_total_discount') ? 'total' : 'discounted_total')]); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php
|
||||
if($this->Appconfig->get('receipt_show_description'))
|
||||
if($this->config->item('receipt_show_description'))
|
||||
{
|
||||
?>
|
||||
<td colspan="2"><?php echo $item['description']; ?></td>
|
||||
@@ -68,7 +68,7 @@
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if($this->Appconfig->get('receipt_show_serialnumber'))
|
||||
if($this->config->item('receipt_show_serialnumber'))
|
||||
{
|
||||
?>
|
||||
<td><?php echo $item['serialnumber']; ?></td>
|
||||
@@ -92,7 +92,7 @@
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)
|
||||
if ($this->config->item('receipt_show_total_discount') && $discount > 0)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
@@ -108,7 +108,7 @@
|
||||
?>
|
||||
|
||||
<?php
|
||||
if ($this->Appconfig->get('receipt_show_taxes'))
|
||||
if ($this->config->item('receipt_show_taxes'))
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
@@ -133,7 +133,7 @@
|
||||
<tr>
|
||||
</tr>
|
||||
|
||||
<?php $border = (!$this->Appconfig->get('receipt_show_taxes') && !($this->Appconfig->get('receipt_show_total_discount') && $discount > 0)); ?>
|
||||
<?php $border = (!$this->config->item('receipt_show_taxes') && !($this->config->item('receipt_show_total_discount') && $discount > 0)); ?>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align:right;<?php echo $border? 'border-top: 2px solid black;' :''; ?>"><?php echo $this->lang->line('sales_total'); ?></td>
|
||||
<td style="text-align:right;<?php echo $border? 'border-top: 2px solid black;' :''; ?>"><?php echo to_currency($total); ?></td>
|
||||
|
||||
Reference in New Issue
Block a user