Fix incorrect function calls

- Fixed return type in function call to make it nullable.
- Added form helper to autoload since it's used in all the views.
- Fix typo in memory stored OSPOS settings reference.
This commit is contained in:
objecttothis
2023-02-10 22:07:52 +04:00
committed by Steve Ireland
parent 6e3af9184b
commit 9aec0b45ac
4 changed files with 10 additions and 8 deletions

View File

@@ -202,5 +202,7 @@ class Autoload extends AutoloadConfig
* @var string[]
* @phpstan-var list<string>
*/
public $helpers = [];
public $helpers = [
'form'
];
}

View File

@@ -381,8 +381,8 @@ function to_decimals(float $number, string $decimals = NULL, int $type = NumberF
}
$fmt = new NumberFormatter(config('OSPOS')->settings['number_locale'], $type);
$fmt->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, empty($decimals) ? DEFAULT_PRECISION : config('OSPOS')->settings['$decimals']);
$fmt->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, empty($decimals) ? DEFAULT_PRECISION : config('OSPOS')->settings['$decimals']);
$fmt->setAttribute(NumberFormatter::MIN_FRACTION_DIGITS, empty($decimals) ? DEFAULT_PRECISION : config('OSPOS')->settings[$decimals]);
$fmt->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, empty($decimals) ? DEFAULT_PRECISION : config('OSPOS')->settings[$decimals]);
if(empty(config('OSPOS')->settings['thousands_separator']))
{
@@ -592,4 +592,4 @@ function valid_date(string $date): bool //TODO: need a better name for $date. P
function valid_decimal(string $decimal): bool //TODO: need a better name for $decimal. Perhaps $candidate. Also the function name would be better as is_valid_decimal()
{
return (preg_match('/^(\d*\.)?\d+$/', $decimal) === 1);
}
}

View File

@@ -127,7 +127,7 @@ class Receiving_lib
$this->session->remove('recv_comment');
}
public function get_reference(): string
public function get_reference(): ?string
{
return $this->session->get('recv_reference');
}
@@ -423,4 +423,4 @@ class Receiving_lib
return $total;
}
}
}

View File

@@ -16,7 +16,7 @@
* @var array $payment_options
*/
?>
<?php echo view('partial/header') ?>
<?= view('partial/header') ?>
<?php
if (isset($error))
@@ -39,7 +39,7 @@ if (isset($success))
<!-- Top register controls -->
<?php echo form_open(esc("$controller_name/change_mode", 'attr'), ['id' => 'mode_form', 'class' => 'form-horizontal panel panel-default']) ?>
<?= form_open(esc("$controller_name/change_mode", 'attr'), ['id' => 'mode_form', 'class' => 'form-horizontal panel panel-default']) ?>
<div class="panel-body form-group">
<ul>
<li class="pull-left first_li">