Commit Graph
113 Commits
Author SHA1 Message Date
objecttothis 3d65c3fffa CSV import optimizations and code cleanup (#3150)
Optimizations and CSV Import Rework
- Replaced " with ' where possible to prevent the parser from being called when not needed.
- Replaced == and != with === and !== where possible for bug prevention and speed.
- Replaced -1 with NEW_ITEM global constant for code clarity.
- Added NEW_ITEM global constant to constants.php.
- Refactored CSV import function names for clarity.
- Added capability to import a CSV file containing updates.
- Replaced array() with [] for speed and consistency.
- Removed hungarian notation from two private functions.
- Refactored QueryBuilder functions to place table name in the get() function call.
- Replaced (int) cast with call to intval() for speed.
- Replaced == and != with === and !== where possible to prevent bugs and for speed.
- Replaced array() with [] for speed and consistency.
- Fixed search_custom call

Optimizations and bugfixes for attributes used in csv_import
- Reordered where statements in queries to match composite index on attribute_links table.
- fixed value_exists() to account for different attribute types.
- Removed hungarian notation on private function.
- Replaced array() with [] for speed and consistency.
- Replaced != with <> in SQL for consistency.
- Removed from() calls in querybuilder where possible to reduce function calls.
- Add get_items_by_value()
- Reworked check_data_validity()
- Remove unneeded comments
- Refactor functions for code clarity.
- Use $this->db->dbprefix() where possible instead of hand-writing ospos_...
- Removed unneeded column from query.
- Replaced (int) cast with intval() call for speed.
- Added get_attribute_values()
- Fixed issue with date format locale not being used
- Refactored save_value to respect different attribute_types
- Added delete_orphaned_links() to remove attribute_links that are no longer linked to any items
- Added get_attributes_by_definition()
- Added attribute_cleanup()

Optimizations used in csv_import
- replaced array() with [] for consistency and speed.
- Removed hungarian notation in private functions.
- Replaced " with ' where possible to prevent the parser from being called.
- Minor formatting
- Refactored if statement to tertiary notation for cleaner implementation.
- Replaced " for ' where possible to prevent the parser from being called.
- Added the Id column in the generate_import_items_csv() template so that users can submit an update to an existing item.
- Removed unused key=>value pairs in foreach loops for speed.
- Removed unneeded comments where the function name was self-explanatory.
- Rework get_csv_file() for speed.
- Rework bom_exists() for speed.
- Replaced array() with [] for speed and consistency.
- Replaced == with === where possible to prevent bugs and for speed.
- Reworked valid_date() and valid_decimal helper functions for speed and accuracy according to the locale_format instead of a fixed format.
- Minor Reformatting for clarity.
- Replaced " for ' to prevent the parser from being called.
- Refactored function call names to reflect new names.
- Added missing ; in &nbsp;
- Used String interpolation where useful.

- Spelling fix in comment

Requested Review Changes
- Fixed indentation in Items.php
- Fixed indentation in Attribute.php
- Refactored variable out of long line of code to make it more readable.
2021-07-29 22:22:59 +02:00
objecttothis 352036209f Requested Changes
- Removed unnecessary indices on deleted column where there would not be many rows.
- Removed unnecessary parenthesis in Item Model.
- Added Composite indices based on MySQL EXPLAIN results.
2021-05-25 14:04:01 +02:00
objecttothis a11f25e983 Update Item.php
Set group_concat_max_len session variable to prevent count totals at the bottom of the tables becoming `1 to null of null items` when database includes significant number of item rows.
2020-06-29 11:23:10 +02:00
objecttothis a3fb05b566 Change the locations of global constants to make them global across
files

- Items Constants
- Attributes Constants
- Sale Constants
2020-06-03 14:15:05 +04:00
objecttothis 5a58af7a01 Removing LEFT JOIN of supplier table
per #2788 the Supplier table results from Item->get_all() and Item->get_info() are not used anywhere and causing a bug where the duplicate fields between the items table and the suppliers table (deleted and category) are returning just one value to the results.  This creates the undesired effect of expecting items.deleted and items.category but getting values from suppliers.deleted and suppliers.category.
2020-05-05 15:01:32 +02:00
jekkos-t520 0f2bafc7dd Fix attribute search (#2723) 2020-03-14 01:44:08 +01:00
FrancescoUK 622fdc27aa Fix detailed reports error with attributes (#2721) 2020-02-15 22:01:51 +00:00
FrancescoUK a081b72916 Fix issue with POS transaction return when Items are deleted (#2659) 2020-01-03 21:56:43 +00:00
jekkos d52c16fbba Fix item form refresh (#2538) 2020-01-03 14:26:11 +01:00
jekkos f9da801f06 Add aggregate to fix only_full_group_by (#2538) 2020-01-03 00:16:34 +01:00
FrancescoUK a56a4070a6 Revert "Fix "only_full_group_by" issue (#2538)"
This reverts commit 424eb4cf14.
2019-10-06 20:15:24 +01:00
FrancescoUK 424eb4cf14 Fix "only_full_group_by" issue (#2538) 2019-10-06 18:43:58 +01:00
jekkos 0a2894c582 Left join on attribute_values to show items with no value (#2485) 2019-08-04 22:29:44 +02:00
jekkos cfe5a3c84e Enable attribute search for datetime (#2441) 2019-06-30 17:52:32 +02:00
FrancescoUK 1f2aa2708d Fix missing ) and minor change 2019-06-22 16:39:18 +01:00
jekkos 8ca5449b79 Add decimals to items search result + fix reports 2019-06-20 18:39:17 +02:00
FrancescoUK 01dfd023eb Merge pull request #2319 from opensourcepos/fix-attribute-datetime
Fix attribute datetime formatting
2019-06-15 10:32:22 +01:00
FrancescoUK 4644dd2e46 MySQL queries consistency check 2019-06-15 09:39:08 +01:00
FrancescoUK 28b3bc87d4 Comment out unused code still with custom fields 2019-06-09 21:47:36 +01:00
jekkos 0ae6470b35 Migrate attribute datetime to date (#2441) 2019-06-05 00:47:17 +02:00
jekkos d3d051ee72 Fix loading attribute values in item search (#2232) 2019-06-05 00:31:45 +02:00
jekkos f2d2b1d3e2 Fix datetime attribute formatting (#2232) 2019-06-05 00:29:48 +02:00
Steve Ireland 3220469837 Add support for India GST 2018-12-23 09:16:10 -05:00
jekkos 06a6f82015 Fix attribute search (#2268) 2018-12-12 23:20:25 +01:00
jekkos 2f3c75db25 Show attribute values in search results (#2248) 2018-12-03 23:09:11 +01:00
jekkos 3c6f7dd9c1 Fix item update query (#68) 2018-10-15 19:32:29 +02:00
jekkos 6fc2072967 Fix attribute search (#68) 2018-10-15 19:32:29 +02:00
jekkos 43e3400468 Fix item row refresh (#68) 2018-10-15 19:32:29 +02:00
jekkos b9cba20d84 Fix items row refresh (#68) 2018-10-15 19:32:29 +02:00
jekkos 9cdfc0ce8a Fix css overflow + form refresh 2018-10-15 19:32:29 +02:00
jekkos 9e7543a41a Fix attribute values in items (#68) 2018-10-15 19:32:29 +02:00
jekkos 1ed56e388b Rename migration script (#68) 2018-10-15 19:32:29 +02:00
jekkos 77682973a0 Enable attributes in items table (#68) 2018-10-15 19:32:29 +02:00
FrancescoUK 75097e9485 Update Item.php 2018-10-15 19:32:29 +02:00
jekkos 085d24447c Disablel SHOW_IN_ITEMS (#68) 2018-10-15 19:32:29 +02:00
jekkos 98022f3b96 Cleanup + enable item attribute delete (#68) 2018-10-15 19:32:29 +02:00
jekkos 500a8d7a8f Work in progress, still testing items form (#68) 2018-10-15 19:32:29 +02:00
jekkos df61ee09bb Add item attributes functionality (#68) 2018-10-15 19:32:29 +02:00
FrancescoUK f521257570 Fix Items search category issue (#2179) 2018-10-13 17:23:28 +01:00
Steve Ireland 6d5f518855 Fix issue with deleted items not being included in reprinted receipts. 2018-09-28 20:37:51 +02:00
Steve Ireland 68fe267fad Fix issue with deleted items not being included in reprinted receipts. 2018-09-25 20:24:20 -04:00
jekkos 024565d67c Enable array filtering (#2030) 2018-09-01 01:23:07 +02:00
jekkos 0248a50ae3 Filter out duplicate results (#2038) 2018-09-01 01:23:07 +02:00
Steve Ireland 497c9e4617 Add support for India GST 2018-07-14 11:20:54 -04:00
FrancescoUK 1486a41363 Fix review issues 2018-07-14 09:26:47 +01:00
jekkos a4e135eb92 Add support for multi-pack items. 2018-07-05 19:05:54 -04:00
Steve Ireland 3f12d57f82 Fix item select issue introduced with temp item feature 2018-06-13 22:11:53 +01:00
Steve Ireland f49c896e4f Restore ctype_digit 2018-06-13 22:11:53 +01:00
Steve Ireland 5ef8a88000 Add support for temporary items. 2018-06-13 22:11:00 +01:00
Steve Ireland cdd966878d Various fixes for the item kit feature. 2018-04-21 17:46:39 -04:00