Commit Graph

20218 Commits

Author SHA1 Message Date
Nestor Soriano 29cf161415 Small changes after review feedback:
- Method and class renames.
- Removed unnecessary autoloader registration.
- Add a unit test for classes with non-object type hints
  in constructor arguments.
2020-07-24 09:24:06 +02:00
Nestor Soriano d5d02a7175 Fix code sniffer errors in wc-core-functions.php 2020-07-24 09:23:05 +02:00
Nestor Soriano 064ae558ab Changes in the overall organization of the dependency injection:
- The `Container` class now implements `Psr\Container\ContainerInterface`
  (and registers itself as such), holding a private instance of the
  real container. This way it's a read-only container from the point
  of view of plugins (which should use their own containers, but
  can still use this to get WooCommerce classes).
- All registrations are now done in the `Container` constructor via
  service providers.
- The container instance is now held in a global variable, set in
  `woocommerce.php`
- Added the `wc_get_container` function for old code.
- Added the `AbstractServiceProvider` class, which inherits with the
  corresponding League's class and adds some utility methods,
  most notably `add/shareWithAutoArguments`.
- Added the `ActionsProxy` and `LegacyProxy` classes, they are
  registered via a dedicated service provider.
- `WC_Queue_Interface` is no longer resolvable via the container
  (which is for classes inside `src` only).
- All the method names in the new classes have the format `fooBarFizz`
  to be PSR4 compliant, so the MethodNameInvalid error has been
  disabled in phpcs.xml for the `src` directory.
- Introduced the `@public` annotation for public API classes
  (classes that plugins can use and whose backwards compatibility
  we guarantee), applied to `ActionsProxy` and to `LegacyProxy` for now.
- Removed the hack for the autoloader as now it doesn't work anyway.
  For the changes in this branch to work, now WP_DEBUG must be false.
2020-07-24 09:23:01 +02:00
Nestor Soriano 23df8a4d17 Revert a couple of files to its original content after a messed rebase 2020-07-24 09:20:24 +02:00
Nestor Soriano a7829525eb Changes in the dependency injection container:
- Renamed from `ObjectContainer` to `Container`.
- It now inherits from PHP League's `Container`.
- It has now a `defineAsSharedAutowired` method.
- Initialization moved to the `WooCommerce::init_container` method.
- The static method for object resolution is now `WooCommerce::get_instance_of`.
2020-07-24 09:20:24 +02:00
Nestor Soriano 281ec18158 Undo the registration of old singletons in the DI container.
The container will in principle be used only to register classes
in the `src` directory.

Also, CustomerProvider class removed.
2020-07-24 09:20:24 +02:00
Nestor Soriano 312383ae47 First steps towards introducing a dependency injection framework.
- Add PHP League's Container package via Composer.
- Add an ObjectContainer class that encapsulates all the configuration
  and insulates the codebase from the concrete DI engine used.
- Add an improved ReflectionContainer class that will allow to
  register individual classes as singletons while autowiring.
- Use ObjectContainer to resolve the WooCommerce class, everything
  instantiated with "new" inside it, and all singletons that are
  usually obtained via WC() function.
- Introduce the CustomerProvider class.
- Introduce a service provider to resolve WC_Queue_Interface,
  this replaces the WC_Queue class.
- Mark as obsolete all the replaced "instance()" methods,
  and the entire WC_Queue class.
