From 91c039c19a8d8e887b1b20dfd3602e13d5c55715 Mon Sep 17 00:00:00 2001 From: sunnysideup Date: Tue, 3 Jan 2017 14:11:21 +1300 Subject: [PATCH] PATCH: module clean-up --- .scrutinizer.yml | 74 ++++++++++++++++++++++--- README.md | 86 +++++++++++++++-------------- docs/en/INDEX.md | 68 +++++++++++++++++++++++ docs/en/README.old.md | 68 +++++++++++++++++++++++ tests/EcommerceStockcontrolTest.php | 13 +++++ 5 files changed, 261 insertions(+), 48 deletions(-) create mode 100644 docs/en/INDEX.md create mode 100644 docs/en/README.old.md create mode 100644 tests/EcommerceStockcontrolTest.php diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 5ba31b7..d1ebd80 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,9 +1,69 @@ inherit: true + +checks: + php: + verify_property_names: true + verify_argument_usable_as_reference: true + verify_access_scope_valid: true + useless_calls: true + use_statement_alias_conflict: true + variable_existence: true + unused_variables: true + unused_properties: true + unused_parameters: true + unused_methods: true + unreachable_code: true + too_many_arguments: true + sql_injection_vulnerabilities: true + simplify_boolean_return: true + side_effects_or_types: true + security_vulnerabilities: true + return_doc_comments: true + return_doc_comment_if_not_inferrable: true + require_scope_for_properties: true + require_scope_for_methods: true + require_php_tag_first: true + psr2_switch_declaration: true + psr2_class_declaration: true + property_assignments: true + prefer_while_loop_over_for_loop: true + precedence_mistakes: true + precedence_in_conditions: true + phpunit_assertions: true + php5_style_constructor: true + parse_doc_comments: true + parameter_non_unique: true + parameter_doc_comments: true + param_doc_comment_if_not_inferrable: true + optional_parameters_at_the_end: true + one_class_per_file: true + no_unnecessary_if: true + no_trailing_whitespace: true + no_property_on_interface: true + no_non_implemented_abstract_methods: true + no_error_suppression: true + no_duplicate_arguments: true + no_commented_out_code: true + newline_at_end_of_file: true + missing_arguments: true + method_calls_on_non_object: true + instanceof_class_exists: true + foreach_traversable: true + fix_line_ending: true + fix_doc_comments: true + duplication: true + deprecated_code_usage: true + deadlock_detection_in_loops: true + code_rating: true + closure_use_not_conflicting: true + catch_class_exists: true + blank_line_after_namespace_declaration: false + avoid_multiple_statements_on_same_line: true + avoid_duplicate_types: true + avoid_conflicting_incrementers: true + avoid_closing_tag: true + assignment_of_null_return: true + argument_type_checks: true + filter: -filter: - paths: ["code/*", "tests/*"] - excluded_paths: - - thirdparty/* - - parsers/* - - docs/* - - images/* + paths: [code/*, tests/*] diff --git a/README.md b/README.md index e8ab9b0..a2b8d21 100644 --- a/README.md +++ b/README.md @@ -1,68 +1,72 @@ -E-commerce Stock Control -================================================================================ +# Silverstripe ecommerce stockcontrol module +[![Build Status](https://travis-ci.org/sunnysideup/silverstripe-ecommerce_stockcontrol.svg?branch=master)](https://travis-ci.org/sunnysideup/silverstripe-ecommerce_stockcontrol) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/sunnysideup/silverstripe-ecommerce_stockcontrol/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/sunnysideup/silverstripe-ecommerce_stockcontrol/?branch=master) +[![codecov.io](https://codecov.io/github/sunnysideup/silverstripe-ecommerce_stockcontrol/coverage.svg?branch=master)](https://codecov.io/github/sunnysideup/silverstripe-ecommerce_stockcontrol?branch=master) +![helpfulrobot](https://helpfulrobot.io/sunnysideup/ecommerce_stockcontrol/badge) -This module stores stock levels seperate from the products themsleves. This means that a history of stock levels can be -produced. The module also stores the type of update for each stock update - manual (adding more stock) or order based (sales). +[![Latest Stable Version](https://poser.pugx.org/sunnysideup/ecommerce_stockcontrol/version)](https://packagist.org/packages/sunnysideup/ecommerce_stockcontrol) +[![License](https://poser.pugx.org/sunnysideup/ecommerce_stockcontrol/license)](https://packagist.org/packages/sunnysideup/ecommerce_stockcontrol) +[![Monthly Downloads](https://poser.pugx.org/sunnysideup/ecommerce_stockcontrol/d/monthly)](https://packagist.org/packages/sunnysideup/ecommerce_stockcontrol) -The module also includes a MinMaxModifier, which will make sure that a product quantity in cart stays between a min and a max. -The MinMaxModifier can also be used on its own. +## Documentation -This module provides a stock control page for quick updating of stock levels. -About the model classes: -ProductStockOrderEntry: keeps a record of the quantity deduction made for each sale. That is, if we sell 10 items -in an order then an entry is made in this dataclass for a reduction of ten widgets in the available quantity. + * [Developer Docs](docs/en/INDEX.md) + * [User Guide](docs/en/userguide.md) + * [API](http://ssmods.com/apis/ecommerce_stockcontrol/docs/en/api/) -ProductStockManualUpdate: at any stage, the product available quantity can be changed (manually overridden) using this class. +## Requirements -ProductStockCalculatedQuantity: works out the quantity available for each product based on the the number of items -sold (recorded in ProductStockOrderEntry) and manual corrections, recorded in ProductStockManualUpdate. -ProductStockVariationCalculatedQuantity: calculates quantities available for product variations +see [composer.json](composer.json) for details -Developers ------------------------------------------------ +### Suggested Modules -- Nicolaas Francken [at] sunnysideup.co.nz -- Jeremy Shipman [at] burnbright.co.nz -Documentation ------------------------------------------------ -Please contact author for more details. +see [composer.json](composer.json) for details -Any bug reports and/or feature requests will be -looked at -We are also very happy to provide personalised support -for this module in exchange for a small donation. +## Installation -Requirements ------------------------------------------------ -see composer.json +``` +composer require sunnysideup/ecommerce_stockcontrol +``` +### Configuration -Project Home ------------------------------------------------ -See http://code.google.com/p/silverstripe-ecommerce -Demo ------------------------------------------------ -See http://www.silverstripe-ecommerce.com +In the `_config` folder you will find the `ecommerce_stockcontrol.yml.example` +file that shows options for the configuration of this module. -Installation Instructions ------------------------------------------------ +We recommend that you: -1. Find out how to add modules to SS and add module as per usual. + 1. copy these `ecommerce_stockcontrol.yml.example` files into your +`mysite/_config` folder + 2. remove the .example extension + 3. delete the lines you not care about, and + 4. adjust the configurations that you would like to use. -2. Review configs and add entries to mysite/_config/config.yml -(or similar) as necessary. -In the _config/ folder of this module -you can usually find some examples of config options (if any). +## Contributing + + +We welcome any contributions. See [CONTRIBUTING.md](CONTRIBUTING.md) for more details. + +## Paid assistance + + + +You can pay us to create an improved / adapted version of this module for your own projects. Please contact us if you like to find out more: [www.sunnysideup.co.nz](http://www.sunnysideup.co.nz) + +## Author + + + +Sunny Side Up Ltd. diff --git a/docs/en/INDEX.md b/docs/en/INDEX.md new file mode 100644 index 0000000..e8ab9b0 --- /dev/null +++ b/docs/en/INDEX.md @@ -0,0 +1,68 @@ +E-commerce Stock Control +================================================================================ + +This module stores stock levels seperate from the products themsleves. This means that a history of stock levels can be +produced. The module also stores the type of update for each stock update - manual (adding more stock) or order based (sales). + +The module also includes a MinMaxModifier, which will make sure that a product quantity in cart stays between a min and a max. + +The MinMaxModifier can also be used on its own. + +This module provides a stock control page for quick updating of stock levels. + +About the model classes: + +ProductStockOrderEntry: keeps a record of the quantity deduction made for each sale. That is, if we sell 10 items +in an order then an entry is made in this dataclass for a reduction of ten widgets in the available quantity. + +ProductStockManualUpdate: at any stage, the product available quantity can be changed (manually overridden) using this class. + +ProductStockCalculatedQuantity: works out the quantity available for each product based on the the number of items +sold (recorded in ProductStockOrderEntry) and manual corrections, recorded in ProductStockManualUpdate. + +ProductStockVariationCalculatedQuantity: calculates quantities available for product variations + + +Developers +----------------------------------------------- + +- Nicolaas Francken [at] sunnysideup.co.nz +- Jeremy Shipman [at] burnbright.co.nz + + +Documentation +----------------------------------------------- +Please contact author for more details. + +Any bug reports and/or feature requests will be +looked at + +We are also very happy to provide personalised support +for this module in exchange for a small donation. + + +Requirements +----------------------------------------------- +see composer.json + + +Project Home +----------------------------------------------- +See http://code.google.com/p/silverstripe-ecommerce + +Demo +----------------------------------------------- +See http://www.silverstripe-ecommerce.com + + +Installation Instructions +----------------------------------------------- + +1. Find out how to add modules to SS and add module as per usual. + +2. Review configs and add entries to mysite/_config/config.yml +(or similar) as necessary. +In the _config/ folder of this module +you can usually find some examples of config options (if any). + + diff --git a/docs/en/README.old.md b/docs/en/README.old.md new file mode 100644 index 0000000..e8ab9b0 --- /dev/null +++ b/docs/en/README.old.md @@ -0,0 +1,68 @@ +E-commerce Stock Control +================================================================================ + +This module stores stock levels seperate from the products themsleves. This means that a history of stock levels can be +produced. The module also stores the type of update for each stock update - manual (adding more stock) or order based (sales). + +The module also includes a MinMaxModifier, which will make sure that a product quantity in cart stays between a min and a max. + +The MinMaxModifier can also be used on its own. + +This module provides a stock control page for quick updating of stock levels. + +About the model classes: + +ProductStockOrderEntry: keeps a record of the quantity deduction made for each sale. That is, if we sell 10 items +in an order then an entry is made in this dataclass for a reduction of ten widgets in the available quantity. + +ProductStockManualUpdate: at any stage, the product available quantity can be changed (manually overridden) using this class. + +ProductStockCalculatedQuantity: works out the quantity available for each product based on the the number of items +sold (recorded in ProductStockOrderEntry) and manual corrections, recorded in ProductStockManualUpdate. + +ProductStockVariationCalculatedQuantity: calculates quantities available for product variations + + +Developers +----------------------------------------------- + +- Nicolaas Francken [at] sunnysideup.co.nz +- Jeremy Shipman [at] burnbright.co.nz + + +Documentation +----------------------------------------------- +Please contact author for more details. + +Any bug reports and/or feature requests will be +looked at + +We are also very happy to provide personalised support +for this module in exchange for a small donation. + + +Requirements +----------------------------------------------- +see composer.json + + +Project Home +----------------------------------------------- +See http://code.google.com/p/silverstripe-ecommerce + +Demo +----------------------------------------------- +See http://www.silverstripe-ecommerce.com + + +Installation Instructions +----------------------------------------------- + +1. Find out how to add modules to SS and add module as per usual. + +2. Review configs and add entries to mysite/_config/config.yml +(or similar) as necessary. +In the _config/ folder of this module +you can usually find some examples of config options (if any). + + diff --git a/tests/EcommerceStockcontrolTest.php b/tests/EcommerceStockcontrolTest.php new file mode 100644 index 0000000..8d13a8c --- /dev/null +++ b/tests/EcommerceStockcontrolTest.php @@ -0,0 +1,13 @@ +assertEquals(1, 1); + } + +} +