Commit Graph

5677 Commits

Author SHA1 Message Date
Nestor Soriano ca46992c00
Adjustments in settings pages after a merge with conflicts. 2021-04-12 15:55:45 +02:00
Claudio Sanches e2e914ed39
Remove todo 2021-04-12 12:50:21 +02:00
Claudio Sanches 1f51e0c9fc
Remove "Features" menu 2021-04-12 12:50:21 +02:00
Nestor Soriano 65c1c9ec54
Fix unit tests after merging from trunk 2021-04-12 12:50:21 +02:00
Nestor Soriano d820fbe4a7
Fix wrong handling of the shipping - shipping options section. 2021-04-12 12:42:40 +02:00
Nestor Soriano e5f234ec0f
Re-implement the flushing of the term count cache that was lost on merge
Also add unit tests for it.
2021-04-12 12:42:39 +02:00
Nestor Soriano 5a11d9e064
Refactor the settings pages, and add unit tests for them.
This commit fixes some inconsistencies in the settings pages, and
makes all the existing pages extensible by adding new sections
(that was possible in some pages, but not in others). Main changes:

1. Modify the 'get_sections' method so that it invokes a new protected
   'get_own_sections' method and then triggers the
   'woocommerce_get_sections_' . id filter.

This way the filter is triggered only in the base class
and not in each of the derived classes too.

2. Change the get_settings() method so that it has its signature
   changed to get_settings( $current_section = '' )
   in the base class and in all the derived class.

Some derived classes were already using this signature, but others
(those not having multiple sections natively) weren't, making then
effectively impossible to define multiple sections for these pages
via filters.

With this change all the section pages act consistently and allow
both adding new settings to the default "General" section
and creating new sections via filters.

3. Change the implementation of 'get_settings' in the base class
   so that it searches for a 'get_settings_for_{section_id}_section'
   method in the class and executes it, otherwise it executes the new
   protected method get_settings_for_section( $current_section ); then
   it triggers the 'woocommerce_get_settings_' . id filter.

This makes it easier to separate the code that returns the list
of filters in multiple methods, one per section, instead of using
one big if-else-else... block.

So now instead of overriding get_settings($current_section='') derived
classes need to implement get_settings_for_{$current_section}_section
for each section, or override get_settings_for_section($current_section)
or both. 'get_settings_for_section' returns an empty array by default.

Also, 'woocommerce_get_settings_' . id is triggered in one single
place too.

Other improvements:

* Remove duplicated code from 'output' in 'WC_Settings_Page' children.

Some classes inherited from 'WC_Settings_Page' override the 'output'
method with custom code, which in all cases ended up repeating the code
of the original method as a fallback. These repetitions have been
replaced with 'parent::output()'.

* Fix inconsistencies for 'save' and 'output' in WC_Settings_Tax/Emails

The 'WC_Settings_Tax' and 'WC_Settings_Emails' classes had some
inconsistencies in their 'save' and 'output' methods that prevented the
proper creation new sections and the addition of new settings via the
'woocommerce_get_sections_' and 'woocommerce_get_settings_' filters.
Now they work as expected.

* Deduplicate parts of 'save' in 'WC_Settings_Page' and children.

Two methods have been added to 'WC_Settings_Page' class:
'save_settings_for_current_section' and 'do_update_options_action'.
These are intended to be invoked by derived classes in their 'save'
methods, in order to remove code repetition.

* Add some helper methods to WC_Unit_Test_Case.

