In Token_lib change App\Models\tokens\Token to App\Models\Tokens\Toke

This commit is contained in:
Steve Ireland
2023-05-30 20:58:55 -04:00
committed by jekkos
parent 24539101d2
commit 477ceb2317
8 changed files with 47 additions and 30 deletions

View File

@@ -153,14 +153,14 @@ class Item_kits extends Secure_Controller
public function postSave(int $item_kit_id = NEW_ENTRY): void
{
$item_kit_data = [
'name' => $this->request->getPost('name', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'item_kit_number' => $this->request->getPost('item_kit_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS),
'item_id' => $this->request->getPost('kit_item_id', FILTER_SANITIZE_NUMBER_INT),
'kit_discount' => $this->request->getPost('kit_discount', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION),
'kit_discount_type' => $this->request->getPost('kit_discount_type') == NULL ? PERCENT : $this->request->getPost('kit_discount_type', FILTER_SANITIZE_NUMBER_INT),
'price_option' => $this->request->getPost('price_option', FILTER_SANITIZE_NUMBER_INT),
'print_option' => $this->request->getPost('print_option', FILTER_SANITIZE_NUMBER_INT),
'description' => $this->request->getPost('description', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
'name' => $this->request->getPost('name'),
'item_kit_number' => $this->request->getPost('item_kit_number'),
'item_id' => empty($this->request->getPost('kit_item_id')) ? NULL : intval($this->request->getPost('kit_item_id')),
'kit_discount' => parse_decimals($this->request->getPost('kit_discount')),
'kit_discount_type' => $this->request->getPost('kit_discount_type') === NULL ? PERCENT : intval($this->request->getPost('kit_discount_type')),
'price_option' => $this->request->getPost('price_option') === NULL ? PRICE_ALL : intval($this->request->getPost('price_option')),
'print_option' => $this->request->getPost('print_option') === NULL ? PRINT_ALL : intval($this->request->getPost('print_option')),
'description' => $this->request->getPost('description')
];
if($this->item_kit->save_value($item_kit_data, $item_kit_id))
@@ -173,22 +173,29 @@ class Item_kits extends Secure_Controller
$new_item = TRUE;
}
if($this->request->getPost('item_kit_qty', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) != NULL)
$item_kit_items_array = $this->request->getPost('item_kit_qty') === NULL ? NULL : $this->request->getPost('item_kit_qty');
if($item_kit_items_array != NULL)
{
$item_kit_items = [];
foreach($this->request->getPost('item_kit_qty', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) as $item_id => $quantity)
foreach($item_kit_items_array as $item_id => $item_kit_qty)
{
$seq = $this->request->getPost("item_kit_seq[$item_id]", FILTER_SANITIZE_NUMBER_INT);
$item_kit_items[] = [
'item_id' => $item_id,
'quantity' => $quantity,
'kit_sequence' => $seq
'quantity' => $item_kit_qty === NULL ? 0 : parse_quantity($item_kit_qty),
'kit_sequence' => $this->request->getPost("item_kit_seq[$item_id]") === NULL ? 0 : intval($this->request->getPost("item_kit_seq[$item_id]"))
];
}
}
$success = $this->item_kit_items->save_value($item_kit_items, $item_kit_id);
if (!empty($item_kit_items))
{
$success = $this->item_kit_items->save_value($item_kit_items, $item_kit_id);
}
else
{
$success = TRUE;
}
if($new_item)
{
@@ -235,7 +242,7 @@ class Item_kits extends Secure_Controller
}
}
public function check_item_number(): void
public function postCheckItemNumber(): void
{
$exists = $this->item_kit->item_number_exists($this->request->getPost('item_kit_number', FILTER_SANITIZE_FULL_SPECIAL_CHARS), $this->request->getPost('item_kit_id', FILTER_SANITIZE_NUMBER_INT));
echo !$exists ? 'true' : 'false';

View File

@@ -187,9 +187,9 @@ class Items extends Secure_Controller
echo json_encode($suggestions);
}
public function suggest(): void
public function getSuggest(): void
{
$suggestions = $this->item->get_search_suggestions($this->request->getPostGet('term'), ['search_custom' => FALSE, 'is_deleted' => FALSE], TRUE);
$suggestions = $this->item->get_search_suggestions($this->request->getGet('term'), ['search_custom' => FALSE, 'is_deleted' => FALSE], TRUE);
echo json_encode($suggestions);
}
@@ -201,9 +201,9 @@ class Items extends Secure_Controller
echo json_encode($suggestions);
}
public function suggest_kits(): void
public function getSuggestKits(): void
{
$suggestions = $this->item->get_kit_search_suggestions($this->request->getPostGet('term'), ['search_custom' => FALSE, 'is_deleted' => FALSE], TRUE);
$suggestions = $this->item->get_kit_search_suggestions($this->request->getGet('term'), ['search_custom' => FALSE, 'is_deleted' => FALSE], TRUE);
echo json_encode($suggestions);
}

View File

@@ -80,6 +80,11 @@ class Reports extends Secure_Controller
helper('report');
}
public function index(): void
{
$this->getIndex();
}
//Initial Report listing screen
public function getIndex(): void
{
@@ -1662,7 +1667,7 @@ class Reports extends Secure_Controller
return $sale_type_options;
}
public function detailed_sales(string $start_date, string $end_date, string $sale_type, string $location_id = 'all'): void
public function getDetailed_sales(string $start_date, string $end_date, string $sale_type, string $location_id = 'all'): void
{
$this->clearCache();

View File

@@ -384,7 +384,7 @@ function to_decimals(?float $number, string $decimals = NULL, int $type = Number
if(empty($config['thousands_separator']))
{
$fmt->setAttribute(NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '');
$fmt->setTextAttribute(NumberFormatter::GROUPING_SEPARATOR_SYMBOL, '');
}
$fmt->setSymbol(NumberFormatter::CURRENCY_SYMBOL, $config['currency_symbol']);

View File

@@ -14,7 +14,7 @@ use App\Models\Employee;
*/
function show_report_if_allowed(string $report_prefix, string $report_name, int $person_id, string $permission_id = ''): void
{
$permission_id = empty($permission_id) ? 'reports_' . $report_name : $permission_id; //TODO: Use String Interpolation here.
$permission_id = empty($permission_id) ? $report_name : $permission_id; //TODO: Use String Interpolation here.
$employee = model(Employee::class);
if($employee->has_grant($permission_id, $person_id))
@@ -25,9 +25,14 @@ function show_report_if_allowed(string $report_prefix, string $report_name, int
function show_report(string $report_prefix, string $report_name, string $lang_key = ''): void
{
$lang_key = empty($lang_key) ? $report_name : $lang_key;
$report_label = lang($lang_key);
$report_prefix = empty($report_prefix) ? '' : $report_prefix . '.';
if(empty($lang_key))
{
$lang_key = str_replace('reports_','', $report_name);
$report_label = lang('Reports.' . $lang_key);
}
$report_label = lang('Reports.' . $lang_key);
$report_prefix = empty($report_prefix) ? '' : $report_prefix . '_';
// no summary nor detailed reports for receivings
if(!empty($report_label) && $report_label != $lang_key . ' (TBD)') //TODO: String Interpolation. Also !==

View File

@@ -2,7 +2,7 @@
namespace app\Libraries;
use App\Models\tokens\Token;
use App\Models\Tokens\Token;
/**
* Token library

View File

@@ -49,7 +49,7 @@
'id' => 'item_name',
'class' => 'form-control input-sm',
'size' => '50',
'value' => esc($selected_kit_item)
'value' => $selected_kit_item
]) ?>
<?php echo form_hidden('kit_item_id', $selected_kit_item_id) ?>
@@ -253,7 +253,7 @@ $(document).ready(function()
$('#item_name').autocomplete({
source: "<?php echo 'items/suggest_kits' ?>",
source: "<?php echo 'items/suggestKits' ?>",
minChars: 0,
delay: 15,
cacheLength: 1,

View File

@@ -111,7 +111,7 @@ $(document).ready(function()
<?php echo view('partial/daterangepicker') ?>
$("#generate_report").click(function()
{
{
window.location = [window.location, start_date, end_date, $("#input_type").val() || 0, $("#location_id").val() || 'all', $("#discount_type_id").val() || 0 ].join("/");
});
});