- Preferred install URL: https://opensourcepos.org/install
- Falls back to direct GitHub URL if redirect unavailable
- More professional and easier to remember
- Creates scripts/install-ubuntu.sh for automated fresh Ubuntu server setup
- Installs Apache, MariaDB, PHP 8.2 with required extensions
- Downloads and configures OSPOS from GitHub
- Sets up Apache virtual host with proper permissions
- Generates secure random database password
- Supports environment variables for customization
- Updates INSTALL.md with curl pipe to bash instructions
This provides an alternative to cloud-specific instructions and
allows users to quickly set up OSPOS on any fresh Ubuntu server.
- Add validateCSVStockLocations() method to check CSV columns against allowed locations
- Log error when invalid stock location columns are detected
- Tests for valid, invalid, and mixed stock location columns
- Tests for location name case sensitivity
- Tests for CSV parsing and detecting location columns
- Add error message language string for invalid locations
- Add comprehensive test suite for CSV import in ItemsCsvImportTest.php
- Test CSV header generation (locations, attributes, BOM handling)
- Test CSV file parsing (multiple rows, BOM detection)
- Test item import (basic fields, quantities, inventory records)
- Test item updates, taxes, and attributes
- Test edge cases (zero quantities, negative values, precision)
- Add GitHub Actions workflow for unit tests
- Tests verify data ends up correctly in items/item_quantities tables
This commit adds unit tests for the case-sensitive attribute updates
and CSV import attribute deletion capability features introduced in PR #4384.
Test Coverage:
- Attribute Model Tests (tests/Models/AttributeTest.php):
- testCaseSensitiveAttributeValueUpdate: Verifies case-insensitive check then case-sensitive update
- testDeleteAttributeLinks: Tests deletion of attribute links
- testCategoryDropdownCanBeEnabled: Verifies dropdown enablement bug fix
- testDropdownAttributeValueSave: Tests DROPDOWN type attributes
- testDateAttributeValueSave/Update: Tests DATE type attributes
- testDecimalAttributeValueSave: Tests DECIMAL type attributes
- testCheckboxAttributeValueSave: Tests CHECKBOX type attributes
- testCategoryDropdownWithConstant: Tests CATEGORY_DEFINITION_ID usage
- testDeleteAttributeLinksPreservesSalesAndReceivings: Ensures sales/receivings links protected
- testDeleteOrphanedValues: Tests orphan value cleanup
- testUnicodeCaseComparison: Tests Unicode handling in case comparisons
- testGetAttributeValueByAttributeId: Tests new utility method
- testAttributeLinkWithNullAttributeId: Tests null attribute_id handling
- testCategoryDropdownUpdatesItemCategory: Tests category dropdown behavior
- Attribute Helper Tests (tests/Helpers/AttributeHelperTest.php):
- Test getAttributeDataType for all attribute types (TEXT, DECIMAL, DATE, DROPDOWN, CHECKBOX)
- Test getAttributeDataType returns 'attribute_value' as fallback for invalid types
- Test validateAttributeValueType throws InvalidArgumentException for invalid types
- Test validateAttributeValueType accepts valid data types
- Import File Helper Tests (tests/Helpers/ImportFileHelperTest.php):
- Tests _DELETE_ magic word case-insensitive comparison using strcasecmp
- Tests that _DELETE_ does not match similar-looking strings (security)
- Tests empty string does not match _DELETE_
- Tests null safety considerations for strcasecmp usage
Test Configuration:
- Updated phpunit.xml to include Models and Controllers test suites
- Uses DatabaseTestTrait for database migration between tests
- Tests cover positive and negative cases
- Tests include edge cases: Unicode, null values, empty strings, similar strings
Files Added:
- tests/Models/AttributeTest.php (26,541 bytes, 16 test methods)
- tests/Helpers/AttributeHelperTest.php (3,331 bytes, 8 test methods)
- tests/Helpers/ImportFileHelperTest.php (2,906 bytes, 4 test methods)
Total: 28 test methods covering all new features and edge cases
Note: Tests currently designed; will run once PHP environment is configured.
- Refactored variable names for PSR compliance
- Removed bug preventing updates in CSV import files from updating the barcode number.
- Corrected duplicate saveAttributeLink() calls with attribute type was not DROPDOWN.
Signed-off-by: objec <objecttothis@gmail.com>
- Corrected spacing
- Added business logic to delete an attribute_link if the import contains `_DELETE_` in that space.
- Removed unneeded PHPdoc comments
- Improved PHPdoc to clarify behavior of function
- Refactor variable names for PSR compliance
- Add logic in validation code for magic word
Signed-off-by: objec <objecttothis@gmail.com>
- Move validation function to attribute_helper.php
- Removed extra line in security_helper.php
- Corrected some calls to helper() that included `_helper`
Signed-off-by: objec <objecttothis@gmail.com>
- Fixed call to deleteOrphanedValues that refactor missed.
- Removed unused import.
- Fixed issue preventing DROPDOWN values from being added.
- Updated logic to fix potential TypeError being thrown by strcasecmp()
Signed-off-by: objec <objecttothis@gmail.com>
- Replaced unneeded case-sensitive database search with case-insensitive variant.
- Added input validation.
- Added logic to properly check for case changes in CSV import.
- Moved deleteOrphanedValues() to outside a foreach loop to prevent it running redundantly.
Signed-off-by: objec <objecttothis@gmail.com>
- Fixed logic causing attribute_value to be updated to a value that already exists for a different attribute_id.
- Added logic for edge case where an attribute_value was updated due to capitalization that had a row in attribute_links for category_dropdown definitions (definition_id = -1). This will also update the items.category values to correct the capitalization of those.
Signed-off-by: objec <objecttothis@gmail.com>
- Removed redundant variable declaration.
- Refactored local variables for PSR compliance.
- Add back in Date Formatting and corrected business logic
- Corrected spacing in comments.
- Corrected business logic of function call in Attribute model and refactored redundant code to a private function.
Signed-off-by: objec <objecttothis@gmail.com>
- Refactored local variables for PSR compliance
- Added business logic to Attribute->saveAttributeValue so that the attribute value gets overwritten if the only difference is capitalization.
- Added PHPdocs
- Fixed bug in Attribute->saveDefinition preventing category as dropdown from working.
- Modified Attribute->saveAttributeLink() to account for dropdown attributes.
Signed-off-by: objec <objecttothis@gmail.com>
- Added attribute_helper.php and getAttributeDataType function for quick translation in the code.
- Refactored code for PSR compliance
- Added getAttributeValueByAttributeId() to the attribute model.
- Added PHPdocs where it was missing
- Updated business logic to check for capitalization differences on CSV import of an item.
Signed-off-by: objec <objecttothis@gmail.com>
* Add show/hide cost price & profit feature
* .env should be ignored.
* js code formatted. .vscode folder ignore for vscode user settings.json
* style is replaced with bootstrap class, formatted and .env.example
* toggle button on table to like in other
* comment corrected.
* class re-factored
* minor refactor
* formatted with 4 space
---------
Co-authored-by: Lotussoft Youngtech <lotussoftyoungtech@gmail.com>
* Add attachment cid when sending emails (#4308)
Also check if an encryption key is set before decrypting the SMTP
password.
* Upgrade to CI 4.6.3 (#4308)
* Fix for changing invoice id in email (#4308)
* `execute_script()` now returns a boolean for error handling.
* Added transaction to `Migration_MissingConfigKeys.up()`.
* Added logging to various migrations.
* Added transaction to `Migration_MissingConfigKeys.up()`.
* Added logging to various migrations.
* Formatting and function call fixes
Fixed a minor formatting issue in the migration helper.
Replaced a few remaining error_log() calls.
Updated executeScriptWithTransaction() to use log_message()
* Function call fix
Replaced the last error_log() calls with log_message().
---------
Co-authored-by: Joe Williams <hey-there-joe@outlook.com>
* `execute_script()` now returns a boolean for error handling.
* Added transaction to `Migration_MissingConfigKeys.up()`.
* Added `executeScriptWithTransaction()` to migration helpers.
* Many changes for testing; also minor formatting fixes.
* Removed test code and pointed the `NullableTaxCategoryId` migration at the right SQL file.
* Fixed header.php
* Code cleanup from code review:
- Added IGNORE to SQL scripts.
- Added try-catch to executeScriptWithTransaction().
- Various comment changes.
* Fixed naming issue
Nullable tax category ID migration now runs the correct script.
* Updated SQL
Replaced INSERT WHERE NOT EXISTS in missing config keys sql script to use a single INSERT IGNORE.
* Updated migration helper
Updated executeScriptWithTransaction to use transRollback
---------
Co-authored-by: Joe Williams <hey-there-joe@outlook.com>