Commit Graph

432 Commits

Author SHA1 Message Date
Peter Fabian f7d0d2379f Merge branch 'master' into fix/489-date_date_gmt
# Conflicts:
#	includes/class-wc-admin-api-init.php
2019-02-15 17:07:38 +01:00
Albert Juhé Lluveras b61dff32f9 Sort tabular data when selecting a Summary Number (https://github.com/woocommerce/woocommerce-admin/pull/1564)
* Sort tabular data when selecting a Summary Number

* Fix 'orderby' param in orders endpoint
2019-02-15 11:54:41 +01:00
Justin Shreve a1c60537e5 Fix downloads stats data store sorting (https://github.com/woocommerce/woocommerce-admin/pull/1561) 2019-02-14 23:06:01 -05:00
Joshua T Flowers cba9ab61b2 Update returning customer values to respect excluded statuses (https://github.com/woocommerce/woocommerce-admin/pull/1557)
* Excluded statuses from customers oldest orders

* Fix tests for returning customer where excluded statuses are used

* Remove save_post hook used for testing

* Extract conditions for first order swapping
2019-02-15 10:09:16 +08:00
Paul Sealock 2e82211616 Add products/stats endpoint to categories 2019-02-15 09:44:46 +13:00
Justin Shreve 24301e0090 Add stock stats endpoint and hook up to the stock report. (https://github.com/woocommerce/woocommerce-admin/pull/1535)
* Add stock stats endpoint and hook up to the stock report.

* Handle PR feedback
2019-02-13 22:31:27 -05:00
Joshua T Flowers 9e1cd42f5b Update numeric comparisons for customer data (https://github.com/woocommerce/woocommerce-admin/pull/1541) 2019-02-14 11:15:48 +08:00
Joshua T Flowers 746d062f09 Check and update customer first orders to fix returning_customers (https://github.com/woocommerce/woocommerce-admin/pull/1517)
* Add get_oldest_orders function to customer data store

* Check if is first order in is_returning_customer()

* Check if the customers first order has changed and update all orders respectively

* Fix check for empty oldest_orders array

* Change avg_items_per_order to number instead of integer

* Fix failing tests for new/returning customers

Only the first orders with product 1 and without coupons should be new per each customer

* Remove sleep functions from tests

* Assign second order to a variable for legibility

* Fix second order assignment and check if set
2019-02-14 11:14:01 +08:00
Jeff Stieler c862de29d3 Merge pull request woocommerce/woocommerce-admin#1534 from woocommerce/fix/1455-customers-report-name-search
Hook up customers report table search box
2019-02-13 13:55:47 -08:00
Jeff Stieler 531f3b2f35 Remove unnecessary rewrite rules flush from install routine, clean up defunct TODO comment. 2019-02-12 12:57:06 -08:00
Jeff Stieler 9762810b70 Support ReportTable search in customers report (list of customer IDs). 2019-02-12 11:08:33 -08:00
Jeff Stieler e36d25e112 Make customer object IDs compatible with `wc-api`/`fresh-data`. 2019-02-12 11:08:03 -08:00
Jeff Stieler 926fdcfb97 Hook `v4/customers` endpoint up to customers report/lookup table and change name search to be fuzzy. 2019-02-12 11:06:22 -08:00
Peter Fabian a6761fc606 Merge branch 'master' into fix/489-date_date_gmt 2019-02-10 17:24:54 +01:00
Peter Fabian a8bedc5998 Accept before and after parameters as DateTime or string. 2019-02-10 17:18:05 +01:00
Peter Fabian d71225d7d1 Use default after and before parameter values if no values are provided by the user. 2019-02-10 17:16:43 +01:00
Peter Fabian 0d4c0452a0 Removed superfluous date setting. 2019-02-10 17:15:08 +01:00
Peter Fabian 8b4b32c43d Fixed parameter name from previous copy paste error. 2019-02-10 17:10:50 +01:00
Peter Fabian 08fe9c040e Fixed number of parameters to the function. 2019-02-10 17:09:52 +01:00
Peter Fabian b3c3aca973 Centralized default before and after parameters. 2019-02-10 17:07:45 +01:00
Jeff Stieler e5cdad1683 Move report table syncing methods to their own class and kick off initial sync using WC_Admin_Install. 2019-02-08 12:57:11 -08:00
Jeff Stieler 2797883a48 Move database table creation to new WC_Admin_Install class.
Remove reliance on plugin activation hook, following pattern established in WC_Install.
2019-02-08 11:27:39 -08:00
Peter Fabian 68c65cfde6 Corrected output of GMT time. 2019-02-08 18:12:20 +01:00
Peter Fabian 38a08b58cd Removed obsolete comment. 2019-02-08 18:11:33 +01:00
Peter Fabian 5fbf5b62d7 Normalize datetimes before doing any further processing with the input from the user.
Also, passing DateTime objects around instead of string so that timezone info can be easily attached to it.
2019-02-08 18:11:04 +01:00
Peter Fabian b70a166f1d Store datetimes in local time instead of UTC. 2019-02-08 18:01:44 +01:00
Jeff Stieler 432e7efaab Merge pull request woocommerce/woocommerce-admin#1497 from woocommerce/fix/initial-order-sync-stalling
Fix initial order sync stalling
2019-02-07 22:04:50 -08:00
Jeff Stieler 300069234a Add comments to explain we are skipping `shop_order_refund` types when syncing stats for coupons and taxes. 2019-02-07 18:41:40 -08:00
Claudio Sanches 4c169a109d Fixed missing argument in WC_Admin_Reports_Taxes_Stats_Data_Store::get_data
Fixes the follow PHP error:

```
PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function WC_Admin_Reports_Data_Store::remove_extra_records(), 6 passed in wp-content/plugins/wc-admin/includes/data-stores/class-wc-admin-reports-taxes-stats-data-store.php on line 232
```
2019-02-07 19:30:52 -02:00
Joshua T Flowers 8c3973a445 Add manage_stock to stock controller response (https://github.com/woocommerce/woocommerce-admin/pull/1475)
* Add manage_stock to stock controller response

* Add manage_stock property to stock report tests

* Add changelog entry

* Make stock quantity float instead of int

* Add manage_stock to the products API response

* Check for manage_stock in products table

* Add manage_stock property to product API tests
2019-02-07 16:29:01 +08:00
Albert Juhé Lluveras 79738b2022 Add 'variations' attribute in products 'extended_info' (https://github.com/woocommerce/woocommerce-admin/pull/1478)
* Add 'variations' attribute in products 'extended_info'

* Add tests
2019-02-07 09:27:02 +01:00
Joshua T Flowers 2b0c8089c0 Try: Fix failing returning customer test (https://github.com/woocommerce/woocommerce-admin/pull/1496)
* Don't check against same order when checking for returning customer

* Sleep between order creation

* Add todo removal comments for sleep functions
2019-02-07 15:49:56 +08:00
Jeff Stieler 28739b7cf7 Return a success code when syncing order products in the case of refunds.
On the initial sync, no products will be deleted by the sync method (which was indicating a false negative before this fix).
2019-02-06 19:16:30 -08:00
Jeff Stieler 56a1a30224 Skip processing `shop_order_refund`s when syncing coupon and tax lookup tables. 2019-02-06 19:15:06 -08:00
Jeff Stieler ea39313a60 Avoid false positives when rescheduling dependent queued actions. 2019-02-06 19:11:35 -08:00
Peter Fabian dd947044b9 Changed the date_created columns to datetime.
date_created should store local date and time, not UTC timestamp, as the data needs to be sliced and diced by local date/time, not by UTC date/time.
2019-02-06 19:13:57 +01:00
Joshua T Flowers b7379def1b Format todo comments to match WC Core format (https://github.com/woocommerce/woocommerce-admin/pull/1474)
* Format todo comments to match WC Core format

* Remove variations todo comment
2019-02-06 14:41:53 +08:00
Claudio Sanches b7c40c2c29 Merge pull request woocommerce/woocommerce-admin#1461 from woocommerce/fix/1460
Fixed database prefixes for admin notes tables
2019-02-05 16:21:43 -02:00
Claudio Sanches d26e82b526 Merge branch 'master' into fix/1307 2019-02-05 16:20:08 -02:00
Claudio Sanches 86c3c00480 Clean tables when order is deleted 2019-02-05 16:15:39 -02:00
Justin Shreve 949afce248 Add Product Detail Report & Finish Comparison Chart Mode Functionality (https://github.com/woocommerce/woocommerce-admin/pull/1391)
Product detail report and comparison

Code cleanup

Fix 404 on product variations endpoint after rebase

Fix up tests

Fix loading indicators and add some checks around malformed variation response

Add date filtering SQL bits to the variations query

Handle PR feedback: Fix viewport, fix duplicate product issue, fix legend display reset, fix bargraph overflow, fix some coding standards/whitespace, add extra variation santiziation.

Fix scroll on wide charts, and fix undefined prop getting passed into report chart render
2019-02-05 13:12:58 -05:00
Peter Fabian ff129d948c Merge pull request woocommerce/woocommerce-admin#1383 from woocommerce/fix/1012-2
Fixes for ordering and zero-filling.
2019-02-05 19:08:06 +01:00
Claudio Sanches 10f40d4cf3 Merge branch 'master' into fix/1307 2019-02-05 15:48:59 -02:00
Claudio Sanches e0004eb461 Merge branch 'master' into feature/754 2019-02-05 15:42:34 -02:00
Peter Fabian b69d2aa2ab Merge branch 'master' into fix/1012-2
# Conflicts:
#	tests/reports/class-wc-tests-reports-orders-stats.php
2019-02-05 18:34:15 +01:00
Joshua T Flowers 3aaf318779 Exclude trashed orders from reports (https://github.com/woocommerce/woocommerce-admin/pull/1464) 2019-02-05 10:57:38 +08:00
Claudio Sanches 58cdf6a7f9 Fixed hook names 2019-02-04 16:02:49 -02:00
Claudio Sanches a1976bc1bc Improve action/hook naming 2019-02-04 15:58:37 -02:00
Jeff Stieler 11d18a8b5b Queue individual order syncing instead of handling immediately. 2019-02-04 09:18:49 -07:00
Jeff Stieler 9f3c95ae63 Rework lookup table data store sync methods to return a meaningful status. 2019-02-04 09:09:44 -07:00
Jeff Stieler 9b1f6999aa Add action argument support when scheduling dependent actions. 2019-02-04 09:06:44 -07:00
Joshua T Flowers a4f7fcdfe3 Fix variation search autocompleter invalid route (https://github.com/woocommerce/woocommerce-admin/pull/1448) 2019-02-04 10:49:58 +08:00
Claudio Sanches 464ec09d38 Merge branch 'feature/754' of github.com:woocommerce/wc-admin into feature/754 2019-02-01 18:32:41 -02:00
Claudio Sanches 48ef33636f Removed extra function from conflicts 2019-02-01 18:31:10 -02:00
Claudio Sanches 8c0c01a3da Merge branch 'master' into feature/754 2019-02-01 18:27:23 -02:00
Claudio Sanches 31e8dc9332 Merge branch 'master' into fix/1307 2019-02-01 18:24:26 -02:00
Peter Fabian 32f851be5b Merge pull request woocommerce/woocommerce-admin#1286 from woocommerce/fix/1035
Added segmenting support to REST API
2019-02-01 20:50:38 +01:00
Claudio Sanches 4c71e78222 Fixed database prefixes
Moved from woocommerce_ to wc_
2019-02-01 17:23:07 -02:00
Claudio Sanches 93f9ec8ae8 Docblocks 2019-02-01 17:10:31 -02:00
Claudio Sanches e41a81f8b9 Updated woocommerce_trash_note to woocommerce_delete_note
Admin notes doesn't handle statuses, so it's not possible to move to
trash and restore admin notes, all admin notes are permanently deleted.
2019-02-01 17:08:43 -02:00
Claudio Sanches 707067e255 Docblocks 2019-02-01 17:02:15 -02:00
Claudio Sanches cd55051da3 New actions for when deleting objects from database 2019-02-01 16:29:14 -02:00
Claudio Sanches 68e0c98828 New action name: woocommerce_delete_reports_order_stats 2019-02-01 16:10:00 -02:00
Claudio Sanches 07f3f33566 Introduced new hooks for jetpack sync 2019-02-01 15:43:24 -02:00
Peter Fabian 663e454b8f Fixed schema: type and enum for segment_id. 2019-02-01 18:30:39 +01:00
Peter Fabian 9c52155d40 Merge pull request woocommerce/woocommerce-admin#1446 from woocommerce/fix/1445
Added primary key to tax lookup table to prevent duplicate entries.
2019-02-01 17:52:59 +01:00
Peter Fabian c2bcad2e50 Merge branch 'master' into fix/1012-2 2019-02-01 13:32:35 +01:00
Peter Fabian 8bc4c70cae Added primary key to tax lookup table to prevent duplicate entries. 2019-02-01 10:23:59 +01:00
Peter Fabian 40b9458f8d Added indices for faster joins with customer table and filtering by order status. 2019-01-31 10:54:55 +01:00
Joshua T Flowers e65247c54e Add SKU to product variations table (https://github.com/woocommerce/woocommerce-admin/pull/1422)
* Add SKU to product variations data store extended info

* Show SKU in product variations table

* Add sku tests for product variation reports
2019-01-31 09:27:15 +08:00
Joshua T Flowers 49e78b90cf Add settings page with excluded order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1364)
* Add settings page routes

* Add control options for excluded statuses

* Add control options for excluded statuses

* Add excluded order statuses to rest api

* Add wc settings to wc-api

* Add wc settings to wc-api

* Split and validate multiselect values in settings controller

* Add wcAdminSettings to wcSettings global

* Set initial excluded statuses from serverside wcSettings data

* Add extensible filter for wcSettings global

* Split arrays into comma separated strings in wc-api

* Extract setting as separate component

* Extra settings to config file

* Add checkboxGroup option as input type

* Separate status types into default and custom groups

* Add setting option styling

* Add responsive styling for settings

* Fix wpClosedMenu and wpOpenMenu for settings page

* Add support for resetting to default values

* Only show checkbox group if options are available

* Add proptypes to Setting component

* Add extensible filter to analytics settings

* Add readme for settings config and extensibility

* Hook up excluded status settings to reports

* Pass object to settings API instead of comma delimited string

* Fix inpuType -> inputType typo

* Remove hasError from constructor

* Bump settings API to v4

* Use interpolateComponents instead of dangerously setting html

* Use empty array in initial excldued statuses setting value if none is retrieved

* Remove double check for refunded status in default order statuses

* Update settings wc-api to use namespace

* Add aria=labelledby to checkbox group
2019-01-31 09:04:11 +08:00
Peter Fabian 0ddc6d5e41 Added segmenting code for taxes/stats. 2019-01-30 18:36:20 +01:00
Peter Fabian 0d95552157 Added segmentby to schema, query arguments and allows parameters in the controller for taxes/stats. 2019-01-30 12:16:37 +01:00
Albert Juhé Lluveras 08dfea7cff Add Taxes REST controller override (https://github.com/woocommerce/woocommerce-admin/pull/1407) 2019-01-30 10:43:30 +01:00
Claudio Sanches b0b506b397 Introduced new methods to clean up data when an order is deleted 2019-01-29 19:13:06 -02:00
Claudio Sanches 766fdeeada Remove extra validation 2019-01-29 18:50:44 -02:00
Claudio Sanches 272203b879 Introduced new woocommerce_reports_orders_stats_data_deleted hook 2019-01-29 18:50:15 -02:00
Peter Fabian 6efef57cba Factored out order-related product-level calculations to WC_Admin_Order and plugged it into the WC framework. 2019-01-29 19:57:04 +01:00
Peter Fabian e56009cfdc Updated todo format to be in line with the rest of WooCommerce. 2019-01-29 13:29:50 +01:00
Peter Fabian a3ae15d58e Removed obsolete comment. 2019-01-29 12:52:20 +01:00
Peter Fabian bee26375f9 Validate limit clause and set empty default if there is no limit. 2019-01-29 12:18:30 +01:00
Peter Fabian c2eaf6d71c Replaced REST exception with a custom exception and handle it in REST controllers. 2019-01-29 12:13:52 +01:00
Peter Fabian e4e09b4c39 Merge branch 'master' into fix/1035 2019-01-29 10:01:41 +01:00
Paul Sealock 765a007491 tweeek 2019-01-29 12:08:44 +13:00
Paul Sealock e6b42631f3 formatting 2019-01-29 11:48:40 +13:00
Paul Sealock 41bec03880 tweeks 2019-01-29 11:28:58 +13:00
Paul Sealock 370a747c2b add registered 2019-01-29 11:05:27 +13:00
Paul Sealock 483c199fbf tests working 2019-01-29 10:53:56 +13:00
Paul Sealock c6d1ce98c0 rest_validate_between_date_arg 2019-01-29 10:45:49 +13:00
Paul Sealock 2f022ffdba dry interval.php 2019-01-29 10:23:44 +13:00
Paul Sealock 3d0890a704 basic working 2019-01-29 09:21:11 +13:00
Paul Sealock bca0785e64 Customers Report: support between args for dates 2019-01-29 08:58:07 +13:00
Jeff Stieler 7592dae4bb Merge pull request woocommerce/woocommerce-admin#1385 from woocommerce/add/customers-report-table-summary
Add table summary to Customers Report
2019-01-28 09:59:52 -07:00
Peter Fabian 71dc581f53 Merge pull request woocommerce/woocommerce-admin#1394 from woocommerce/fix/1393
Added zero-filling for intervals for taxes/stats endpoint
2019-01-28 13:09:02 +01:00
Joshua T Flowers 9c9ff13c2b Allow customer date_last_active to be null (https://github.com/woocommerce/woocommerce-admin/pull/1377)
* Allow customer date_last_active to be null

* Only show last active in customers report table if set
2019-01-25 09:37:50 -08:00
Peter Fabian b87ca4f6aa Added filling in zeros for interval not having records in the database. 2019-01-25 14:54:14 +01:00
Peter Fabian c8c9cd4943 Updated error message to point to the correct report. 2019-01-25 13:30:27 +01:00
Peter Fabian 4c8a95cb89 Added fetching of db intervals for later use in zero-filling. 2019-01-25 13:29:59 +01:00
Peter Fabian 1c09b6836d Adjusted default return value when page is out of range. 2019-01-25 13:14:41 +01:00
Jeff Stieler 6a215ceca9 Exclude customers with no orders from average orders count calculation. 2019-01-23 17:47:44 -07:00