mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-01-06 00:17:54 -05:00
Code style adjustments
This commit is contained in:
@@ -706,7 +706,7 @@ class Config extends Secure_Controller
|
||||
if($success && $delete_rejected)
|
||||
{
|
||||
$message = $this->lang->line('config_tax_category_used');
|
||||
$success = false;
|
||||
$success = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -126,7 +126,7 @@ class Customers extends Persons
|
||||
$data['packages'] = $packages;
|
||||
$data['selected_package'] = $info->package_id;
|
||||
|
||||
if ($customer_sales_tax_support == '1')
|
||||
if($customer_sales_tax_support == '1')
|
||||
{
|
||||
$data['customer_sales_tax_enabled'] = TRUE;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class Expenses_categories extends Secure_Controller
|
||||
{
|
||||
$expense_category_to_delete = $this->input->post('ids');
|
||||
|
||||
if ($this->Expense_category->delete_list($expense_category_to_delete))
|
||||
if($this->Expense_category->delete_list($expense_category_to_delete))
|
||||
{
|
||||
echo json_encode(array('success' => TRUE, 'message' => $this->lang->line('expenses_categories_successful_deleted') . ' ' . count($expense_category_to_delete) . ' ' . $this->lang->line('expenses_categories_one_or_multiple')));
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ class Item_kits extends Secure_Controller
|
||||
$success = TRUE;
|
||||
$new_item = FALSE;
|
||||
//New item kit
|
||||
if ($item_kit_id == -1)
|
||||
if($item_kit_id == -1)
|
||||
{
|
||||
$item_kit_id = $item_kit_data['item_kit_id'];
|
||||
$new_item = TRUE;
|
||||
|
||||
@@ -497,7 +497,7 @@ class Items extends Secure_Controller
|
||||
*/
|
||||
public function check_kit_exists()
|
||||
{
|
||||
if ($this->input->post('item_number') === -1)
|
||||
if($this->input->post('item_number') === -1)
|
||||
{
|
||||
$exists = $this->Item_kit->item_kit_exists_for_name($this->input->post('name'));
|
||||
}
|
||||
@@ -702,7 +702,8 @@ class Items extends Secure_Controller
|
||||
needs further discussion */
|
||||
|
||||
$pic_file = $data[24];
|
||||
/*if(strcmp('.htaccess', $pic_file)==0) {
|
||||
/*if(strcmp('.htaccess', $pic_file)==0)
|
||||
{
|
||||
$pic_file='';
|
||||
}*/
|
||||
$item_data['pic_filename'] = $pic_file;
|
||||
|
||||
@@ -148,7 +148,7 @@ class Receivings extends Secure_Controller
|
||||
}
|
||||
|
||||
$data['employees'] = array();
|
||||
foreach ($this->Employee->get_all()->result() as $employee)
|
||||
foreach($this->Employee->get_all()->result() as $employee)
|
||||
{
|
||||
$data['employees'][$employee->person_id] = $this->xss_clean($employee->first_name . ' '. $employee->last_name);
|
||||
}
|
||||
|
||||
@@ -1330,7 +1330,7 @@ class Reports extends Secure_Controller
|
||||
foreach($report_data['details'][$key] as $drow)
|
||||
{
|
||||
$quantity_purchased = $drow['receiving_quantity'] > 1 ? to_quantity_decimals($drow['quantity_purchased']) . ' x ' . to_quantity_decimals($drow['receiving_quantity']) : to_quantity_decimals($drow['quantity_purchased']);
|
||||
if ($show_locations)
|
||||
if($show_locations)
|
||||
{
|
||||
$quantity_purchased .= ' [' . $this->Stock_location->get_location_name($drow['item_location']) . ']';
|
||||
}
|
||||
|
||||
@@ -576,7 +576,8 @@ class Sales extends Secure_Controller
|
||||
$candidate_invoice_number = $invoice_number;
|
||||
if($candidate_invoice_number != NULL && strlen($candidate_invoice_number) > 3)
|
||||
{
|
||||
if (strpos($candidate_invoice_number, '{') == false) {
|
||||
if(strpos($candidate_invoice_number, '{') == FALSE)
|
||||
{
|
||||
$override_invoice_number = $candidate_invoice_number;
|
||||
}
|
||||
}
|
||||
@@ -605,7 +606,7 @@ class Sales extends Secure_Controller
|
||||
$invoice_format = $this->config->item('sales_invoice_format');
|
||||
}
|
||||
|
||||
if ($override_invoice_number == NULL)
|
||||
if($override_invoice_number == NULL)
|
||||
{
|
||||
$invoice_number = $this->token_lib->render($invoice_format);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ class Taxes extends Secure_Controller
|
||||
$data['rounding_options'] = Rounding_mode::get_rounding_options();
|
||||
$data['html_rounding_options'] = $this->get_html_rounding_options();
|
||||
|
||||
if ($tax_code == -1)
|
||||
if($tax_code == -1)
|
||||
{
|
||||
$data['tax_code'] = '';
|
||||
$data['tax_code_name'] = '';
|
||||
@@ -170,7 +170,7 @@ class Taxes extends Secure_Controller
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($tax_code_rate_exceptions))
|
||||
if(!empty($tax_code_rate_exceptions))
|
||||
{
|
||||
$success = $this->Tax->save_tax_rate_exceptions($tax_code_rate_exceptions, $entered_tax_code);
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ function parse_decimals($number)
|
||||
|
||||
$fmt->setAttribute(\NumberFormatter::FRACTION_DIGITS, $config->item('currency_decimals'));
|
||||
|
||||
if (empty($config->item('thousands_separator')))
|
||||
if(empty($config->item('thousands_separator')))
|
||||
{
|
||||
$fmt->setAttribute(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '');
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ function get_item_data_row($item)
|
||||
$controller_name = strtolower(get_class($CI));
|
||||
|
||||
$image = NULL;
|
||||
if ($item->pic_filename != '')
|
||||
if($item->pic_filename != '')
|
||||
{
|
||||
$ext = pathinfo($item->pic_filename, PATHINFO_EXTENSION);
|
||||
if($ext == '')
|
||||
@@ -368,7 +368,7 @@ function get_item_data_row($item)
|
||||
$images = glob('./uploads/item_pics/' . $item->pic_filename);
|
||||
}
|
||||
|
||||
if (sizeof($images) > 0)
|
||||
if(sizeof($images) > 0)
|
||||
{
|
||||
$image .= '<a class="rollover" href="'. base_url($images[0]) .'"><img src="'.site_url('items/pic_thumb/' . pathinfo($images[0], PATHINFO_BASENAME)) . '"></a>';
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ function load_config()
|
||||
if(!empty(current_language()))
|
||||
{
|
||||
// fallback to English if language folder does not exist
|
||||
if (!file_exists('../application/language/' . current_language_code()))
|
||||
if(!file_exists('../application/language/' . current_language_code()))
|
||||
{
|
||||
$CI->config->set_item('language', 'english');
|
||||
$CI->config->set_item('language_code', 'en-US');
|
||||
|
||||
@@ -79,6 +79,7 @@ class Barcode_lib
|
||||
{
|
||||
$barcode_type = $this->CI->config->item('barcode_type');
|
||||
$barcode_instance = $this->get_barcode_instance($barcode_type);
|
||||
|
||||
return $barcode_instance->validate($barcode);
|
||||
}
|
||||
|
||||
@@ -88,7 +89,7 @@ class Barcode_lib
|
||||
$is_valid = empty($item['item_number']) && $barcode_config['barcode_generate_if_empty'] || $barcode_instance->validate($item['item_number']);
|
||||
|
||||
// if barcode validation does not succeed,
|
||||
if (!$is_valid)
|
||||
if(!$is_valid)
|
||||
{
|
||||
$barcode_instance = Barcode_lib::get_barcode_instance();
|
||||
}
|
||||
@@ -125,13 +126,13 @@ class Barcode_lib
|
||||
{
|
||||
$seed = $barcode_config['barcode_content'] !== "id" && !empty($item['item_number']) ? $item['item_number'] : $item['item_id'];
|
||||
|
||||
if( $barcode_config['barcode_content'] !== "id" && !empty($item['item_number']))
|
||||
if($barcode_config['barcode_content'] !== "id" && !empty($item['item_number']))
|
||||
{
|
||||
$seed = $item['item_number'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($barcode_config['barcode_generate_if_empty'])
|
||||
if($barcode_config['barcode_generate_if_empty'])
|
||||
{
|
||||
// generate barcode with the correct instance
|
||||
$seed = $barcode_instance->generate($seed);
|
||||
@@ -234,9 +235,9 @@ class Barcode_lib
|
||||
{
|
||||
$array = array();
|
||||
|
||||
if (($handle = opendir($folder)) !== FALSE)
|
||||
if(($handle = opendir($folder)) !== FALSE)
|
||||
{
|
||||
while (($file = readdir($handle)) !== FALSE)
|
||||
while(($file = readdir($handle)) !== FALSE)
|
||||
{
|
||||
if(substr($file, -4, 4) === '.ttf')
|
||||
{
|
||||
|
||||
@@ -999,7 +999,8 @@ class Sale_lib
|
||||
$this->CI->session->set_userdata('sale_id', $sale_id);
|
||||
}
|
||||
|
||||
public function get_sale_id() {
|
||||
public function get_sale_id()
|
||||
{
|
||||
return $this->CI->session->userdata('sale_id');
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ class Tax_lib
|
||||
$rounding_code = $sales_tax['rounding_code'];
|
||||
$rounded_sale_tax_amount = $sale_tax_amount;
|
||||
|
||||
if ($rounding_code == Rounding_mode::HALF_UP)
|
||||
if($rounding_code == Rounding_mode::HALF_UP)
|
||||
{
|
||||
$rounded_sale_tax_amount = round($sale_tax_amount, $decimals, PHP_ROUND_HALF_UP);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ class Token_lib
|
||||
*/
|
||||
public function render($tokened_text, $tokens = array())
|
||||
{
|
||||
|
||||
// Apply the transformation for the "%" tokens if any are used
|
||||
if(strpos($tokened_text, '%') !== FALSE)
|
||||
{
|
||||
@@ -58,20 +57,21 @@ class Token_lib
|
||||
{
|
||||
// Matches tokens with the following pattern: [$token:$length]
|
||||
preg_match_all('/
|
||||
\{ # [ - pattern start
|
||||
([^\s\{\}:]+) # match $token not containing whitespace : { or }
|
||||
(?:
|
||||
: # : - separator
|
||||
([^\s\{\}:]+) # match $length not containing whitespace : { or }
|
||||
)?
|
||||
\} # ] - pattern end
|
||||
/x', $text, $matches);
|
||||
\{ # [ - pattern start
|
||||
([^\s\{\}:]+) # match $token not containing whitespace : { or }
|
||||
(?:
|
||||
: # : - separator
|
||||
([^\s\{\}:]+) # match $length not containing whitespace : { or }
|
||||
)?
|
||||
\} # ] - pattern end
|
||||
/x', $text, $matches);
|
||||
|
||||
$tokens = $matches[1];
|
||||
$lengths = $matches[2];
|
||||
|
||||
$token_tree = array();
|
||||
for($i = 0; $i < count($tokens); $i++) {
|
||||
for($i = 0; $i < count($tokens); $i++)
|
||||
{
|
||||
$token_tree[$tokens[$i]][$lengths[$i]] = $matches[0][$i];
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ abstract class Token
|
||||
|
||||
function replace($text)
|
||||
{
|
||||
if (strstr($text, $this->token_id()))
|
||||
if(strstr($text, $this->token_id()))
|
||||
{
|
||||
return str_replace($this->token_id(), $this->get_value(), $text);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ class Token_customer extends Token
|
||||
{
|
||||
// substitute customer info
|
||||
$customer_id = $this->CI->sale_lib->get_customer();
|
||||
if ($customer_id != -1 && empty($this->customer_info))
|
||||
if($customer_id != -1 && empty($this->customer_info))
|
||||
{
|
||||
$customer_info = $this->CI->Customer->get_info($customer_id);
|
||||
if($customer_info != '')
|
||||
|
||||
@@ -352,7 +352,7 @@ class Customer extends Person
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
{
|
||||
return $this->db->get()->row_array()['count'];
|
||||
return $this->db->get()->row()->count;
|
||||
}
|
||||
|
||||
$this->db->order_by($sort, $order);
|
||||
|
||||
@@ -288,7 +288,7 @@ class Employee extends Person
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
{
|
||||
return $this->db->get()->row_array()['count'];
|
||||
return $this->db->get()->row()->count;
|
||||
}
|
||||
|
||||
$this->db->order_by($sort, $order);
|
||||
@@ -422,7 +422,7 @@ class Employee extends Person
|
||||
$row = $this->db->get()->row();
|
||||
|
||||
// If no grants are assigned yet then set the default to 'home'
|
||||
if ($row == NULL)
|
||||
if($row == NULL)
|
||||
{
|
||||
return 'home';
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class Expense extends CI_Model
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
{
|
||||
return $this->db->get()->row_array()['count'];
|
||||
return $this->db->get()->row()->count;
|
||||
}
|
||||
|
||||
$this->db->group_by('expense_id');
|
||||
|
||||
@@ -151,7 +151,7 @@ class Expense_category extends CI_Model
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
{
|
||||
return $this->db->get()->row_array()['count'];
|
||||
return $this->db->get()->row()->count;
|
||||
}
|
||||
|
||||
$this->db->order_by($sort, $order);
|
||||
|
||||
@@ -231,7 +231,7 @@ class Giftcard extends CI_Model
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
{
|
||||
return $this->db->get()->row_array()['count'];
|
||||
return $this->db->get()->row()->count;
|
||||
}
|
||||
|
||||
$this->db->order_by($sort, $order);
|
||||
|
||||
@@ -29,7 +29,7 @@ class Inventory extends CI_Model
|
||||
$inventory_sums = $this->Inventory->get_inventory_sum($item_id);
|
||||
foreach($inventory_sums as $inventory_sum)
|
||||
{
|
||||
if ($inventory_sum['sum'] > 0)
|
||||
if($inventory_sum['sum'] > 0)
|
||||
{
|
||||
return $this->Inventory->insert(array(
|
||||
'trans_inventory' => -1 * $inventory_sum['sum'],
|
||||
|
||||
@@ -229,7 +229,7 @@ class Item extends CI_Model
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
{
|
||||
return $this->db->get()->row_array()['count'];
|
||||
return $this->db->get()->row()->count;
|
||||
}
|
||||
|
||||
// avoid duplicated entries with same name because of inventory reporting multiple changes on the same item in the same date range
|
||||
|
||||
@@ -231,7 +231,7 @@ class Item_kit extends CI_Model
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
{
|
||||
return $this->db->get()->row_array()['count'];
|
||||
return $this->db->get()->row()->count;
|
||||
}
|
||||
|
||||
$this->db->order_by($sort, $order);
|
||||
|
||||
@@ -47,8 +47,10 @@ class Item_kit_items extends CI_Model
|
||||
|
||||
$this->delete($item_kit_id);
|
||||
|
||||
if ($item_kit_items_data != NULL) {
|
||||
foreach ($item_kit_items_data as $row) {
|
||||
if($item_kit_items_data != NULL)
|
||||
{
|
||||
foreach($item_kit_items_data as $row)
|
||||
{
|
||||
$row['item_kit_id'] = $item_kit_id;
|
||||
$success &= $this->db->insert('item_kit_items', $row);
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ class Sale extends CI_Model
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
{
|
||||
return $this->db->get()->row_array()['count'];
|
||||
return $this->db->get()->row()->count;
|
||||
}
|
||||
|
||||
$this->db->group_by('sales.sale_id');
|
||||
@@ -301,7 +301,7 @@ class Sale extends CI_Model
|
||||
public function get_payments_summary($search, $filters)
|
||||
{
|
||||
// get payment summary
|
||||
$this->db->select('payment_type, count(payment_amount) AS count, SUM(payment_amount) AS payment_amount');
|
||||
$this->db->select('payment_type, COUNT(payment_amount) AS count, SUM(payment_amount) AS payment_amount');
|
||||
$this->db->from('sales AS sales');
|
||||
$this->db->join('sales_payments', 'sales_payments.sale_id = sales.sale_id');
|
||||
$this->db->join('people AS customer_p', 'sales.customer_id = customer_p.person_id', 'LEFT');
|
||||
@@ -874,7 +874,8 @@ class Sale extends CI_Model
|
||||
{
|
||||
$cur_item_info = $this->Item->get_info($item['item_id']);
|
||||
|
||||
if($cur_item_info->stock_type == HAS_STOCK) {
|
||||
if($cur_item_info->stock_type == HAS_STOCK)
|
||||
{
|
||||
// create query to update inventory tracking
|
||||
$inv_data = array(
|
||||
'trans_date' => date('Y-m-d H:i:s'),
|
||||
|
||||
@@ -261,7 +261,7 @@ class Supplier extends Person
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
{
|
||||
return $this->db->get()->row_array()['count'];
|
||||
return $this->db->get()->row()->count;
|
||||
}
|
||||
|
||||
$this->db->order_by($sort, $order);
|
||||
|
||||
@@ -326,7 +326,7 @@ class Tax extends CI_Model
|
||||
// get_found_rows case
|
||||
if($count_only == TRUE)
|
||||
{
|
||||
return $this->db->get()->row_array()['count'];
|
||||
return $this->db->get()->row()->count;
|
||||
}
|
||||
|
||||
$this->db->order_by($sort, $order);
|
||||
@@ -341,7 +341,7 @@ class Tax extends CI_Model
|
||||
|
||||
public function get_tax_code_type_name($tax_code_type)
|
||||
{
|
||||
if ($tax_code_type == '0')
|
||||
if($tax_code_type == '0')
|
||||
{
|
||||
return $this->lang->line('taxes_sales_tax');
|
||||
}
|
||||
@@ -356,7 +356,7 @@ class Tax extends CI_Model
|
||||
$suggestions = array();
|
||||
|
||||
$this->db->from('tax_codes');
|
||||
if (!empty($search))
|
||||
if(!empty($search))
|
||||
{
|
||||
$this->db->like('tax_code', $search);
|
||||
$this->db->or_like('tax_code_name', $search);
|
||||
@@ -383,7 +383,7 @@ class Tax extends CI_Model
|
||||
|
||||
$this->db->from('tax_categories');
|
||||
$this->db->where('tax_category_id !=', 1);
|
||||
if (!empty($search))
|
||||
if(!empty($search))
|
||||
{
|
||||
$this->db->like('tax_category', '%'.$search.'%');
|
||||
}
|
||||
|
||||
@@ -16,10 +16,12 @@ class Rounding_mode
|
||||
$CI->load->helper('language');
|
||||
$class = new ReflectionClass(__CLASS__);
|
||||
$result = array();
|
||||
|
||||
foreach($class->getConstants() as $key => $value)
|
||||
{
|
||||
$result[$value] = lang(strtolower('ENUM_'. $key));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -41,10 +43,12 @@ class Rounding_mode
|
||||
$CI =& get_instance();
|
||||
$CI->load->helper('language');
|
||||
$x = '';
|
||||
foreach (Rounding_mode::get_rounding_options() as $option => $label)
|
||||
|
||||
foreach(Rounding_mode::get_rounding_options() as $option => $label)
|
||||
{
|
||||
$x .= "<option value='$option'>".$label."</option>";
|
||||
}
|
||||
|
||||
return $x;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user