Commit Graph

125 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
Jeroen Peelaerts
05942fe2f3 Add hook to validate save HTTP method (#3100) 2021-03-12 13:12:44 +01:00
objecttothis
a155399ec0 Merge branch 'master' into category_as_dropdown 2020-05-19 18:14:31 +04:00
objecttothis
75f45bdb47 Corrected variable names 2020-05-08 16:04:37 +04:00
objecttothis
68a2489e13 Add Save logic
- Corrected minimum image size value in migration script
- Added save logic to save_general() in Config controller
- Added logic in the index() of the Config controller to properly prep
allowed_image_types data
2020-05-08 15:58:37 +04:00
objecttothis
59142d9f69 Database logic additions
- Migration script to create default values
- Corrected naming of variables in general_config.php
- Replaced hardcoded values with db variables
2020-05-08 14:22:49 +04:00
objecttothis
9557f1c310 Forgotten commit
- This was correct in my code base.  I just forgot to commit it.
2020-05-05 14:47:42 +04:00
objecttothis
1dc3e15a55 Implement dropdown into item form view
- Created business logic in view to show dropdown if enabled
- Created business logic in controller to calculate key/value pairs of
dropdown
- Adjusted attribute model get_definition values to send values also if
definition_id is -1 or > 0 but not 0 which is what we are now using as
no definition instead of -1
2020-05-05 11:59:03 +04:00
objecttothis
8a0c88b11c More indentation corrections 2020-03-24 14:13:08 +04:00
objecttothis
3281fc9bb0 Correct indentation problems 2020-03-24 14:04:04 +04:00
objecttothis
c4c475b51f Updated CSV import to handle checkboxes
0, FALSE values create attributes marked as "unchecked"
NULL, "" and spaces do not create an attribute
1, TRUE and ANY other value creates an attribute and marks as checked.

Blank lines in CSV files are skipped with no error.
2020-03-18 15:49:49 +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
43420f02f2 Codestyle remarks 2020-01-02 12:40:31 +01:00
SteveIreland
230d822fce Add support to parse_decimal function for tax_decimals and quantity_decimals parsing. 2019-12-22 11:04:01 -05:00
objecttothis
35a59fc400 refactor variable names to reflect Excel --> CSV wording 2019-11-18 14:39:21 +04:00
SteveIreland
fffb70933d Fix item type maintenance issue regardless. 2019-11-10 19:40:57 -05:00
jekkos
d3d051ee72 Fix loading attribute values in item search (#2232) 2019-06-05 00:31:45 +02:00
FrancescoUK
dbf3114267 Attributes csv import integration 2019-06-03 21:13:21 +01:00
Steve Ireland
03fe400e9e Allow user excluded from item kit maintenance to maintain stock type. 2019-02-09 11:56:49 -05:00
Steve Ireland
3220469837 Add support for India GST 2018-12-23 09:16:10 -05:00
jekkos
612d23fa63 Fix attribute selection for update (#68) 2018-10-15 19:32:29 +02:00
jekkos
fd00a74225 Refactor + fix detailed reports (#68) 2018-10-15 19:32:29 +02:00
jekkos
abc067a10b Fix development mode warning (#68) 2018-10-15 19:32:29 +02:00
jekkos
7683cfe5c9 Fix dropdown preselection on edit (#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
77682973a0 Enable attributes in items table (#68) 2018-10-15 19:32:29 +02:00
FrancescoUK
3c876d7f6f Update Items.php 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
jekkos
a4e135eb92 Add support for multi-pack items. 2018-07-05 19:05:54 -04:00
Steve Ireland
5ef8a88000 Add support for temporary items. 2018-06-13 22:11:00 +01:00
FrancescoUK
4bab3fc4e3 Code style adjustments 2018-04-14 14:40:02 +01:00
Steve Ireland
3d38b2322e Fix item maintenance issue where item cannot be saved if employee is not authorized to work with Item Kits. 2017-09-23 20:46:16 -04:00
FrancescoUK
39dbd9af52 Small code refactoring 2017-09-17 15:17:48 +01:00
jekkos
6c714b2dc4 Add constants for magic numbers 2017-08-06 14:33:26 +01:00
Steve Ireland
641e2f414c Add missing language element for rounding code "Unknown" and eliminate duplicate statements in upgrade statement, and fix issue with 0 tax_category_id 2017-07-25 00:56:59 +02:00
FrancescoUK
bb762efac7 Merge pull request #1376 from odiea/master
Update Items.php . Changed receiving_quantity to 1
2017-07-04 08:55:48 +01:00
odiea
a18745b3af Update Items.php 2017-07-03 06:23:05 -06:00
FrancescoUK
0057c77721 Replace UPC/EAN/ISBN with Barcode label (#1370) 2017-07-02 21:52:07 +01:00
odiea
e2e0ade259 Update for Items receiving_quantity 2017-06-24 13:03:00 +01:00
FrancescoUK
9d01398a4b Minor code style adjustments 2017-04-17 21:47:22 +01:00
Steve Ireland
422ca99ab3 Fix item update of tax category. 2017-04-15 19:38:32 -04:00
FrancescoUK
6c0124cd17 Minor fixes 2017-04-15 10:04:48 +01:00
Steve Ireland
effba9d102 Add support for customer sales tax and cash rounding 2017-04-14 21:21:44 -04:00
Steve Ireland
1a0a3fbeba Fix for item excel import 2017-04-09 21:40:56 -04:00
Steve Ireland
e4955027d1 Hide stock_type and item_type if the employee isn't authorized to item kits. On register if item type is non-stock don't display the zero stock balance message, and correct the default quote format when initializing the field. 2017-02-19 13:41:04 -05:00
i92guboj
7222df3551 Remove unnecessary/redundant check 2017-02-05 21:30:17 +01:00