mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-16 04:50:09 -04:00
Compatibility changes
- Removed `mixed` function return type from some functions for backward compatibility with php 7.4 - Refactored string concatination for readability. - Added TODO for later - Corrected PHPdocs - Removed unneeded TODO - Refactored function names with mixed snake and pascal case names
This commit is contained in:
@@ -94,7 +94,7 @@ class Receivings extends Secure_Controller
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function change_mode(): void
|
||||
public function postChangeMode(): void
|
||||
{
|
||||
$stock_destination = $this->request->getPost('stock_destination', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||
$stock_source = $this->request->getPost('stock_source', FILTER_SANITIZE_NUMBER_INT);
|
||||
|
||||
@@ -213,9 +213,12 @@ class Sales extends Secure_Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the sale mode in the register to carry out different types of sales
|
||||
*
|
||||
* @return void
|
||||
* @noinspection PhpUnused
|
||||
*/
|
||||
public function postChange_mode(): void
|
||||
public function postChangeMode(): void
|
||||
{
|
||||
$mode = $this->request->getPost('mode', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
||||
$this->sale_lib->set_mode($mode);
|
||||
@@ -259,7 +262,9 @@ class Sales extends Secure_Controller
|
||||
|
||||
if(!$stock_location || $stock_location == $this->sale_lib->get_sale_location())
|
||||
{
|
||||
//TODO: This has an empty body. What to do here?
|
||||
//TODO: The code below was removed in 2017 by @steveireland. We either need to reinstate some of it or remove this entire if block but we can't leave an empty if block
|
||||
// $dinner_table = $this->request->getPost('dinner_table');
|
||||
// $this->sale_lib->set_dinner_table($dinner_table);
|
||||
}
|
||||
elseif($this->stock_location->is_allowed_location($stock_location, 'sales'))
|
||||
{
|
||||
|
||||
@@ -45,8 +45,11 @@ class Migration_database_optimizations extends Migration
|
||||
$builder = $this->db->table('attribute_values');
|
||||
$builder->delete(['attribute_id' => $attribute_value['attribute_id']]);
|
||||
|
||||
$query = 'SELECT links.definition_id, links.item_id, links.attribute_id, defs.definition_type FROM ospos_attribute_links links JOIN ospos_attribute_definitions defs ON defs.definition_id = links.definition_id where attribute_id = ';
|
||||
$query .= $attribute_value['attribute_id'];
|
||||
//TODO: This should be converted to using CI4 QueryBuilder
|
||||
$query = 'SELECT links.definition_id, links.item_id, links.attribute_id, defs.definition_type'
|
||||
. ' FROM ospos_attribute_links links'
|
||||
. ' JOIN ospos_attribute_definitions defs ON defs.definition_id = links.definition_id'
|
||||
. ' WHERE attribute_id = ' . $attribute_value['attribute_id'];
|
||||
$attribute_links = $this->db->query($query);
|
||||
|
||||
$builder = $this->db->table('attribute_links');
|
||||
|
||||
@@ -482,7 +482,7 @@ function parse_tax(string $number)
|
||||
* @param int|null $decimals
|
||||
* @return false|float|int|mixed|string
|
||||
*/
|
||||
function parse_decimals(string $number, int $decimals = null): mixed
|
||||
function parse_decimals(string $number, int $decimals = null)
|
||||
{
|
||||
if(empty($number))
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ class Barcode_lib
|
||||
/**
|
||||
* @param array $item
|
||||
* @param array $barcode_config
|
||||
* @return object|Code128|Code39|Ean13|Ean8
|
||||
* @return object
|
||||
*/
|
||||
public static function barcode_instance(array $item, array $barcode_config): object
|
||||
{
|
||||
@@ -84,7 +84,7 @@ class Barcode_lib
|
||||
|
||||
/**
|
||||
* @param string $barcode_type
|
||||
* @return Code128|Code39|Ean13|Ean8
|
||||
* @return object
|
||||
*/
|
||||
private static function get_barcode_instance(string $barcode_type = 'Code128'): object
|
||||
{
|
||||
|
||||
@@ -66,9 +66,7 @@ abstract class BarcodeBase
|
||||
/**
|
||||
* Get the data
|
||||
*
|
||||
* @param mixed data - (int or string) Data to be encoded
|
||||
* @return instance of \emberlabs\Barcode\BarcodeInterface
|
||||
* @throws OverflowException
|
||||
* @return BarcodeInterface
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
|
||||
@@ -653,7 +653,7 @@ class Attribute extends Model
|
||||
/**
|
||||
* @param int $item_id
|
||||
* @param int|null $definition_id
|
||||
* @return object|stdClass|null
|
||||
* @return object|null
|
||||
*/
|
||||
public function get_link_value(int $item_id, ?int $definition_id): ?object
|
||||
{
|
||||
@@ -712,7 +712,7 @@ class Attribute extends Model
|
||||
/**
|
||||
* @param int $item_id
|
||||
* @param int $definition_id
|
||||
* @return object|array|stdClass|null
|
||||
* @return object|null
|
||||
*/
|
||||
public function get_attribute_value(int $item_id, int $definition_id): ?object
|
||||
{
|
||||
|
||||
@@ -77,15 +77,16 @@ class Inventory extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ReflectionException
|
||||
* @param int $item_id ID number for the item to have quantity reset.
|
||||
* @return bool|int|string The row id of the inventory table on insert or false on failure
|
||||
*/
|
||||
public function reset_quantity(int $item_id): bool
|
||||
public function reset_quantity(int $item_id)
|
||||
{
|
||||
$inventory_sums = $this->get_inventory_sum($item_id);
|
||||
foreach($inventory_sums as $inventory_sum)
|
||||
{
|
||||
if($inventory_sum['sum'] > 0)
|
||||
{//TODO: Reflection Exception
|
||||
{
|
||||
$employee = model(Employee::class);
|
||||
|
||||
return $this->insert([
|
||||
|
||||
@@ -282,7 +282,7 @@ class Receiving extends Model
|
||||
|
||||
/**
|
||||
* @param int $receiving_id
|
||||
* @return object|array|\stdClass|null
|
||||
* @return object
|
||||
*/
|
||||
public function get_supplier(int $receiving_id): object
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ if (isset($success))
|
||||
|
||||
<!-- Top register controls -->
|
||||
|
||||
<?= form_open(esc("$controller_name/change_mode"), ['id' => 'mode_form', 'class' => 'form-horizontal panel panel-default']) ?>
|
||||
<?= form_open(esc("$controller_name/changeMode"), ['id' => 'mode_form', 'class' => 'form-horizontal panel panel-default']) ?>
|
||||
<div class="panel-body form-group">
|
||||
<ul>
|
||||
<li class="pull-left first_li">
|
||||
|
||||
@@ -64,7 +64,7 @@ if(isset($success))
|
||||
<div id="register_wrapper">
|
||||
|
||||
<!-- Top register controls -->
|
||||
<?= form_open(esc("$controller_name/change_mode"), ['id' => 'mode_form', 'class' => 'form-horizontal panel panel-default']) ?>
|
||||
<?= form_open(esc("$controller_name/changeMode"), ['id' => 'mode_form', 'class' => 'form-horizontal panel panel-default']) ?>
|
||||
<div class="panel-body form-group">
|
||||
<ul>
|
||||
<li class="pull-left first_li">
|
||||
|
||||
Reference in New Issue
Block a user