Commit Graph

24 Commits

Author SHA1 Message Date
jekkos
a2e7c0a74b Revert SQLi fixes (#3284) 2021-09-06 21:45:08 +02:00
jekkos
b4c48e5141 Blind sql injection fixes (#3284) 2021-08-27 00:20:50 +02:00
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
Jeroen Peelaerts
8675aa82df Attribute value encoding fix (#3241) 2021-07-22 19:01:59 +02:00
objecttothis
f5424a3ed2 Create Global Constants to clarify code 2020-05-19 18:06:20 +04:00
objecttothis
15a987cfd9 Adjust functions related to attributes 2020-05-04 17:00:02 +04:00
objecttothis
96bfa330ba Added the creation and removal of ospos_category attribute
- Added undelete function in Attribute model which could be useful for
adding the ability to restore attributes once deleted.
- Added business logic to Config controller save_general to
create/remove the attribute when the box is checked or unchecked.
2020-05-04 16:45:58 +04:00
objecttothis
4584b7eace Final indentation and formatting fixes 2020-03-24 14:17:36 +04:00
objecttothis
971ae5ec19 Correcting indentation problems 2020-03-24 13:18:35 +04:00
objecttothis
ea7cb48f1c CHECKBOX Attribute type
Conversion from DROPDOWN or TEXT logic
2020-03-02 14:17:48 +04:00
objecttothis
ff79b73e34 Implement CHECKBOX attribute type
Attribute Configuration view
Attributes section of item management view
Attributes section of CSV item import
2020-02-25 15:44:49 +04:00
jekkos
7ebae8ad8a Fix warning when opening attribute edit form 2019-08-11 17:22:47 +02:00
jekkos
0d3a33f1ba Fix attribute visibility view if none selected (#2485) 2019-08-07 00:14:22 +02:00
objecttothis
1776de12ff Update Attributes.php
Correcting variable naming.
2019-03-08 10:14:05 +04:00
objecttothis
74995a5ac1 Adding of decimal unit field 2019-03-06 15:42:04 +04:00
objecttothis
0e6eac9375 Update Attributes.php
Correcting variable name.  adding parameterization instead of php concatenate.
2019-02-27 19:43:24 +04:00
objecttothis
bcf82a0830 Update Attributes.php
Unified format changes.  All lang lines should be _definition_ or _definitions_ but not a mix of both.
2019-02-26 13:49:48 +04:00
jekkos
db6963a8a6 Fix blank screen after update (#2201) 2018-11-03 23:24:19 +01:00
jekkos
288b4029d7 Add attributes to detailed sales/receiving reports (#68) 2018-10-15 19:32:29 +02:00
jekkos
8b212a8dd0 Fix some final bugs (#68) 2018-10-15 19:32:29 +02:00
jekkos
1a490cedf5 Add support for DATETIME in attributes (#68) 2018-10-15 19:32:29 +02:00
jekkos
a8d73d5f99 Add attributes to items (#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