2020-07-24 09:20:21 +02:00
Christopher Allford 840554d788
Merge pull request #27017 from woocommerce/fix/25480
Fixed the `shipping_zone_method` CLI command's instance_id parameter
2020-07-20 11:00:08 -07:00
Claudio Sanches 86311a9903
Merge pull request #27046 from woocommerce/fix/26860
[Importer/Exporter] Fixed the value display of "Published" for children of draft variable products
2020-07-16 13:15:31 -03:00
Ron Rennick dbf3e99292
Merge pull request #26964 from woocommerce/fix/24604
add rating count to order by rating clause
2020-07-16 10:51:20 -03:00
Néstor Soriano 24bd19c517
Merge pull request #27038 from woocommerce/add/26192
Add existing meta keys to woocommerce_duplicate_product_exclude_meta filter
2020-07-16 11:02:09 +02:00
Claudio Sanches 37777432d4 [Importer/Exporter] Fix "Published" column values
While variations only uses "published" and "private" statuses when
exporting we should display the variations as "draft" in case the parent
product it's also a draft.
2020-07-15 21:45:51 -03:00
Vedanshu Jain a34835e489
Merge pull request #26932 from woocommerce/fix/25442
Show community forum link if wccom is not connected
2020-07-16 00:14:52 +05:30
vedanshujain 4500e86198 Shorten class and method names to reduce redundancy in naming. 2020-07-15 15:20:18 +05:30
Christopher Allford c9f754f5a3 Added the existing meta keys to the `woocommerce_duplicate_product_exclude_meta` filter 2020-07-14 13:57:21 -07:00
vedanshujain 1e68ce5dc9 Move function to src for better code architecture 2020-07-14 23:31:56 +05:30
Christopher Allford 9c492853b5
Merge pull request #26998 from woocommerce/fix/is-tax-displayed-private
Fixed the accessibility of WC_Cart::is_tax_displayed()
2020-07-14 09:05:19 -07:00
Christopher Allford 2ef15f02e3 Renamed `WC_Cart::is_tax_displayed()` to `WC_Cart::get_tax_price_display_mode()` to clarify intent 2020-07-13 07:21:19 -07:00
Peter Fabian 23028a90a1 Schema has not been updated, so revert. 2020-07-13 15:34:54 +02:00
Christopher Allford 933cdd7a7b Removed the default `id` field added to all CLI commands
Some of our endpoints don't have an "<id>" parameter but we're expecting one in the CLI. Since the `id` is already part of the supported IDs we don't actually need this since it will pull it from the route.
2020-07-10 14:16:30 -07:00
Christopher Allford c3618cad47 Added the `instance_id` parameter to the CLI runner
This is used for shipping zone methods and so we need to be able to parse it too!
2020-07-10 07:21:05 -07:00
Christopher Allford c2bf58a739 Fixed the accessibility of WC_Cart::is_tax_displayed()
Since we're calling the function from the base class we need it to be protected or this throws a fatal exception.
2020-07-09 13:39:16 -07:00
Peter Fabian 6bc0ca724f Update versions and changelog from latest releases. 2020-07-09 13:18:51 +02:00
Claudio Sanches 864f451775
Merge pull request #26338 from woocommerce/fix/25561
Fixed user cap required to view the order count indicator
2020-07-08 12:09:28 -03:00
Claudio Sanches eeb08467af
Merge pull request #26877 from woocommerce/fix/26547
Fixed WooCommerce menu for users that can only manage orders on WooCommerce
2020-07-08 12:08:29 -03:00
Ron Rennick 625857e9e1 add rating count to order by rating clause 2020-07-06 11:19:17 -03:00
Claudio Sanches 85580cfb4f
Merge pull request #26935 from woocommerce/fix/26822
[Tracker] Added order_total to orders_edit_status_change
2020-07-02 16:29:13 -03:00
Néstor Soriano 7fa34c6770
Merge pull request #26400 from woocommerce/fix/26242
Make WC_Cart::display_prices_including_tax() aware of tax display changes
2020-07-02 14:56:50 +02:00
vedanshujain 50b08a75ab Show community forum link if wccom is not connected 2020-07-02 16:28:33 +05:30
Claudio Sanches 0d9b6786fd [Tracker] Added order_total to orders_edit_status_change 2020-07-01 18:24:47 -03:00
Claudio Sanches e20a69c35c Fixed missing comma 2020-07-01 17:56:19 -03:00
Claudio Sanches a1eb697bd3
Merge pull request #26634 from corsonr/fix-26633
Fix #26633 - Adds Custom Messages Upon WC Taxonomies Update
2020-07-01 14:36:38 -03:00
Claudio Sanches 101a8ae243
Added context 2020-07-01 14:36:22 -03:00
Claudio Sanches f17535fabd
Merge pull request #26589 from mariovalney/fix/26588
Fixes issue #26588
2020-07-01 14:18:06 -03:00
Claudio Sanches 1de6bf0c28
Merge pull request #26515 from koko-ng/patch-1
Fix error message in wc_get_template
2020-07-01 13:27:05 -03:00
Claudio Sanches 1194225d71
Merge pull request #26503 from Knyazevich/origin/fix/wc_update_product_stock_status-phpdoc
Fix parameter type and add an empty line in wc_update_product_stock_s…
2020-07-01 13:21:21 -03:00
Claudio Sanches 0351aa546e
Merge pull request #26462 from db2000ro/fix/24885
Fix 24885 currency position RTL
2020-07-01 13:20:01 -03:00
Claudio Sanches fddaed2899
Merge pull request #26325 from twoelevenjay/master
Conditionally change my account dashboard desc
2020-07-01 13:13:22 -03:00
Claudio Sanches 4d2bafcc49
Merge pull request #26219 from woocommerce/fix/wc-load-cart
`wc_load_cart` should load it's own dependencies and include required core files
2020-07-01 13:10:04 -03:00
Claudio Sanches dec50429b4
Merge pull request #25240 from shamalisulakhe/issue-24266-solution
Issue 24266 solution - with rerf of
2020-07-01 13:00:58 -03:00
Claudio Sanches cadbc759fe
Merge pull request #26680 from MihaiCraciun/master
Added missing closing select tag to the product exporter category select
2020-07-01 12:57:33 -03:00
Claudio Sanches 950b2253cb
Merge pull request #26846 from woocommerce/add/new_order_note_action
Add `woocommerce_order_note_added` action
2020-07-01 12:56:55 -03:00
Claudio Sanches 9ac5bcb586
Merge pull request #26697 from passatgt/master
Fixes for Hungarian address format and name order
2020-07-01 12:55:50 -03:00
Claudio Sanches e736ac4145
Merge pull request #26837 from gamebits/patch-1
Add login link for existing account
2020-07-01 12:54:24 -03:00
Claudio Sanches 94d23605b8
Merge pull request #26658 from zackkatz/patch-1
Fix undefined index PHP warning
2020-07-01 12:48:13 -03:00
Claudio Sanches 2874915339
Merge pull request #26553 from szepeviktor/patch-2
Fix PHPDoc in WC_Notes_Run_Db_Update
2020-07-01 12:46:48 -03:00
Claudio Sanches 9c4ac29137
Merge pull request #26565 from woocommerce/fix/26510
Allow set "order key" while creating order via CRUD
2020-07-01 12:42:18 -03:00
Claudio Sanches 54f91a5a59
Merge pull request #26566 from woocommerce/update/26510-generate-order-key
Allow custom values in wc_generate_order_key()
2020-07-01 12:41:24 -03:00
Claudio Sanches cac529c393
Merge pull request #26567 from woocommerce/fix/26510-created-date
Allow set "date_created" while creating orders via CRUD
2020-07-01 12:40:43 -03:00
Claudio Sanches 4450d2239f
Merge pull request #26660 from woocommerce/add/status-tools-prompt
Adds a prompt to confirm if should run tools in the Status page.
2020-07-01 12:39:54 -03:00