Methods added:
- assertOutputsHTML
- assertEqualsHTML
- normalize_html
- capture_output_from
2021-04-12 12:42:26 +02:00
Nestor Soriano 1cf6b9d39e
Extra check for not showing the "WooCommerce Setup" widget in dashboard
if WC Admin is disabled
2021-04-08 09:31:51 +02:00
Nestor Soriano 43a2bb2a24
Don't show the "WooCommerce Setup" widget in dashboard if WC Admin is disabled 2021-04-07 15:38:25 +02:00
Claudio Sanches 6dd707556b
Merge pull request #29534 from mehrshaddarzi/patch-2
Fix columm to column
2021-03-30 14:14:05 -03:00
Nestor Soriano 1b351a6685 Sanitize tax class and display errors in admin while creating tax classes 2021-03-30 11:08:35 +02:00
Mehrshad Darzi 027b335028
Fix columm to column 2021-03-30 12:43:41 +04:30
Nestor Soriano e0dad77e49 Fix logic for including the "payments" task in onboarding wizard
The logic should be "if woo payments is installed and the country
is US then remove the payments task" but the check was mistakenly
being set to "or" so the task was removed whenever the country was US.
2021-03-29 11:25:39 +02:00
Timo Boyer 3e5d7418d9 Remove double space before concat operator 2021-03-23 23:29:30 +01:00
Timo Boyer f31bc26b61 Correctly close <option>-tag in admin products/orders list table 2021-03-23 21:23:46 +01:00
Roy Ho 7fb346c5d1
Merge pull request #29447 from luizbills/patch-1
Add missing sectionend in email settings
2021-03-23 09:48:11 -07:00
jonathansadowski 2e60d47a01
Merge pull request #29181 from woocommerce/fix/27233
Use AJAX for Page Configuration
2021-03-23 11:46:00 -05:00
Luiz "Bills 3e48ca7c35
fix coding standard 2021-03-23 13:25:20 -03:00
Luiz "Bills df4b584a82
delele empty space 2021-03-23 12:06:10 -03:00
Néstor Soriano 886cd15016
Merge pull request #29378 from woocommerce/fix/code-sniff
Remove Travis and fix CI in GitHub Actions
2021-03-23 15:22:49 +01:00
roykho c79fd6b7bf
Add excludes feature to exclude certain pages 2021-03-22 13:36:55 -07:00
roykho e5380ac966
Add new function to handle single page search closes #27233 2021-03-22 13:20:16 -07:00
roykho 96463b7172
Update verbiage based on feedback 2021-03-22 05:42:34 -07:00
Luiz "Bills f4565abccb
Add missing sectionend in email settings 2021-03-20 14:51:27 -03:00
roykho 01f949cc32
Update SSR db version tooltip to accurately describe the versioning closes #29430 2021-03-19 06:27:17 -07:00
Roy Ho e62f20b9b3
Merge pull request #29049 from wppunk/master
Fix #29048
2021-03-17 13:46:19 -07:00
Néstor Soriano 17224d0ab1
Merge pull request #29345 from woocommerce/hw/low-stock-threshold-for-variations
Low stock threshold for variations
2021-03-17 08:59:32 +01:00
Claudio Sanches b0dce9feff Fixed coding standards 2021-03-16 11:42:28 -03:00
Peter Fabian cb6e0d8201 Don't echo the strings, return them for later use. 2021-03-16 13:01:15 +01:00
Peter Fabian a2e9c055d5 Make the inherited values explicit by stating where it comes from. 2021-03-16 12:39:25 +01:00
Peter Fabian f33c80186f Updated the wording of the tooltip. 2021-03-16 08:51:29 +01:00
Peter Fabian bb5c56c148 Set correct placeholder value for variation--first the parent, then the store-wide default. 2021-03-15 18:41:55 +01:00
Peter Fabian 2ae5ec59ba Improve the description of the low stock threshold tooltip. 2021-03-15 12:42:10 +01:00
Claudio Sanches 32baae989d Fixed just one PHPCS error to trigger messages in PR 2021-03-13 21:08:20 -03:00
Peter Fabian 1f8f8580d1 Better wording of the tooltip--being more specific about what the amount relates to. 2021-03-11 16:26:41 +01:00
Peter Fabian f7755f123e Enable bulk updates of variations with low stock amount. 2021-03-10 18:15:31 +01:00
Peter Fabian 685be2a791 Connect the UI to the db to allow updates of the values. 2021-03-10 17:24:52 +01:00
Peter Fabian b92d1d1391 Harmonize the id and name with simple product. 2021-03-10 15:38:49 +01:00
Peter Fabian a6b45d08bf Added low stock threshold input to the Admin UI. 2021-03-10 11:47:22 +01:00
roykho cb0b92750b
Extract recount terms logic into own function closes #25375 2021-03-04 09:06:03 -08:00
Moon 00a272fa85
Merge pull request #29174 from woocommerce/add/28568-dashboard-widget-finish-setup
Add/28568 dashboard widget - setup
2021-03-02 16:46:51 -08:00
Moon d013d7f765 Move init logic to should_display_widget 2021-03-02 16:06:10 -08:00
roykho 503a218e85
Revert "Flush term cache when saving product and settings closes #25375"
This reverts commit 8b0915c4e0.
2021-02-26 12:42:23 -08:00
Roy Ho f6d77c206d
Merge pull request #29228 from woocommerce/fix/28238
Update default GIT branch
2021-02-26 11:59:09 -08:00
Vedanshu Jain 422002a2a8
Merge pull request #29200 from woocommerce/fix/upgrade-notices-major-version
Remove compatibility checks for major version
2021-02-26 14:55:30 +05:30
Claudio Sanches d6e3cf6de9 Update default GIT branch 2021-02-25 20:51:14 -03:00
Peter Fabian 47bfca58b0
Merge pull request #29052 from woocommerce/add/install_wcpay_addon_tracks
Add tracks event for WooCommerce Payments install via wc-addons page
2021-02-25 15:04:36 +01:00
louwie17 893fe6cc24
Merge pull request #29149 from woocommerce/update/28569_status_widget_net_sales_link
Woocommerce dashboard status widget net sales link and logic
2021-02-25 09:09:29 -04:00
Peter Fabian 8566a79da0 Pull out the constant to a globally accessible place so that it can be reused. 2021-02-24 14:29:45 +01:00
Peter Fabian 313ea8541c Remove compatibility checks for major version.
In addition to #28840, there are other places where we make use of compatibility check with major versions. I've discovered 2:
- update through /wp-admin/update-core.php
- force disabling auto-updates if there are any extensions that haven't declared their compatibility with WC 5.0

This change updates both places to be in line with the changes done in #28840.
2021-02-23 13:27:06 +01:00