diff --git a/app/Controllers/Items.php b/app/Controllers/Items.php index 5ae65c86c..aa1e5e6c4 100644 --- a/app/Controllers/Items.php +++ b/app/Controllers/Items.php @@ -211,9 +211,9 @@ class Items extends Secure_Controller /** * Gives search suggestions based on what is being searched for. Called from the view. */ - public function suggest_category(): void + public function getSuggestCategory(): void { - $suggestions = $this->item->get_category_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING)); + $suggestions = $this->item->get_category_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING)); echo json_encode($suggestions); } @@ -221,14 +221,14 @@ class Items extends Secure_Controller /** * Gives search suggestions based on what is being searched for. Called from the view. */ - public function suggest_location(): void + public function getSuggestLocation(): void { - $suggestions = $this->item->get_location_suggestions($this->request->getVar('term', FILTER_SANITIZE_STRING)); + $suggestions = $this->item->get_location_suggestions($this->request->getGet('term', FILTER_SANITIZE_STRING)); echo json_encode($suggestions); } - public function getAjaxRow(string $item_ids): void //TODO: It's possible an array would be better. + public function getRow(string $item_ids): void //TODO: It's possible an array would be better. { $item_infos = $this->item->get_multiple_info(explode(':', $item_ids), $this->item_lib->get_item_location()); @@ -557,7 +557,11 @@ class Items extends Secure_Controller public function postSave(int $item_id = NEW_ENTRY): void { $upload_success = $this->upload_image(); - $upload_file = $this->request->hasFile('image') ? $this->request->getFile('image') : null; //TODO: https://codeigniter4.github.io/userguide/incoming/incomingrequest.html#uploaded-files + + // TODO the hasFile is not defined, so commenting this out and saving it for last. +// $upload_file = $this->request->hasFile('image') ? $this->request->getFile('image') : null; //TODO: https://codeigniter4.github.io/userguide/incoming/incomingrequest.html#uploaded-files + $upload_file = null; + $receiving_quantity = parse_quantity($this->request->getPost('receiving_quantity', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION)); $item_type = $this->request->getPost('item_type') === NULL ? ITEM : $this->request->getPost('item_type', FILTER_SANITIZE_NUMBER_INT); @@ -608,10 +612,17 @@ class Items extends Secure_Controller $item_data['tax_category_id'] = empty($this->request->getPost('tax_category_id')) ? NULL : $this->request->getPost('tax_category_id', FILTER_SANITIZE_NUMBER_INT); } - $original_name = $upload_file->getFilename(); - if(!empty($original_name)) + if ($upload_file != NULL) { - $item_data['pic_filename'] = $original_name; + $original_name = $upload_file->getFilename(); + if(!empty($original_name)) + { + $item_data['pic_filename'] = $original_name; + } + } + else + { + $item_data['pic_filename'] = NULL; } $employee_id = $this->employee->get_logged_in_employee_info()->person_id; @@ -767,7 +778,7 @@ class Items extends Secure_Controller } - public function check_item_number(): void + public function postCheckItemNumber(): void { $exists = $this->item->item_number_exists($this->request->getPost('item_number', FILTER_SANITIZE_STRING), $this->request->getPost('item_id', FILTER_SANITIZE_NUMBER_INT)); echo !$exists ? 'true' : 'false'; @@ -789,7 +800,7 @@ class Items extends Secure_Controller echo !$exists ? 'true' : 'false'; } - public function remove_logo($item_id): void + public function getRemoveLogo($item_id): void { $item_data = ['pic_filename' => NULL]; $result = $this->item->save_value($item_data, $item_id); diff --git a/app/Controllers/Secure_Controller.php b/app/Controllers/Secure_Controller.php index 0e2a186ee..6375b06c7 100644 --- a/app/Controllers/Secure_Controller.php +++ b/app/Controllers/Secure_Controller.php @@ -67,7 +67,7 @@ class Secure_Controller extends BaseController view('viewData', $global_view_data); } - public function check_numeric() + public function getCheckNumeric() { $result = TRUE; diff --git a/app/Views/items/form.php b/app/Views/items/form.php index d2006d057..a3b6d9bbe 100644 --- a/app/Views/items/form.php +++ b/app/Views/items/form.php @@ -82,7 +82,7 @@
@@ -501,7 +501,7 @@ $(document).ready(function() }; $('#tax_category').autocomplete({ - source: "", + source: "", minChars: 0, delay: 15, cacheLength: 1, @@ -517,7 +517,7 @@ $(document).ready(function() }; $('#low_sell_item_name').autocomplete({ - source: "", + source: "", minChars: 0, delay: 15, cacheLength: 1, @@ -527,7 +527,7 @@ $(document).ready(function() }); $('#category').autocomplete({ - source: "", + source: "", delay: 10, appendTo: '.modal-content' }); @@ -535,7 +535,7 @@ $(document).ready(function() $('a.fileinput-exists').click(function() { $.ajax({ type: 'GET', - url: 'item_id"), 'url') ?>', + url: 'item_id" ?>', dataType: 'json' }) }); @@ -553,7 +553,7 @@ $(document).ready(function() if(stay_open) { // set action of item_form to url without item id, so a new one can be created - $('#item_form').attr('action', ""); + $('#item_form').attr('action', ""); // use a whitelist of fields to minimize unintended side effects $(':text, :password, :file, #description, #item_form').not('.quantity, #reorder_level, #tax_name_1, #receiving_quantity, ' + '#tax_percent_name_1, #category, #reference_number, #name, #cost_price, #unit_price, #taxed_cost_price, #taxed_unit_price, #definition_name, [name^="attribute_links"]').val(''); @@ -564,7 +564,7 @@ $(document).ready(function() { dialog_support.hide(); } - table_support.handle_submit('', response, stay_open); + table_support.handle_submit('', response, stay_open); init_validation(); }, dataType: 'json' @@ -582,7 +582,7 @@ $(document).ready(function() required: false, remote: { - url: "", + url: "", type: 'POST', data: { 'item_id' : "item_id ?>", @@ -596,12 +596,12 @@ $(document).ready(function() cost_price: { required: true, - remote: "" + remote: "" }, unit_price: { required: true, - remote: "" + remote: "" }, $location_detail) @@ -610,7 +610,7 @@ $(document).ready(function() : { required: true, - remote: "" + remote: "" }, " + remote: "" }, reorder_level: { required: true, - remote: "" + remote: "" }, tax_percent: { required: true, - remote: "" + remote: "" } }, diff --git a/app/Views/partial/datepicker_locale.php b/app/Views/partial/datepicker_locale.php index faee25bb0..efc360e8f 100644 --- a/app/Views/partial/datepicker_locale.php +++ b/app/Views/partial/datepicker_locale.php @@ -1,4 +1,4 @@ -lang->load('calendar'); $this->lang->load('date'); ?> +settings; ?> var pickerconfig = function(config) { return $.extend({ @@ -25,7 +25,7 @@ var pickerconfig = function(config) { todayHighlight: true, bootcssVer: 3, language: "" - }, ); + }, ); }; $.fn.datetimepicker.dates[''] = {