Commit Graph

747 Commits

Author SHA1 Message Date
Joshua T Flowers 929ad8bf63 Remove unused categories in orders data store (https://github.com/woocommerce/woocommerce-admin/pull/1928) 2019-03-28 10:25:00 +08:00
Joshua T Flowers 896a790d8f Check if customer creation date is not null before formatting (https://github.com/woocommerce/woocommerce-admin/pull/1926) 2019-03-27 11:46:47 +08:00
Jeff Stieler 0013495fff Orders endpoint: add LIMIT clause to the order number query. 2019-03-26 11:22:50 -06:00
Joshua T Flowers ebac101b51 Don't query products all products for empty categories (https://github.com/woocommerce/woocommerce-admin/pull/1911) 2019-03-26 13:21:46 +08:00
ronakganatra9 ce6fcdabbe woocommerce/woocommerce-admin#1830 Fix/1830 move all note php files to subfolder (https://github.com/woocommerce/woocommerce-admin/pull/1879)
* added notes/ folder and moved notes file in it..

* Path changes according to new folder.

* typo correct
2019-03-26 00:18:34 +01:00
Joshua T Flowers f5568b905b Automatically update versions on build (https://github.com/woocommerce/woocommerce-admin/pull/1877)
* Get plugin file version for version compare

* Add version update script before build

* Replace version getter with a defined version constant
2019-03-25 14:43:26 +08:00
Jeff Stieler 2d8f8f9137 Merge pull request woocommerce/woocommerce-admin#1848 from woocommerce/add/1756-snooze-admin-notes
Add "remind me later" functionality to StoreAlert component.
2019-03-21 08:41:44 -06:00
Albert Juhé Lluveras 1cf134d1fa Fix PHP notices on orders data store (https://github.com/woocommerce/woocommerce-admin/pull/1870) 2019-03-21 15:35:25 +01:00
Jeff Stieler 731a131894 Add recurring job to “unsnooze” admin notes. 2019-03-20 08:52:27 -06:00
Jeff Stieler 276a6e6744 Hook up “remind me later” button.
Update the admin note status and date_reminder fields.
2019-03-20 08:52:27 -06:00
Jeff Stieler 7892ade278 Properly coerce snooze flag to API response. 2019-03-20 08:52:27 -06:00
Jeff Stieler 2eecb6c375 Add “is snoozable” flag to WC_Admin_Note. 2019-03-20 08:52:22 -06:00
Paul Sealock 7f0aa7e616 Merge pull request woocommerce/woocommerce-admin#1835 from woocommerce/fix/product-search-multiple-results
Products: Group API search items by id
2019-03-20 07:09:53 +13:00
Albert Juhé Lluveras 58154d1d39 Activity Panel: set orders unread indicator based on real data (https://github.com/woocommerce/woocommerce-admin/pull/1824) 2019-03-19 11:57:11 +01:00
Paul Sealock 0aef533d6a Products: Group API search items by id 2019-03-19 16:36:47 +13:00
Joshua T Flowers d416f78e9f Update/variations search method (https://github.com/woocommerce/woocommerce-admin/pull/1792)
* Add product search option REST API

* Remove product_name search in favor of sku and name searching

* Search by product search term instead of generic search in autocompleter

* Add product search option REST API

* Override existing search param instead of new param

* Remove product_name search in favor of sku and name searching

* Add product search param to variations controller

* Add group by to prevent duplicate variations in response

* Use product_search in variation autocompleter

* Trim whitespace in product_search query

* Change variation search placeholder

* Override search param instead of using new product_search param

* Add baseSearchQuery to prevent losing single_product filter in variations report

* Unset s param instead of setting to false
2019-03-18 12:23:08 +08:00
Joshua T Flowers 7653859509 Update product searching to search by name or sku (https://github.com/woocommerce/woocommerce-admin/pull/1791)
* Add product search option REST API

* Remove join and where filters for wp_query after rest response

* Remove product_name search in favor of sku and name searching

* Allow searching for products to compare by product sku

* Search by product search term instead of generic search in autocompleter

* Trim whitespace on product_search query

* Override existing search param instead of new param

* Use double quotes to avoid escaping search query

* Unset s param instead of setting to false
2019-03-18 11:31:02 +08:00
Jeff Stieler f08fda5271 Merge pull request woocommerce/woocommerce-admin#1813 from woocommerce/add/1699-clear-jobs
Add a custom “cancel all” method to our scheduled action data store.
2019-03-15 15:00:52 -06:00
Albert Juhé Lluveras e6cf40e3f0 Allow sorting by tax_code in Taxes report (https://github.com/woocommerce/woocommerce-admin/pull/1812) 2019-03-15 21:44:03 +01:00
Joshua T Flowers fae447014f Update coupon search to allow searching by code (https://github.com/woocommerce/woocommerce-admin/pull/1800)
* Add coupon code search filtering to REST API

* Use search_code param in coupon search results

* Use search_code param in coupon autocompleter

* Override search param instead of adding search_code param
2019-03-15 12:29:14 +08:00
Joshua T Flowers 9d58f8ca58 Fix deleted coupon data sync (https://github.com/woocommerce/woocommerce-admin/pull/1753)
* Delete coupon from lookup table when permanently deleted

* Don't sync null ID coupons on order sync
2019-03-14 12:12:35 +08:00
Paul Sealock f4ec9a7665 products/stats: filter segmented products by category 2019-03-14 07:51:55 +13:00
Jeff Stieler d6fa5b58f6 Update our schedule actions to “trash” status and let Action Scheduler handle cleanup. 2019-03-13 11:48:38 -06:00
Jeff Stieler bfe5a75e98 Update text domain. (https://github.com/woocommerce/woocommerce-admin/pull/1795)
* Translation call text domain change from “wc-admin” to “woocommerce-admin”.

* Fix .pot file generation.

* Fix errantly closed array item in /revenue/stats controller.

* Rename plugin zip, main file, and repo name to "woocommerce-admin".
2019-03-13 11:14:02 -06:00
Paul Sealock 00eb04255f Merge pull request woocommerce/woocommerce-admin#1750 from woocommerce/fix/deleted-product-error
Fix deleted product error
2019-03-13 12:06:22 +13:00
Justin Shreve 1348245406 Add store notice around processing historical data. (https://github.com/woocommerce/woocommerce-admin/pull/1763)
* Add store notice around processing historical data.

* Cleanup

* Handle PR feedback.

* Clean up `add` logic and add empty content_data. Also add logic to get_notes_count so that we can hide unactioned statuses.

* Add the ability to update a note, and to also mark a status when an alert is clicked.

* Remove mark_actioned call on sync

* add missing todo
2019-03-12 09:13:20 -04:00
Albert Juhé Lluveras 6c9b96f49a Make variations and coupons endpoints return zero-value items (https://github.com/woocommerce/woocommerce-admin/pull/1765)
* Make categories endpoint return zero-value items

* Rename PHP variable to make it more specific

* Remove uneeded lines

* Make variations and coupons endpoints return zero-value items

* Remove second parameter from get_ids_table
2019-03-12 11:11:28 +01:00
Albert Juhé Lluveras d3230d8dae Make categories endpoint return zero-value items (https://github.com/woocommerce/woocommerce-admin/pull/1755)
* Make categories endpoint return zero-value items

* Rename PHP variable to make it more specific

* Remove uneeded lines

* Remove second parameter from get_ids_table
2019-03-12 10:50:53 +01:00
Albert Juhé Lluveras cf162dda7f Taxes report: sort tax rates numerically instead of alphabetically (https://github.com/woocommerce/woocommerce-admin/pull/1766)
* Taxes report: sort tax rates numerically instead of alphabetically

* Use DECIMAL(7,4) for tax_rate sorting
2019-03-12 10:31:19 +01:00
Paul Sealock fd019c4c35 Chart: don't switch to comparison mode directly 2019-03-12 12:03:58 +13:00
Jeff Stieler 04db0e2b8d Add a custom “cancel all” method to our scheduled action data store.
Performs direct database manipulation for performance (with large datasets).
2019-03-08 18:41:59 -07:00
Tiago Noronha 965a4a6cb5 Merge pull request woocommerce/woocommerce-admin#1758 from woocommerce/fix/1736
Add StoreAlerts placeholder
2019-03-08 19:52:57 +00:00
Jeff Stieler a50a9bccb1 Ensure that other scheduled actions are claimed before WC Admin actions. (https://github.com/woocommerce/woocommerce-admin/pull/1759)
* Use menu_order to lower the claim priority of WC Admin scheduled actions.

* Use a ActionScheduler_Store subclass to modify menu_order.

* Check to make sure we’re overriding only AS’s built in WP Post data store.
2019-03-08 11:59:32 -07:00
Tiago Noronha 2e2fb90cde Add support for notes count by note type 2019-03-08 15:17:24 +00:00
Albert Juhé Lluveras d2c0dd5555 Make products and rates endpoints return zero-value items (https://github.com/woocommerce/woocommerce-admin/pull/1722)
* Make products endpoint return zero-value items

* Make rates endpoint return zero-value items

* Several fixes

* Add tests

* Simplify code

* Merge both queries into one to simplify code

* Rename 'get_outer_from_sql_params' to 'get_from_sql_params'
2019-03-06 12:36:43 +01:00
Joshua Flowers b1890190c7 Get product ID for line item from meta table instead of deleting 2019-03-06 16:03:54 +08:00
Joshua Flowers c6c71b0238 Delete product IDs from lookup table on delete 2019-03-06 15:09:38 +08:00
Joshua Flowers 1715e98b98 Don't fetch extended attributes if product doesn't exist 2019-03-06 14:25:59 +08:00
Joshua T Flowers 4d80cad52e Add rebuild tool to settings page (https://github.com/woocommerce/woocommerce-admin/pull/1737)
* Add button input type to analytics settings

* Add callback prop and disabled state to setting

* Add rebuild tool to settings page

* Re-enable setting if error is caught

* Remove rebuild tool from system tools page

* Move report build success message to API response

* Add back key for settings map

* Fix misspelled option group classname

* Conditionally add rebuild tool to non-wc-status page instead of removal hook
2019-03-06 13:32:05 +08:00
Justin Shreve 008963d72f Don't queue lookup tables on activiation (https://github.com/woocommerce/woocommerce-admin/pull/1741) 2019-03-05 22:10:22 -05:00
Timmy Crawford 0650524977 remove unused file (https://github.com/woocommerce/woocommerce-admin/pull/1733) 2019-03-05 07:41:58 -08:00
Peter Fabian 99e88706ad Merge pull request woocommerce/woocommerce-admin#1681 from woocommerce/fix/1476-2
Updated is_returning_customer definition to use refactored function.
2019-03-05 13:00:07 +01:00
Justin Shreve b7d36c90e8 Clear scheduled actions on plugin deactivate (https://github.com/woocommerce/woocommerce-admin/pull/1715) 2019-02-28 16:47:58 -05:00
Justin Shreve fce16ade7a Display order number on reports (https://github.com/woocommerce/woocommerce-admin/pull/1706)
* Display order number on reports, and add to API response.

* Add method for getting order number, avoiding loading the data store if no filter is attached.
2019-02-28 09:14:21 -05:00
Joshua T Flowers 241be1f547 Add product name filtering (https://github.com/woocommerce/woocommerce-admin/pull/1670)
* Add post_title__like param to wp query

* Add product_name filter option to products rest controller

* Change autocomplete search to use product_name param

* Change add_wp_query_post_title_filter to static method

* Only add wp_query filter in the products rest controller
2019-02-27 16:49:21 +08:00
Joshua T Flowers 6a18202f61 Add tax include param to tax REST API (https://github.com/woocommerce/woocommerce-admin/pull/1672)
* Add code to collection params to allow searching

* Add include param to tax rest api

* Remove duplicate get_collection_params

* Revert to previous taxes getLabel config
2019-02-27 10:37:24 +08:00
Joshua T Flowers 13b72f2fde Add tax code filter to tax REST API (https://github.com/woocommerce/woocommerce-admin/pull/1671)
* Add in hook to rest tax controller modify tax items query

* Modify query string for getting tax code items

* Add code to collection params to allow searching

* Change filter to use entire tax code without null values

* Hook up tax code filter to autocomplete search

* Overwrite get_items instead of using hooks for code filtering
2019-02-26 14:19:38 +08:00
Ron Rennick 39226c8c2c Merge pull request woocommerce/woocommerce-admin#1664 from woocommerce/add/action-scheduler-group
add action scheduler group
2019-02-25 16:13:15 -04:00
Peter Fabian 1b90296bba Updated timezone handling to be in line with other WC code. 2019-02-25 20:05:25 +01:00
Paul Sealock a3e4955f74 Merge pull request woocommerce/woocommerce-admin#1571 from woocommerce/fix/taxes-segmentation
Taxes Report: fix comparison mode and segmentation labels
2019-02-25 11:31:37 +13:00
Peter Fabian 3f9a43fdd0 Added timezone to datetime to correctly identify first order(s).
If default PHP timezone is UTC, then any order between first order and positive UTC offset is identified as 'first', which is incorrect.
2019-02-23 18:38:45 +01:00
Peter Fabian 3ce686e6cd Updated is_returning_customer definition to use refactored function. 2019-02-22 22:06:21 +01:00
Paul Sealock 62a6b619d9 Taxes Report: allow segmentation by tax 2019-02-22 11:37:15 +13:00
Ron Rennick 0a4d98fb9f fix warning in some versions of PHP 2019-02-21 15:59:09 -04:00
Ron Rennick 4cad583332 add action scheduler group 2019-02-21 15:44:35 -04:00
Justin Shreve 2af0aedd95 Add comparison support to the coupons report (https://github.com/woocommerce/woocommerce-admin/pull/1647) 2019-02-21 10:16:44 -05:00
Ron Rennick 3aa1f6197a Merge pull request woocommerce/woocommerce-admin#1591 from woocommerce/fix/1590
implement WC_ADMIN_ABSPATH in wc-admin.php, class-wc-admin-api-init.php
2019-02-20 09:42:07 -04:00
Joshua T Flowers aef11ef586 Refactor customer ID creation (https://github.com/woocommerce/woocommerce-admin/pull/1619)
* Fix indendtation for table creations

* Refactor how customers are created on order update

* Check if user has a role of customer or previous orders before storing

* Add tests for user creation

* Allow null emails for customers

* Only select customer_id in guest ID query
2019-02-20 10:30:00 +08:00
Joshua T Flowers 08e43c35cf Execute single order pending jobs immediately when wp_debug is enabled (https://github.com/woocommerce/woocommerce-admin/pull/1581)
* Execute all pending jobs when debug mode is enabled

* Only process single order jobs immediately

* Replace wp_debug condition with a filter

* Bypass scheduling and process the order on save_post

* Change hook name to include order
2019-02-20 10:05:11 +08:00
Joshua T Flowers 73ff2d37e8 Update activity panels order endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1578)
* Only show customer name if available

* Map customer data to extended_info in orders API response

* Add gross total and refund total to orders API response

* Hook up report orders endpoint to activity panel orders

* Add on-hold orders to activity panel orders

* Destructure extended_info in case of filtering

* Add customer link to orders panel
2019-02-20 09:51:43 +08:00
Joshua T Flowers 44604bcd02 Reduce net order total by refunded amount less tax and shipping refunds (https://github.com/woocommerce/woocommerce-admin/pull/1600)
* Reduce net order total by refunded amount less tax and shipping refunds

* Fix net_totals in tests with refunds
2019-02-20 09:39:42 +08:00
Justin Shreve 4f64358c8e Fix customer filters and download user filtering (https://github.com/woocommerce/woocommerce-admin/pull/1618)
* Add the ability to search name, username, and email fields on the customer endpoint, update autocompletors, add in include parameter.

* Update the username to be returned in the download response, update download filtering based on customer id, and only rename include parameter on main customers endpoint.
2019-02-19 14:35:29 -05:00
Ron Rennick e1af3cdf18 implement WC_ADMIN_ABSPATH in class-wc-admin-api-init.php 2019-02-19 15:27:42 -04:00
Joshua T Flowers f0ec3c49a1 Add tax refund calculations (https://github.com/woocommerce/woocommerce-admin/pull/1556)
* Add item and shipping refund calucations to taxes on order update

* Sync taxes on refund delete

* Fix up tax stats API testing

* Add refunds to tax stats API tests
2019-02-18 10:20:16 +08:00
Peter Fabian f42aa073b1 Changed the date_created columns to datetime, in the new location of db create script.
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-15 17:13:12 +01:00
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
Peter Fabian 64f1418f22 Merge branch 'master' into fix/1012-2 2019-01-23 21:40:09 +01:00
Peter Fabian 33f1240987 Fix to remove extra intervals correctly. 2019-01-23 17:18:39 +01:00
Peter Fabian eff341d832 Made the interval sorting stable (second level sort by time_interval).
This is required so that intervals are sorted in the same way each time when going through pages of results.
2019-01-23 16:58:03 +01:00
Peter Fabian bc42e6d985 Fixed bug introduced during refactoring. 2019-01-23 10:34:55 +01:00
Peter Fabian 507ee13825 Merge branch 'master' into fix/1035
# Conflicts:
#	client/analytics/report/customers/table.js
#	includes/api/class-wc-admin-rest-reports-orders-stats-controller.php
#	tests/reports/class-wc-tests-reports-orders-stats.php
2019-01-23 10:13:55 +01:00
Peter Fabian 012e14c589 Corrected time-calculation of last interval. 2019-01-22 19:50:35 +01:00
Peter Fabian 8a9a2c0673 Fixed interval arithmetic for hours and days. 2019-01-22 17:49:02 +01:00
Justin Shreve 1f8caf106e Fix performance-indicators/allowed schema. 2019-01-21 12:28:32 -05:00
Joshua T Flowers 3ac97e00c4 Add single category filter to products report (https://github.com/woocommerce/woocommerce-admin/pull/1350)
* Add namespace v4 for WC product/categories endpoint

* Update categories wc-api to use v4 namespace constant

* Add single product category filter to product categories report

* Add link to filtered product report from category report

* Use persistedQuery for category links

* Check if category is defined before displaying category link

* Remove selectedTags when filter does not match queried filter
2019-01-22 01:12:00 +08:00
Joshua T Flowers 4869401ec4 REST API: Allow sorting by stock_status in stocks endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1335)
* REST API: Allow sorting by stock_status in stocks endpoint

* Set stock_status as default orderby

* Sort by both stock status and quantity in meta query

* Use stock_status sort order by default in Stock table (https://github.com/woocommerce/woocommerce-admin/pull/1340)

* Reverse stock quantity order when sorting by stock status
2019-01-22 01:11:20 +08:00
Jeff Stieler 4a6f2652b6 Hook customers report table summary up to stats endpoint. 2019-01-21 08:46:21 -07:00
Jeff Stieler 07cbaae2a5 Add customers report stats endpoint. 2019-01-18 20:29:50 -07:00
Justin Shreve 2f60837ba5 Add performance indicators to dashboard (https://github.com/woocommerce/woocommerce-admin/pull/1343)
* Add label and generated report URL to the performance indicator response.

* Hook up performance indicators to the REST API

* Handle PR feedback

* Fix setting default values
2019-01-18 14:22:11 -05:00
Justin Shreve 7c418a4a45 Add v4 of the data/countries filter so that the country autocompleter work and a notice goes away. (https://github.com/woocommerce/woocommerce-admin/pull/1354) 2019-01-18 14:17:12 -05:00
Peter Fabian f2634ca5c8 Added support for segmenting to coupons/stats. 2019-01-18 17:11:46 +01:00
Justin Shreve 01b96ebea5 Hook up performance indicators to the REST API 2019-01-18 08:19:19 -05:00
Justin Shreve 96fc10747f Add label and generated report URL to the performance indicator response. 2019-01-18 08:16:52 -05:00
Peter Fabian e8f264c346 Moved common code to parent class. 2019-01-18 14:08:34 +01:00
Peter Fabian ea2f5ca5d9 Fixed number of parameters for product lookup update. 2019-01-18 13:07:19 +01:00
Peter Fabian caea199852 Updated revenue/stats REST controller to include segmentation options/fields. 2019-01-18 13:06:40 +01:00
Peter Fabian 128f52fdc8 Restrict products/stats only to supported segmentby options. 2019-01-18 12:28:12 +01:00
Peter Fabian 1d79714295 Added segmenting to products/stats. 2019-01-18 11:41:15 +01:00
Joshua T Flowers 7cdbbf87e8 Update all wc-admin endpoints to v4 (https://github.com/woocommerce/woocommerce-admin/pull/1298)
* Update all wc-admin endpoints to v4

* Add namespace for products and customers controllers

* Include product quantity in orders data store

* Add coupons to extended data in the orders data store

* Format order statuses response from database

* Hook up orders table to orders endpoint

* Add namespace to data endpoint controller

* Add namespaces to remaining extended controllers

* Use NAMESPACE var in place of wc/v4

* Update product links in orders table to products reports

* Add coupons rest controller override

* Format coupon code in response

Co-Authored-By: joshuatf <joshuatf@gmail.com>
2019-01-18 10:52:58 +08:00
Jeff Stieler 4407e05bc4 Merge pull request woocommerce/woocommerce-admin#1342 from woocommerce/fix/1090-currency-settings-formatting
Honor WooCommerce Settings When Formatting Currency/Price
2019-01-17 17:06:13 -07:00
Peter Fabian 25bb5e06df Factor out the segmentation code so that it's more reusable and clutters orders/stats data store less. 2019-01-17 12:14:24 +01:00
Jeff Stieler ddae6d3955 Add currency symbol to orders endpoint response. 2019-01-17 00:01:09 -07:00
Joshua T Flowers da22cbdc9d Update returning customer data to use customer ID (https://github.com/woocommerce/woocommerce-admin/pull/1180)
* Change check for returning customers to check customer_id

* Count distinct returning and new customers in totals

* Fix priority action misplacement and order date timestamp

* Change expected num returning/new customers to fix failing tests

Previously these included references to number of returning vs new orders.  Update to refer to the newly updated customer count.

* Use new get_customer_id_by_user_id() to get customer ID

* Fix 0 returning customers expectation

* Move returning customer function to order stats data store

* Sync order stats on order delete

* Change date compare for is_returning_customer

* Add test case for returning customer order

* Add references to  instead of 2
2019-01-17 10:47:30 +08:00
Jeff Stieler 149ee08f4b Include all users in customer lookup table generation. 2019-01-16 10:20:11 -07:00
Jeff Stieler 11cb74cccd Fix variable name nitpick. 2019-01-16 09:45:52 -07:00
Jeff Stieler a2f94c11ba Add coupons and taxes lookup table generation to reports rebuild. 2019-01-16 09:45:51 -07:00
Jeff Stieler 84732137bc Bail out of creating batches for customers and orders if there are none. 2019-01-16 09:45:51 -07:00
Jeff Stieler ffe11650a8 Remove now-defunct order stats background process. 2019-01-16 09:45:50 -07:00
Jeff Stieler 763cc972a7 Regenerate all reports from rebuild stats endpoint. 2019-01-16 09:45:04 -07:00
Jeff Stieler 5c6174066e Add tests for report regeneration batch queuing methods. 2019-01-16 09:45:04 -07:00
Jeff Stieler 4786938bdf Fix customers report tests. 2019-01-16 09:45:03 -07:00
Jeff Stieler 6eca20c5fd Reports regenerate: add mechanism to queue an action after another completes - use to queue orders lookup init after customers lookup. 2019-01-16 09:45:03 -07:00
Jeff Stieler 4740f93985 Reports regenerate: use queue to update order stats and products lookup table. 2019-01-16 09:45:02 -07:00
Jeff Stieler 3b9a4ef4a1 Report regeneration: allow batch sizes to differ between actions. 2019-01-16 09:45:02 -07:00
Jeff Stieler fabc1dc70b Reports regenerate: use queue to update customers lookup table. 2019-01-16 09:45:02 -07:00
Jeff Stieler c361119a0d Report table generation: add method for enqueuing a large number of batch jobs with a limited batch size. 2019-01-16 09:45:01 -07:00
Peter Fabian 05c7670090 Merge branch 'master' into fix/1035
# Conflicts:
#	includes/class-wc-admin-reports-interval.php
#	includes/data-stores/class-wc-admin-reports-data-store.php
#	includes/data-stores/class-wc-admin-reports-products-data-store.php
2019-01-16 12:51:23 +01:00
Joshua T Flowers 33a7cfa1b0 Store all order statuses (https://github.com/woocommerce/woocommerce-admin/pull/1285)
* Store all orders regardless of status in wc_order_stats

* Only query select statuses if status_is or status_is_not is not set

* Fix order stats example query

* Filter category store by default order statuses

* Add table_name to interval functions to avoid ambiguity

* Filter coupon store by default order statuses

* Fix interval stats by adding table_name to interval function

* Filter products store by default order statuses

* Remove unused order_status in coupons data store

* Store products with any order status

* Fix ambiguous order by call in products data store

* Apply status filter after other filters to avoid logical OR matching

* Store all coupon data regardless of order status

* Filter taxes by default order statuses

* Filter customer stats by default order status

* Filter default order statuses in variations data store

* Use excluded statuses to filter reports by default

* DRY up default excluded statuses query

* Fix up new orders data store after rebase
2019-01-16 10:23:00 +08:00
Peter Fabian c324157483 Merge branch 'master' into fix/1035
# Conflicts:
#	includes/data-stores/class-wc-admin-reports-orders-data-store.php
#	includes/data-stores/class-wc-admin-reports-orders-stats-data-store.php
2019-01-15 11:39:39 +01:00
Peter Fabian 2fc9de0bb0 Preparation for merge of a moved file. 2019-01-15 11:36:56 +01:00
Peter Fabian d067c2148d Added sorting of segments so that they have predictable order. 2019-01-15 11:13:43 +01:00
Peter Fabian ea2d5bfe35 Removed double refund subtracting. 2019-01-15 11:11:58 +01:00
Peter Fabian 93b331243b Corrected JSON response in case no fields are selected in $query_params. 2019-01-15 11:11:14 +01:00
Peter Fabian b593163dff Added more general function for sorting array of arrays based on subarray's key. 2019-01-15 11:08:23 +01:00
Joshua T Flowers 14f8f08edf Add v4 orders endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1246)
* Rename orders controllers and data store to order stats

* Add orders data store and controller

* Add coupon, product, and status filters

* Add customer type query filter

* Add extended info for products and categories

* Bump API namespace to v4

* Add missing schema properties

* Set default customer_type and extended_info params

* Add orders endpoint tests

* Only use one JOIN if both excluded and included queries are used

* Optimize query calls to get product and category data

* Split product and category fetch and limit to product_cat taxonomy
2019-01-15 09:53:02 +08:00
Peter Fabian 13ec8e2851 FOrmula for shipping distribution among line items updated to reflect qty, so that sum of shipping per line item equals total shipping amount. 2019-01-14 16:10:13 +01:00
Peter Fabian 562e21ff54 Replace time interval keys with numeric ones to format REST response correctly. 2019-01-11 18:20:43 +01:00
Peter Fabian 26925872ec Corrected return types so that no segmented queries work fine. 2019-01-11 15:25:17 +01:00
Peter Fabian ebe76c2d43 Added missing parameter to new data stores. 2019-01-11 15:23:13 +01:00
Peter Fabian 7308aa415b Schema updates. 2019-01-11 15:22:19 +01:00
Peter Fabian 5edc60d30b Added refund_total also to intervals (to be able to calculate net_total correctly). 2019-01-11 11:32:59 +01:00
Peter Fabian ff6b4ffb26 Added refund_total to unique orders table to be able to calculate net_total correctly. 2019-01-11 11:31:21 +01:00
Peter Fabian d14426cbc1 Corrected type of parameter in the docblock. 2019-01-11 11:30:43 +01:00
Peter Fabian 69f63f48d2 Ain't Nobody Got Time for That. 2019-01-11 11:25:49 +01:00
Peter Fabian 250c0910a1 Merge branch 'master' into fix/1035 2019-01-11 11:16:01 +01:00
Peter Fabian 411ff59788 WIP on orders/stats segmenting. 2019-01-11 11:11:23 +01:00
Jeff Stieler adf8bbeb23 Merge pull request woocommerce/woocommerce-admin#1260 from woocommerce/fix/1239-handle-between-rest-api-param
Handle *_between params in Reports controllers
2019-01-10 10:52:08 -07:00
Justin Shreve 350e296d2c Allow sorting by title and SKU to report tables (https://github.com/woocommerce/woocommerce-admin/pull/1266) 2019-01-10 12:10:31 -05:00
Jeff Stieler 2246a1e075 Expect array value for _between params.
Add param validation method and normalize to min/max based by comparing values.
2019-01-09 14:19:37 -07:00
Justin Shreve d46ce1df7a Add store performance indicator endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1255)
* Add store performance REST API endpoint

* Clean up validation, add list of allowed stats to OPTIONS endpoint, and rename endpoint to performance-indicators

* Add tests

* Add additional filters to make extending the performance indiciators area easier.

* Add docblocks for filters
2019-01-09 16:08:39 -05:00
Jeff Stieler 06763cc3a5 Don’t cast date values to strings in customers report data store since they’re allowed to be null.
NULL column values resulted in NOW() in the response.
2019-01-08 18:49:49 -07:00
Jeff Stieler 6e369bd145 Handle *_between parameters in Customers Report endpoint controller. 2019-01-08 17:41:48 -07:00
Jeff Stieler b15a4bc804 Add utility method to normalize numeric “between” parameters in REST API requests. 2019-01-08 17:41:24 -07:00
Jeff Stieler d9fd8568df Customers report: perform a LEFT JOIN on the order stats table to include customers that have not yet placed an order. 2019-01-08 10:47:19 -07:00
Jeff Stieler 46b503dd54 Update customers report lookup table when customers/users are updated. 2019-01-08 10:33:17 -07:00
Jeff Stieler 154482acc9 Derive orders_count, total_spend, avg_order_value, and date_late_order for customer reports from the order stats report table. 2019-01-08 10:33:17 -07:00
Jeff Stieler 8105ddb38a Add new guest customers to lookup when syncing the order stats report table. 2019-01-08 10:33:16 -07:00
Jeff Stieler 1a90840e97 Add customer_id to order stats report table to reference with customer lookup. 2019-01-08 10:30:16 -07:00
Jeff Stieler d42e04cd59 Short circuit registered customer data update when the given ID is bad. 2019-01-08 10:29:44 -07:00
Jeff Stieler a1317f2152 Customer lookup table: allow registration date to be null (for guests). 2019-01-08 10:29:43 -07:00
Jeff Stieler c337944cf6 Backfill guests into customer report lookup table using order data and billing email. 2019-01-08 10:29:43 -07:00
Jeff Stieler fa3379e62f Customer report data store: fix handling of ‘name’ parameter in WHERE clause. 2019-01-08 10:29:42 -07:00
Jeff Stieler 714c1ee030 Customer report data store: fix comparison operator for date param “after” where clause. 2019-01-08 10:29:42 -07:00
Jeff Stieler 737331dd3b Add missing _gmt date fields to customers report response items. 2019-01-08 10:29:41 -07:00
Jeff Stieler 04a30e668b Customer report data store: fix SQL when where clauses are empty. 2019-01-08 10:29:40 -07:00
Jeff Stieler 1832450fd1 Update customer lookup table when orders (with registered customers) are created, updated, or refunded. 2019-01-08 10:29:40 -07:00
Jeff Stieler 2ea61e9a86 Move registered customer lookup update logic into data store class. 2019-01-08 10:29:40 -07:00
Jeff Stieler d0e2c5162f Place a UNIQUE constraint on the user_id key for the customer report lookup table. 2019-01-08 10:29:39 -07:00
Jeff Stieler dd87522a5e Customers report endpoint: only include customer link if they’re a registered user. 2019-01-08 10:29:39 -07:00
Jeff Stieler fc20d2bb1b Remove unnecessary subquery from customer reports data store records count query. 2019-01-08 10:29:38 -07:00
Jeff Stieler a75a33c32f Handle match parameter in customers report data store.
Note: before/after and min/max ranges are always ‘AND’.
2019-01-08 10:29:38 -07:00
Jeff Stieler 97e6f795e9 Fix copy-pasta in customers report REST controller. 2019-01-08 10:29:38 -07:00
Jeff Stieler a180566c2f Set default parameters for customers report query. 2019-01-08 10:29:37 -07:00
Jeff Stieler 0c919add5d Fix query params in customers report controller. 2019-01-08 10:29:37 -07:00
Jeff Stieler 6e5fef2f7b Include customers report files. 2019-01-08 10:29:37 -07:00
Jeff Stieler 746120e254 Change customer report lookup table columns to match API parameters. 2019-01-08 10:29:36 -07:00
Jeff Stieler 9670719fc6 Add customers report query endpoint implementation. 2019-01-08 10:29:36 -07:00
Jeff Stieler b9f0d9fe5f Update customers report endpoint item schema to match (visual) table designs. 2019-01-08 10:29:35 -07:00
Jeff Stieler 56beada220 Update customers report endpoint parameters to match new lookup table filters. 2019-01-08 10:29:35 -07:00
Jeff Stieler a2154daa4c Register customer report lookup table with core WC. 2019-01-08 10:29:35 -07:00
Jeff Stieler 281c06a5d4 Add username column to customer report lookup table. 2019-01-08 10:29:34 -07:00
Jeff Stieler 9131932910 First pass at initializing the customer lookup table with existing registered customer data. 2019-01-08 10:29:34 -07:00
Jeff Stieler a5cf136037 Add customer report lookup table creation to initialization query. 2019-01-08 10:29:33 -07:00
Justin Shreve f37b9319e1 Download Report API: Add path to response, fix ordering, and fix schema typo (https://github.com/woocommerce/woocommerce-admin/pull/1248)
* Add download_path to download report endpoint and fix schema typo

* Fix ordering and add tests
2019-01-08 09:51:28 -05:00
Joshua T Flowers d9e7e1b952 Remove unused show_product_categories_in_rest function (https://github.com/woocommerce/woocommerce-admin/pull/1235) 2019-01-08 09:53:02 +08:00
Joshua T Flowers f3346e9298 Add the order status column to lookup table (https://github.com/woocommerce/woocommerce-admin/pull/1211)
* Add the order status column to lookup table

* Fix order status filter for order stats

* Fix normalize order status and make static function
2019-01-08 09:16:10 +08:00
Albert Juhé Lluveras 6ca0c628b2 Connect Downloads report to REST API (https://github.com/woocommerce/woocommerce-admin/pull/1238)
* Connect downloads chart and table to REST API

* Display date picker in Downloads report

* Fix missing value for 'days' in Downloads table summary

* Fix download_count being a string instead of a number

* Minor date packages comment fixes

* Fix filters in Downloads report

* Add back empty line

* JSDoc comments style fixes

* Fix username filter not working

* Fix days counter off by 1

* Fix alignment issue
2019-01-07 12:54:42 +01:00
Justin Shreve e3e9ccb6a4 Add `reports/downloads/stats` REST API Endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1142)
* First pass at downloads REST API

* Add reports/downloads/stats endpoint.

* Add tests

* Update cache key
2019-01-03 13:00:48 -05:00
Peter Fabian 13022fee4f WIP on orders/stats segmenting. 2019-01-03 18:59:07 +01:00
Peter Fabian 6bceabe095 Fixed extra parameters after refactoring. 2019-01-02 15:40:47 +01:00
Peter Fabian 52e1ed920f Added placeholders for new db columns. 2019-01-02 15:29:43 +01:00
Peter Fabian 4cc042ebd8 Added back updates to product lookup update routine after wc-admin-order-functions.php was removed and code moved to individual data stores. 2019-01-02 15:26:33 +01:00
Peter Fabian 1e39bc0756 Merge branch 'master' into fix/1035
# Conflicts:
#	includes/wc-admin-order-functions.php
2019-01-02 14:08:23 +01:00
Peter Fabian 4eaa5d911f WIP on segmenting for orders/stats. 2019-01-02 13:35:40 +01:00
Peter Fabian a9a0ccd185 Added refund_amount to products lookup as it needs to be reported on product level. 2019-01-02 11:33:05 +01:00
Peter Fabian 1931f3bf48 Added table name to time limit clauses. 2019-01-02 11:31:48 +01:00
Joshua T Flowers 7bbdd78bde Add missing intervals to product reports (https://github.com/woocommerce/woocommerce-admin/pull/1200)
* Add missing intervals to product reports

* Fix failing tests for product stats API

Before and after query should be within today's date since missing intervals for other days will be filled in with remaining dates.
2018-12-31 13:20:22 +08:00
Joshua T Flowers 3f388028ac Sort default category response by category ID (https://github.com/woocommerce/woocommerce-admin/pull/1201) 2018-12-28 09:50:58 -08:00
Joshua T Flowers e0596ea249 Add 404 response to REST response for invalid note ID (https://github.com/woocommerce/woocommerce-admin/pull/1194) 2018-12-28 09:51:22 +08:00
Joshua T Flowers b3979ff984 Fix order status product sync (https://github.com/woocommerce/woocommerce-admin/pull/1151)
* Move order product sync to product data store

* Move order taxes sync to taxes data store

* Move order coupons sync to coupons data store

* Use table_name constant in data syncs

* Remove order data for incomplete order statuses

* Fix report rebuild tool

* Update comments to describe create/update entry reference

* Fix data_store_init function name change
2018-12-27 11:49:00 +08:00
Joshua T Flowers 987929da83 Filter by categories query param in categories data store (https://github.com/woocommerce/woocommerce-admin/pull/1179) 2018-12-27 11:31:08 +08:00
Joshua T Flowers 017db0b339 Sync order status on refund delete (https://github.com/woocommerce/woocommerce-admin/pull/1074) 2018-12-27 11:11:33 +08:00
Peter Fabian 48dfb54a48 Switched average order value from gross to net revenue (https://github.com/woocommerce/woocommerce-admin/pull/1158)
* Switched Average order value calculation from gross to net revenue.

* Updated tests to reflect switch of average order value from gross to net revenue.
2018-12-26 15:49:46 -08:00
Joshua T Flowers c747d3399e Use unbounded per_page limit in apiFetch for categories (https://github.com/woocommerce/woocommerce-admin/pull/1149) 2018-12-26 10:37:02 +08:00
Joshua T Flowers dcaa35c7bf Add product SKU to products report (https://github.com/woocommerce/woocommerce-admin/pull/1161)
* Add product SKU to products report

* Add tests for SKU data
2018-12-25 11:02:06 +08:00
Justin Shreve 579113910d Add remaining filters to the downloads report (https://github.com/woocommerce/woocommerce-admin/pull/1141)
* Add order number, username, and IP address filters to the downloads report.

* Adds tests
2018-12-21 16:40:41 -08:00
Justin Shreve 49a0f0f6d2 Add `reports/downloads` REST API endpoint. (https://github.com/woocommerce/woocommerce-admin/pull/1122)
* First pass at downloads REST API

* Handle PR feedback
2018-12-21 14:57:46 -08:00
Joshua T Flowers 56577101c4 Add customer numeric filters (https://github.com/woocommerce/woocommerce-admin/pull/1116)
* Add customer numeric filters

* Add between params to customers controller

* Escape strings for translation and change inputs to currency

* Add Currency shorthand filter
2018-12-21 12:07:54 +08:00
Joshua T Flowers f83b0e0615 Add product categories wc-api and breadcrumbs (https://github.com/woocommerce/woocommerce-admin/pull/1131)
* Add support for product cats in wp rest api

* Add categories to WC API

* Add category breadcrumbs component

* Increase per_page limit size for product cat API

* Use wc/v3 API to pull product categories

* Return category IDs in API

* Add categories to product reports

* Add category IDs test for REST API

* Switch to getResource instead of require for total count selector
2018-12-21 10:44:27 +08:00
Paul Sealock 46c313cdc7 REST API: Categories: optimize query by removing get_the_terms 2018-12-21 11:08:08 +13:00
Joshua T Flowers 5bab0767b6 Fix item refunds report data (https://github.com/woocommerce/woocommerce-admin/pull/1059)
* Fix product report data issue when issuing item refund

* Modify product order lookup stats when refund is given

* Remove products where orders are refunded

* Remove unused  var and add comment about early return

* Reduce product revenue if quantity still remains after refund

* Fix subtotal array key and abs value for float

* Change product_gross_revenue to product_net_revenue
2018-12-21 02:40:44 +08:00
Peter Fabian 999c7fe8ca Updated REST API controller for segmenting, added schema changes missed before. 2018-12-20 12:35:45 +01:00
Peter Fabian 4d6ea24e9e Db update for product lookup table to enable segmenting. 2018-12-20 12:28:29 +01:00
Peter Fabian dff8b63271 Merge pull request woocommerce/woocommerce-admin#1010 from woocommerce/fix/845
Added /reports/coupons and /reports/coupons/stats endpoints
2018-12-19 13:55:28 +01:00
Peter Fabian 4802736a0e Switched from using coupon code filter to coupon id filter by query parameter. 2018-12-19 13:37:54 +01:00
Joshua T Flowers 08d3e2c38d Change product_gross_revenue to product_net_revenue (https://github.com/woocommerce/woocommerce-admin/pull/1105)
* Change product_gross_revenue to product_net_revenue

* Change product_gross_revenue to product_net_revenue in category data store

* Change to net_revenue in frontend category report
2018-12-19 08:56:27 +08:00
Paul Sealock 15bbbe739d Hook up Categories table to endpoint 2018-12-19 08:36:42 +13:00
Peter Fabian 85e6e8df8d Added correct cache handling. 2018-12-18 12:01:42 +08:00
Peter Fabian 6c456657e8 Changed coupon_gross_discount to amount. 2018-12-18 12:01:42 +08:00
Peter Fabian f0b97a42b0 Changed data type in schema for dates to date-time. 2018-12-18 12:01:41 +08:00
Peter Fabian 21ac75d21e Made extended_info always appear in coupons endpoint. 2018-12-18 12:01:40 +08:00
Peter Fabian 3e45c6a82c Fixed invalid sort criterion for coupons endpoint. 2018-12-18 12:01:39 +08:00
Peter Fabian 3535f52d78 Removed interval parameter for coupons endpoint. 2018-12-18 12:01:39 +08:00
Peter Fabian 6950522f91 Removed timezone info that was added incorrectly 2018-12-18 12:01:39 +08:00
Peter Fabian a346f13beb Added extended info. 2018-12-18 12:01:38 +08:00
Peter Fabian 5eee869a74 Added small fixes to set up coupon endpoints. 2018-12-18 12:01:38 +08:00
Peter Fabian 1630cb9c6f Removed unsupported parameter from coupons endpoint. 2018-12-18 12:01:18 +08:00
Peter Fabian 357b8f914a Added query classes and data stores for coupons and coupons/stats. 2018-12-18 12:01:17 +08:00
Peter Fabian e273d055ef Moved functions from orders data store to allow code reuse. 2018-12-18 12:00:33 +08:00
Joshua T Flowers 9486ab7896 Update/taxes endpoint hookup/941 (https://github.com/woocommerce/woocommerce-admin/pull/1008)
* Hook up taxes to endpoint

* Hook up tax stats endpoint

* Add default tax stat totals for empty results

* Create subtotals from intervals in API

* Change orders to orders_count to keep consistent naming
2018-12-18 10:26:46 +08:00
Justin Shreve e42ad6956b Add customer email filter (https://github.com/woocommerce/woocommerce-admin/pull/1092)
* Add customer email filter

* Handle PR feedback: Fix up if statement and add extra info to validation comment
2018-12-17 11:20:11 -05:00
Claudio Sanches 80f1b2f256 [REST API] Stock endpoint (https://github.com/woocommerce/woocommerce-admin/pull/974)
* New reports stock endpoint

* Register new endpoint

* Unit tests

* Included "name" into stock results

* Fixed sku type

* Improve stock _links returning properly links for variations and parent products

* Fixed docblock

* Sort stock by stock_quantity by default

* Fixed orderby

* Ignore sticky posts

* Fixed variable names
2018-12-14 07:43:39 -08:00
Justin Shreve 20e202080a Add Live Data to Reviews Panel (https://github.com/woocommerce/woocommerce-admin/pull/1055)
* Add Live Data to Reviews Panel
Adds the ability to embed the product in a product review response

* Clean up code needed to embed some product fields.

* Add API response tests
2018-12-12 08:35:56 -05:00
Allen Snook de105648be Activity Panel: Inbox: Filter update and error notes out of the inbox (https://github.com/woocommerce/woocommerce-admin/pull/893)
* Filter update and error notes out of the inbox

* Remove redundant trim().

* Fix test for admin notes API type parameter.
2018-12-11 09:00:57 +08:00
Joshua T Flowers 04d3ce6eb1 Add taxes endpoint and data store (https://github.com/woocommerce/woocommerce-admin/pull/1000)
* Add taxes endpoint and data store

* Add sorting options and normalize orderby param

* Add report taxes unit tests

* Add tax rate to response

* Add country, state, priority, and name to response

* Fix tax codes query param

* Add class comment

* Add missing  to record query

* Add comment about ambiguous column
2018-12-11 08:58:05 +08:00
Joshua T Flowers 557cec57cb Add tax stats endpoint (https://github.com/woocommerce/woocommerce-admin/pull/1019) 2018-12-11 08:55:05 +08:00
Paul Sealock 93a7472e54 REST API: Add stock info to products and variations 2018-12-11 07:19:46 +13:00
Jeff Stieler c170e289f5 Merge pull request woocommerce/woocommerce-admin#853 from woocommerce/add/711-bump-notes
Activity Panel: Inbox: Bump notes for expiring subs at certain days-remaining thresholds
2018-12-05 13:40:04 -07:00
Joshua T Flowers 5d3c771d45 Trigger sync_order on order stats table when refunding (https://github.com/woocommerce/woocommerce-admin/pull/990) 2018-12-05 10:10:22 +08:00
Joshua T Flowers 755b9c94f7 Reduce order table net revenue by refund total (https://github.com/woocommerce/woocommerce-admin/pull/988)
* Reduce order table net revenue by refund total

* Use order utils to get refund total
2018-12-05 10:06:00 +08:00
Peter Fabian 1c8459244a Merge branch 'master' into fix/749
# Conflicts:
#	includes/data-stores/class-wc-admin-reports-products-data-store.php
2018-12-04 12:07:43 +01:00
Peter Fabian 670801cee8 Merge pull request woocommerce/woocommerce-admin#978 from woocommerce/fix/PHP52-compat
Fixed PHP 5.2 compatibility
2018-12-04 12:00:37 +01:00
Paul Sealock bf0e025b05 REST API: isolate extened info in /reports/products 2018-12-04 13:01:36 +13:00
Peter Fabian 15b4681d30 Updated refactored function call from variations data store. 2018-12-03 20:14:05 +01:00
Peter Fabian ef0f11182a Added missing function parameter. 2018-12-03 20:07:44 +01:00
Peter Fabian e297e5ba7f Fixed TABLE_NAME references.
To be compatible with PHP 5.2.
2018-12-03 18:01:50 +01:00
Peter Fabian 1acb9827e7 Merge branch 'master' into fix/749
# Conflicts:
#	includes/data-stores/class-wc-admin-reports-products-data-store.php
2018-12-03 16:21:04 +01:00
Peter Fabian b8dff97e00 Fixed PHP 5.2 compatibility. 2018-12-03 14:44:43 +01:00
Peter Fabian 6e68247701 Merge pull request woocommerce/woocommerce-admin#953 from woocommerce/fix/740
Added support for ordering by product name in products endpoint.
2018-12-03 11:56:28 +01:00
Paul Sealock 516062975b try/variations-endpoint 2018-12-03 12:02:58 +13:00
Paul Sealock 164a67144b try/variations-endpoint 2018-12-03 11:49:37 +13:00
Peter Fabian 8b80de9bc2 Added support for ordering by product name in products endpoint. 2018-11-28 15:14:34 +01:00
Peter Fabian 99e2c463c7 Added parameter mapping for products/stats endpoint. 2018-11-28 11:04:18 +01:00
Peter Fabian e6cca3c083 Replaced code_includes/_excludes with coupon_* as agreed. 2018-11-28 10:53:11 +01:00
Peter Fabian eff3a97573 Added time clause to WHERE subquery and fixed product selection. 2018-11-27 21:41:52 +01:00
Peter Fabian bc29615454 Removed unnecessary SQL conditions. 2018-11-27 21:40:13 +01:00
Peter Fabian a765a6df97 Added tests for advanced filters of orders report. 2018-11-27 21:39:14 +01:00
Peter Fabian f9a46423e0 Added get_order_statuses to REST controllers where it's required. 2018-11-27 16:39:11 +01:00
Peter Fabian c1af1da752 Updated structure of SQL queries for coupons and products.
As there can be multiple couopns and products assigned to one order, it requires different handling to what was initially implemented.
2018-11-27 16:34:12 +01:00
Peter Fabian 8e5709ce26 Updated get_unique_products to be more versatile and support running in other contexts.
In some cases of advanced filters, it produced incorrect SQL code.
Additionally, split of where clause to time clause and rest needed to be reflected here, too.
2018-11-27 16:32:42 +01:00
Peter Fabian 32e30ac274 Made sync of order stats table run also on clean_post_cache.
Otherwise, some changes in master data for orders would not be reflected, as save_post action is skipped if order is updated while the save_post action is running.
2018-11-27 16:29:21 +01:00
Peter Fabian 216b7c94ca Updated structure for includes/excludes coupons and products subqueries.
As there can be multiple coupons and products assigned to one order, it needs to ba handled differently when constructing SQL query.
2018-11-27 16:26:50 +01:00
Peter Fabian 7dd611f4d4 Added table name to time period sql params.
Without this, the subquery could not be used in some contexts, as the column name was ambiguous.
2018-11-27 16:23:40 +01:00
Peter Fabian 8dbcbfc6cb Store coupon id, not coupon item id in the stat table. 2018-11-27 16:18:42 +01:00
Peter Fabian 942db641e8 Added extra trigger for updating stats tables.
If order is updated while save_post action is in progress, then the update does not trigger stats table update, thus stats table gets out of sync with master data.
2018-11-27 16:17:30 +01:00
Peter Fabian a86560498e Added primary key to coupon lookup.
Otherwise REPLACE query adds a multiple identical rows.
2018-11-23 22:29:47 +01:00
Peter Fabian db9d6e03e7 Added spaces around operator. 2018-11-16 18:22:40 +01:00
Peter Fabian c1cf221773 Fixed typos. 2018-11-16 18:02:19 +01:00
Peter Fabian 26debd77c3 WIP on advanced filters.
Plus fixing bugs:
- fixed tests
- fixed schema definition to reflect response data
- split WHERE SQL clause into time constraints and rest
2018-11-16 17:51:33 +01:00
Peter Fabian 46923de3d2 Removed superfluous unsets. 2018-11-16 12:37:15 +01:00
Peter Fabian 7c6d0dc314 Handled case where match parameter is missing. 2018-11-16 12:32:13 +01:00