Commit Graph

340 Commits

Author SHA1 Message Date
Nestor Soriano fc0be07e0f Add unit test for WC_Admin_Post_Types::bulk_and_quick_edit_save_post.
The test added checks that the new regular or sale price is
appropriately set when bulk saving.
2020-07-14 11:42:21 +02:00
Nestor Soriano 4531af3382 Small fix in WC_Tests_Admin_Post_Types::bulk_and_quick_edit_stock_status_for_variable_product.
At some point the 'change_stock' key is assumed to be present
in the request data, but it might not. Fixed to test for existence
before using the value.
2020-07-14 11:42:21 +02:00
Nestor Soriano b71a9c33b6 Extract $_REQUEST to a method in WC_Admin_Post_Types.
Create a new `request_data` method in WC_Admin_Post_Types that
just returns $_REQUEST. This is intended to ease unit testing,
as this method can be easily mocked to return test data.
2020-07-14 11:42:21 +02:00
Nestor Soriano fd34cf76b2 Fix stock status setting for variable products on bulk & quick edits.
For bulk edit: even if stock status was left as "No change", the
status of all variations was being changed to whatever the status
of the product was before it was converted to variable. Now
no change is performed when "No change" is selected, and all
variations change to whatever is selected otherwise.

For quick edit: a new "No change" option is added that will be
preselected when the product is variable. Previously, whatever
status the product had before being converted to variable was being
shown, and that's the status that would be set when saving.
Also, a "This will change the stock status of all variations"
message is displayed before the selector.
2020-07-14 11:42:21 +02:00
Nestor Soriano ae0d269128 Refactor duplicate code & add rounding to price calculations in WC_Admin_Post_Types.
Two methods have been created:

- update_stock_status, replaces code that was duplicated in the
  quick_edit_save and bulk_edit_save methods.

- set_new_price, replaces code that was duplicated-ish in the
  bulk_edit_save for setting the new regular and sales prices
  (code was not identical but very similar).

Also, `round` is now used on sale price calculations that involve
multiplying by a percent, the same was as it was done already
to calculate the regular price.
2020-07-14 11:42:21 +02:00
Nestor Soriano 7d5b59953c Fix code sniffer errors in WC_Admin_Post_Types. 2020-07-14 11:42:21 +02:00
vedanshujain 707a9bf9a0 Bump versions 2020-02-07 17:54:54 +05:30
vedanshujain b29219969c Addressed code review comments 2020-02-07 17:54:54 +05:30
vedanshujain ca5fd12103 Add setting to configure hash appends 2020-02-07 17:54:54 +05:30
vedanshujain 56176e0479 Append unique hash to filename for added security 2020-02-07 17:54:54 +05:30
Christopher Allford 6ad091a9b7 Changed all of the constant accesses into corresponding Automattic\Jetpack\Constants usages 2020-01-28 21:21:29 -08:00
Akshaya Rane 19e3131d5e Modified comment message 2019-10-22 10:56:08 +05:30
Akshaya Rane b8cdeb2164 Fixed standards error 2019-10-22 00:21:44 +05:30
Akshaya Rane 8ed29fad7f refs #24638 Fixed Stock status update on Bulk Edit 2019-10-21 22:45:05 +05:30
Peter Fabian b891bfe238 Removed unused variables. 2019-05-02 17:53:50 +02:00
Mike Jolley a7279bd261 Revert double saving change 2019-04-26 17:19:41 +01:00
Peter Fabian abf1b7450d Save the product before calling wc_update_product_stock to ensure data consistency and set quantity in local copy after saving it to db in wc_update_product_stock.
wc_update_product_stock reads product from the db twice, so if it's out of sync, strange things are happening.
Also, changes dependant on stock status might get reverted if local copy of $product is not updated after wc_update_product_stock.
2019-04-25 14:57:08 +02:00
Gerhard bfda9c0ac8 Use wc_update_product_stock instead of manually adding and subtracting. 2019-01-22 15:14:41 +02:00
Gerhard 683111b4a5 PHPCS fixes 2019-01-16 11:32:00 +02:00
Gerhard 6b211ab25b Add increase and decrease stock qty option to bulk product edit. 2019-01-16 11:22:11 +02:00
Gerhard Potgieter dd1d3b0c77 Make sure _stock is set and unslash value before using. Update PHPCS exclude rule to be more specific. 2018-09-27 08:02:12 +02:00
Gerhard Potgieter 9374e2e79a PHPCS fixes 2018-09-26 12:43:04 +02:00
Gerhard Potgieter 0428ea4f1e When quick edit saving stock, check for numeric value as empty returns true on 0 and you can set stock to 0. 2018-09-26 12:34:19 +02:00
Gerhard Potgieter ac09473853 Escape sku input properly for quickedit 2018-07-10 10:56:49 +02:00
Mike Jolley 1852672761 Allow access to list table 2018-06-28 16:39:27 +01:00
Claudio Sanches 95edc882ea Fixed bug when using asbint() with wc_get_page_id()
When a page does not exists `wc_get_page_id()` returns `-1`, so applying
`absint()` should cause bugs when comparing with "Hello world!" page.
2018-04-04 12:12:05 -03:00
Konstantinos Kouratoras 7a9569a185
Switch to intval when checking for the shop page
When shop page is not set, shop page id is set to -1. Using absint when checking if the current page is the shop page, this was applied to post with ID 1. Using intval, this is prevented.

