mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-24 16:28:40 -04:00
Small code optimisation: review for loops (#709)
This commit is contained in:
@@ -367,7 +367,8 @@ 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)
|
||||
$count = count($tax_percents);
|
||||
for ($k = 0; $k < $count; ++$k)
|
||||
{
|
||||
if(is_numeric($tax_percents[$k]))
|
||||
{
|
||||
@@ -520,8 +521,8 @@ class Items extends Secure_Controller
|
||||
$tax_names = $this->input->post('tax_names');
|
||||
$tax_percents = $this->input->post('tax_percents');
|
||||
$tax_updated = FALSE;
|
||||
|
||||
for($k = 0; $k < count($tax_percents); ++$k)
|
||||
$count = count($tax_percents);
|
||||
for ($k = 0; $k < $count; ++$k)
|
||||
{
|
||||
if(!empty($tax_names[$k]) && is_numeric($tax_percents[$k]))
|
||||
{
|
||||
@@ -658,7 +659,7 @@ class Items extends Secure_Controller
|
||||
|
||||
// array to store information if location got a quantity
|
||||
$allowed_locations = $this->Stock_location->get_allowed_locations();
|
||||
for($col = 24; $col < $cols; $col = $col + 2)
|
||||
for ($col = 24; $col < $cols; $col = $col + 2)
|
||||
{
|
||||
$location_id = $data[$col];
|
||||
if(array_key_exists($location_id, $allowed_locations))
|
||||
|
||||
@@ -740,7 +740,7 @@ class Reports extends Secure_Controller
|
||||
$data['specific_input_name'] = $this->lang->line('reports_discount');
|
||||
|
||||
$discounts = array();
|
||||
for($i = 0; $i <= 100; $i += 10)
|
||||
for ($i = 0; $i <= 100; $i += 10)
|
||||
{
|
||||
$discounts[$i] = $i . '%';
|
||||
}
|
||||
|
||||
@@ -752,7 +752,8 @@ 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)
|
||||
$number_of_payments = $this->input->post('number_of_payments');
|
||||
for ($i = 0; $i < $number_of_payments; ++$i)
|
||||
{
|
||||
$payment_amount = $this->input->post('payment_amount_' . $i);
|
||||
$payment_type = $this->input->post('payment_type_' . $i);
|
||||
|
||||
Reference in New Issue
Block a user