Commit Graph

5538 Commits

Author SHA1 Message Date
Rodrigo Primo 1fca8bb1b1 Replaces a few more instances of jQuery.fn.click() event shorthand
This commit replaces a few more instances of jQuery.fn.click() event shorthand that were missed in the previous commit. For more information see the commit message for 8ebead165e.
2020-11-18 16:31:17 -03:00
Rodrigo Primo ee31c791af Fix PHPCS violations 2020-11-18 15:33:36 -03:00
Rodrigo Primo 8ebead165e Replace usages of depracted jQuery.fn.click() event shorthand
This commit replaces all instances in WooCommerce codebase (except included third-party libraries) where jQuery.fn.click( handler ) event shorthand was used. This shorthand was deprecated in jQuery 3.3 (see https://github.com/jquery/jquery/issues/3214). The jQuery documentation was not updated yet (see https://github.com/jquery/jquery-migrate/issues/288 and https://github.com/jquery/api.jquery.com/issues/972).

jQuery.click() was not deprecated and so it was not replaced.
2020-11-18 15:27:46 -03:00
roykho 5597f74e81
Merge branch 'master' into fix/issue-27972 2020-11-12 06:21:52 -08:00
roykho 134786ada8 Fix stock reducing incorrect amount when order item is deleted after a refund closes #27504 2020-11-11 15:28:06 -06:00
roykho 4c079ea99e
Update SSR version to check against major versions only closes #27972 2020-10-27 08:16:35 -07:00
Roy Ho c96a642e8a
Merge pull request #28067 from woocommerce/fix/27529
Fix: use the correct parameter when calling get_avatar()
2020-10-26 07:46:51 -07:00
Rodrigo Primo 09faf8ba84 Fix: use the correct parameter when calling get_avatar()
`WC_Admin_Dashboard::recent_reviews()` was calling `get_avatar()` passing `$comment->comment_author` which is not one of the list of parameters that the function accepts to get the avatar. As a result, the widget that displays the recent reviews in the admin dashboard was never displaying the avatar of the user that left the review. This commit fixes this issue by passing `$comment->comment_email` instead. I opted to use `$comment->comment_author` as it should be available for reviews left both by authenticated and anonymous users and because getting the comment object wouldn't be so simple (either we need to perform an extra query for each review or deprecate the `woocommerce_report_recent_reviews_query_from` filter).
2020-10-22 17:43:59 -03:00
Rodrigo Primo e91872c1a8 PHPCS fixes 2020-10-22 17:34:47 -03:00
pjv f03bfb85da Fix incorrect capability for product sorting link
Fixes #28049
2020-10-22 13:03:35 -05:00
Rodrigo Primo 0a81188e42
Merge pull request #27987 from woocommerce/php8/fix-required-parameters-after-optional-take-2
[PHP 8] Convert optional-before-required parameters into required parameters (take 2)
2020-10-17 09:42:20 -03:00
roykho e8bcd464db
Update escape based on suggestion 2020-10-16 06:00:34 -07:00
Nestor Soriano 63ced34e2d Convert optional-before-required arguments to required (take 2)
In PHP 8 required parameters after optional parameters in
function/method signatures trigger a deprecation notice. These type
of parameters are pointless since a value needs to always be
provided for them anyway, so they are actually de-facto required.

This commit converts all these not-so-optional parameters into
truly required parameters by removing their default values.
2020-10-16 13:08:31 +02:00
roykho 800cbdbc7e
Add missing escapes 2020-10-15 16:31:56 -07:00
roykho ace411aacd
Fix billing email being parsed as a URL link when beginning of email contains www closes #25099 2020-10-15 14:25:03 -07:00
Néstor Soriano e4a109f0d1
Merge pull request #27763 from woocommerce/fix/27445
Remove protection as we already diff and update only if needed.
2020-10-15 10:01:34 +02:00
Claudio Sanches e34681dbb4
Merge pull request #27696 from woocommerce/fix/version-race-conditions
Fix some race conditions in WC_Install
2020-10-14 20:18:47 -03:00
Claudio Sanches 23fe4f71bb
Merge pull request #27842 from sudoshreyansh/fix/27839
Fixed </strong> closing tag position. Issue: #27839
2020-10-14 18:06:10 -03:00
Néstor Soriano c15488d840
Merge pull request #27830 from woocommerce/php8/fix-round-function-with-non-numeric-argument 2020-10-09 08:01:44 +02:00
Knyazevich ce59afb2b9 Simplify drafts excluding logic (ref #24136) 2020-10-06 18:11:58 +03:00
Knyazevich f551c6c792 Exclude drafts from the "Shop page" select (ref #24136) 2020-10-06 06:42:56 +03:00
sudoshreyansh dd9bf06594 Fixed </strong> closing tag position. Issue: #27839 2020-10-02 15:46:41 +05:30
Nestor Soriano 52eed70f04 Add a 'NumberUtil' class with a 'round' method.
There's a number of places in the WooCommerce codebase where the
built-in function 'round' is executed passing a non-numeric value
(not a number and not a string that can be parsed as a number),
for example round(''). In PHP 7 this yields a value of 0, but in
PHP 8 this throws an error.

This commit adds a 'NumberUtil' class with a static 'round' method,
this method checks if the passed value is numeric and if so it just
executes the built-in function, otherwise it returns 0. And all the
calls to 'round' in the codebase are replaced with 'NumberUtil::round'.
2020-10-01 11:08:51 +02:00
vedanshujain c69e1f5799 Remove protection as we already diff and update only if needed.
In #26642 we removed adding reduced_stock meta when adding new order item to prevent ghost entries, but in inadvertently exposed an underlying bug where _reduced_stock meta was getting set to 0 if its emtpy.

We were then checking the presence of this meta, but also not reducing the stock in case it was not set.
2020-09-24 00:54:24 +05:30
Rodrigo Primo c3a72b994a Fix version in which the setup wizard was deprecated
The setup wizard is going to be deprecated in WC 4.6.0 which should be
released soon. Some functions were marked as if they were deprecated in
WC 4.5.0 which is not the case.
2020-09-22 11:20:33 -03:00
Rodrigo Primo 51fd4af1b2 Remove call to __() from deprecation messages
Doing this as AFAIK we don't typically support traslation for
deprecation messages.
2020-09-22 11:18:43 -03:00
Rodrigo Primo 7401982d37
Merge pull request #27047 from woocommerce/fix/26972
Removed Features settings and home screen option
2020-09-18 16:46:43 -03:00
Ron Rennick 4b3b40d42e address feedback 2020-09-18 15:22:24 -03:00
Ron Rennick 43051a0950 update deprecation versions to 4.6.0 2020-09-18 13:16:46 -03:00
Ron Rennick 9915a5b142 merge master 2020-09-18 12:53:28 -03:00
Claudio Sanches 29b8b0d60d
Merge pull request #27701 from woocommerce/fix/rest-api-package-tag
Fixed usage of package tag in REST API and templates
2020-09-17 18:45:14 -03:00
Claudio Sanches 153ce009de Fixed helper header 2020-09-17 16:50:17 -03:00
Claudio Sanches 3377c60c5e
Merge pull request #27433 from woocommerce/fix/remove-relative-include-paths
Change relative include paths to absolute include paths
2020-09-17 13:15:40 -03:00
Claudio Sanches f4e9fcc1a4 Fixed missing include 2020-09-17 13:12:57 -03:00
Konstantin Kovshenin a100ed67b2 Fix race conditions in WC_Install
In an environment with persistent object caching, concurrent calls
to delete_option() + add_option() can result in the option value
leaking out of the alloptions cache key, and into its own cache
item under the options group, while deleting the value from the
database.

This causes future function calls to add_option() to fail, since
the value already exists in cache (under the wrong key). It also
causes calls to delete_option() to fail, since the value is not
in the database.

This commit forces update_option() instead of the delete + add
combination, as well as removes multiple unnecessary calls to
update the woocommerce_db_version from admin notes and notices.
2020-09-17 11:59:50 +03:00
Rodrigo Primo d50cd4389b Fix using tax classes with some non-ASCII characters
This commit fixes a bug that made it impossible to assign to a product a tax class that contained non-ASCII characters that are URL encoded by sanitize_title().

WooCommerce uses sanitize_title() to generate a slug when creating a tax class (d48f1d4e2e/includes/class-wc-tax.php (L808)). sanitize_title() converts some non-ASCII to ASCII equivalents (those handled by remove_accents()) and URL encodes others (like some Greek characters, for example).

The code was using wc_clean() to sanitize the tax class when the user edited a product. The problem is that wc_clean() removes URL encoded characters, changing the slug of some tax class, causing WooCommerce to use the standard tax class instead without any errors. To fix this issue, this commit replaces wc_clean() with sanitize_title(). This should be enough for security purposes and should not cause any issues with non-ASCII characters.
2020-09-08 16:00:56 -03:00
Ron Rennick 8fe3bcb90e rebase to current master 2020-08-28 10:59:43 -03:00
Claudio Sanches c4ccc38780 Fixed use __DIR__ for relative paths 2020-08-26 18:46:44 -03:00
Romario 67a178f4f7 Replace 'DIRECTORY_SEPARATOR' with '/' 2020-08-26 15:50:34 -05:00
Romario 3b90d99d44
Change 'dirname( __FILE__ )' to '__DIR__ ' and include '/'
Co-authored-by: Claudio Sanches <contato@claudiosanches.com>
2020-08-26 14:58:22 -05:00
Claudio Sanches 5240682f38 Improve choice of words 2020-08-25 18:03:03 -03:00
Hayden Whiteman 3fca3caf1d Fix #27413 2020-08-22 19:35:13 +12:00
Romario acfb3e5dfd Add spacing between '$dir 'and '.' 2020-08-21 15:25:21 -05:00
Romario 073c63c9c4 Replace dirname with __DIR__ and add DIRECTORY_SEPARATOR
Previously 'dirname(  __FILE__ )' was used to import files, however, the directory separator was missing.

This commit replaces 'dirname(  __FILE__ )' that was introduced in 5370d02484 with __DIR__  and added DIRECTORY_SEPARATOR
2020-08-21 15:16:26 -05:00
Romario 5370d02484 Change relative include paths to absolute include paths
Relative include paths in PHP can break whenever the server is running opcache.  As such, WordPress.com deploy system refuses to include WooCommerce because of that issue.

This commit changes the relative include paths to absolute include paths.

Relates to #27269
2020-08-20 15:32:04 -05:00
Claudio Sanches af357e9177 Updated priority of admin_body_class filter 2020-08-20 13:18:23 -03:00
Néstor Soriano f8ea11a607
Merge pull request #27145 from woocommerce/fix/26006
Fixed "virtual" and "downlodable" pointers on product walkthrough
2020-08-14 08:55:53 +02:00
Ron Rennick 72df8aecfa updated deprecated version to 4.5.0 2020-08-13 14:46:12 -03:00
Ron Rennick f0ad8a01be merge current master 2020-08-13 14:33:07 -03:00
Claudio Sanches 070e3896cf Restored pointers position 2020-08-12 21:46:36 -03:00