Fixes #19606
2018-04-04 15:15:36 +03:00
Rodrigo Primo 23b69eba53 Use phpcbf to fix coding standard violations in includes/admin
After using phpcbf to fix the coding standard violations, I did some manual adjustments to the changes, especially in poorly indented files.
2018-03-05 16:21:35 -03:00
claudiulodro 56230e9189 Refactor to handle percents with comma separators 2018-02-02 11:45:23 -08:00
claudiulodro 680b8b6b01 Fix bulk sale/regular price percentage handling 2018-02-02 10:52:24 -08:00
Mike Jolley 57c00701e6 Ensure the table handler is only loaded once. Prevents multiple loads if a plugin calls check_ajax_referer many times. 2018-01-31 11:30:10 +00:00
Mike Jolley c1fc8c241a Correct bulk edit price formatting. 2018-01-11 11:21:37 +00:00
Mike Jolley 98bebd14f2 Hooks for columns and preview list tables 2017-11-21 16:22:43 +00:00
Michael Weichselgartner ff8326b20e
Fix method upload_dir in class WC_Admin_Post_Types
Fix undefined variable `$uploads` in method `upload_dir` from class `WC_Admin_Post_Types` by reverting back to `$pathdata` as reported in #17789
2017-11-18 20:06:45 +01:00
Mike Jolley 55433aa7a9
Merge pull request #17785 from shivapoudel/fix/visibility-featured
Correct escape for featured product checkbox
2017-11-18 18:29:30 +00:00
Michael Weichselgartner 7164a7e190
Update class-wc-admin-post-types.php 2017-11-18 18:16:18 +01:00
Shiva Poudel 1fbc4e77cc Tweak - Display featured product checkbox inline 2017-11-18 21:43:09 +05:45
Mike Jolley 128b826791 Merge branch 'master' into tweak/order-screens
# Conflicts:
#	assets/css/admin-rtl.css
#	assets/css/admin.css
#	includes/admin/class-wc-admin-post-types.php
2017-11-15 13:36:13 +00:00
Claudio Sanches f27120f649 Introduced product category filter threshold and load categories dropdown
Only use WooSelect when have more than 100 terms
2017-11-13 19:47:48 -02:00
Claudio Sanches 487c039b1c Fixed coding standards 2017-11-13 19:40:10 -02:00
Mike Jolley 0a77632a33 correct escape 2017-11-03 16:22:35 +00:00
Mike Jolley 8f37ea33ed Refactored into list table classes 2017-11-03 16:10:32 +00:00
Mike Jolley ed49c5b524 Styling improvements 2017-11-03 11:57:44 +00:00
Mike Jolley 1f7ecd9fb9 Merge branch 'master' into tweak/order-screens
# Conflicts:
#	assets/js/frontend/checkout.min.js
2017-11-01 16:52:21 +00:00
Mike Jolley 7df8f6bec6 Resend new order notification option
@kloon Stole your code.

Ref: #17186
2017-10-13 14:54:12 +01:00
Mike Jolley 1fb572f9ee Remove columns 2017-09-04 18:05:34 +01:00
Mike Jolley 2a71a66fc9 Order screen refinements and preview window 2017-09-04 17:42:31 +01:00
Rami Yushuvaev 6f7c817b78 i18n: Avoid using HTML tags in translation strings
This PR moves the `<strong>` HTML tags from the translation strings.

Replacing: `Order scheduled for: <strong>%1$s</strong>.`
With: `Order scheduled for: %s.`

We did the same in WordPress core across several releases (4.3 - 4.7). Because it's makes the translation process to RTL language (like Hebrew) much easier.
2017-08-15 15:07:55 +03:00
Mike Jolley 8db31eefe2 Fix variable stock status setting by using CRUD methods
Closes #16287
2017-08-07 15:16:38 +01:00
Mike Jolley 958bd092ba Add date/time to hover.
Closes #16331
2017-08-03 08:48:17 +02:00