mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-15 12:32:33 -04:00
Small code optimisation: pre increment is faster than post increment (#709)
This commit is contained in:
@@ -229,7 +229,7 @@ class Customers extends Persons
|
||||
$failCodes[] = $i;
|
||||
}
|
||||
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
if(count($failCodes) > 0)
|
||||
|
||||
@@ -367,7 +367,7 @@ class Items extends Secure_Controller
|
||||
$items_taxes_data = array();
|
||||
$tax_names = $this->input->post('tax_names');
|
||||
$tax_percents = $this->input->post('tax_percents');
|
||||
for($k = 0; $k < count($tax_percents); $k++)
|
||||
for($k = 0; $k < count($tax_percents); ++$k)
|
||||
{
|
||||
if(is_numeric($tax_percents[$k]))
|
||||
{
|
||||
@@ -521,7 +521,7 @@ class Items extends Secure_Controller
|
||||
$tax_percents = $this->input->post('tax_percents');
|
||||
$tax_updated = FALSE;
|
||||
|
||||
for($k = 0; $k < count($tax_percents); $k++)
|
||||
for($k = 0; $k < count($tax_percents); ++$k)
|
||||
{
|
||||
if(!empty($tax_names[$k]) && is_numeric($tax_percents[$k]))
|
||||
{
|
||||
@@ -713,7 +713,7 @@ class Items extends Secure_Controller
|
||||
$failCodes[] = $i;
|
||||
}
|
||||
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
if(count($failCodes) > 0)
|
||||
|
||||
@@ -752,7 +752,7 @@ class Sales extends Secure_Controller
|
||||
|
||||
// go through all the payment type input from the form, make sure the form matches the name and iterator number
|
||||
$payments = array();
|
||||
for($i = 0; $i < $this->input->post('number_of_payments'); $i++)
|
||||
for($i = 0; $i < $this->input->post('number_of_payments'); ++$i)
|
||||
{
|
||||
$payment_amount = $this->input->post('payment_amount_' . $i);
|
||||
$payment_type = $this->input->post('payment_type_' . $i);
|
||||
|
||||
@@ -65,7 +65,7 @@ class MY_Lang extends CI_Lang
|
||||
foreach ($args as $arg)
|
||||
{
|
||||
$line = preg_replace('/\%'.$i.'/', $arg, $line);
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ class Ean13 extends BarcodeBase
|
||||
// Weight for a digit in the checksum is 3, 1, 3.. starting from the last digit.
|
||||
// loop backwards to make the loop length-agnostic. The same basic functionality
|
||||
// will work for codes of different lengths.
|
||||
for ($i = strlen($number) - 1; $i >= 0; $i--)
|
||||
for ($i = strlen($number) - 1; $i >= 0; --$i)
|
||||
{
|
||||
$sum += (int)$number[$i] * ($weightflag?3:1);
|
||||
$weightflag = !$weightflag;
|
||||
@@ -261,7 +261,7 @@ class Ean13 extends BarcodeBase
|
||||
// Draw left $this->data contents
|
||||
$set_array = $this->_codingmapleft[$key];
|
||||
|
||||
for ($idx = 1; $idx < 7; $idx ++)
|
||||
for ($idx = 1; $idx < 7; ++$idx)
|
||||
{
|
||||
$value = substr($this->data, $idx, 1);
|
||||
|
||||
@@ -318,7 +318,7 @@ class Ean13 extends BarcodeBase
|
||||
$xpos += $pxPerBar;
|
||||
|
||||
// Draw right $this->data contents
|
||||
for ($idx = 7; $idx < 13; $idx ++)
|
||||
for ($idx = 7; $idx < 13; ++$idx)
|
||||
{
|
||||
$value = substr($this->data, $idx, 1);
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ class Ean8 extends BarcodeBase
|
||||
foreach($weights as $num) {
|
||||
|
||||
$sum += $num * $ean{$i};
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
|
||||
if( (($sum + $chk) % 10) == 0 )
|
||||
@@ -260,7 +260,7 @@ class Ean8 extends BarcodeBase
|
||||
|
||||
$xpos += $pxPerBar;
|
||||
|
||||
for ($idx = 0; $idx < 4; $idx ++)
|
||||
for ($idx = 0; $idx < 4; ++$idx)
|
||||
{
|
||||
$value = substr($this->data, $idx, 1);
|
||||
|
||||
@@ -317,7 +317,7 @@ class Ean8 extends BarcodeBase
|
||||
$xpos += $pxPerBar;
|
||||
|
||||
// Draw right $this->data contents
|
||||
for ($idx = 4; $idx < 8; $idx ++)
|
||||
for ($idx = 4; $idx < 8; ++$idx)
|
||||
{
|
||||
$value = substr($this->data, $idx, 1);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
echo '</tr><tr>';
|
||||
}
|
||||
echo '<td>' . $this->barcode_lib->display_barcode($item, $barcode_config) . '</td>';
|
||||
$count++;
|
||||
++$count;
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
</div>
|
||||
|
||||
<?php
|
||||
for ($i = 1; $i <= 10; $i++)
|
||||
for ($i = 1; $i <= 10; ++$i)
|
||||
{
|
||||
?>
|
||||
<?php
|
||||
@@ -294,7 +294,7 @@
|
||||
var no_op = function(event, data, formatted){};
|
||||
$("#category").autocomplete({source: "<?php echo site_url('items/suggest_category');?>",delay:10,appendTo: '.modal-content'});
|
||||
|
||||
<?php for ($i = 1; $i <= 10; $i++)
|
||||
<?php for ($i = 1; $i <= 10; ++$i)
|
||||
{
|
||||
?>
|
||||
$("#custom"+<?php echo $i; ?>).autocomplete({
|
||||
|
||||
@@ -5,7 +5,7 @@ foreach($stock_locations as $location=>$location_data)
|
||||
{
|
||||
$location_id = $location_data['location_id'];
|
||||
$location_name = $location_data['location_name'];
|
||||
$i++;
|
||||
++$i;
|
||||
?>
|
||||
<div class="form-group form-group-sm" style="<?php echo $location_data['deleted'] ? 'display:none;' : 'display:block;' ?>">
|
||||
<?php echo form_label($this->lang->line('config_stock_location') . ' ' . $i, 'stock_location_' . $i, array('class'=>'required control-label col-xs-2')); ?>
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$i++;
|
||||
++$i;
|
||||
}
|
||||
echo form_hidden('number_of_payments', $i);
|
||||
?>
|
||||
|
||||
@@ -222,7 +222,7 @@ if (isset($success))
|
||||
</tr>
|
||||
<?php echo form_close(); ?>
|
||||
<?php
|
||||
$tabindex++;
|
||||
++$tabindex;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user