mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-07-17 02:12:43 -04:00
Code style adjustments
This commit is contained in:
@@ -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 != '')
|
||||
|
||||
Reference in New Issue
Block a user