Commit Graph

289 Commits

Author SHA1 Message Date
Mike Jolley 6edd13579b Update date paid if transitioning to payment complete status (#13382)
* Update date paid if the from status is unpaid, and the to status is ! unpaid

Closes #13376

* maybe_set_date_paid, maybe_set_date_completed and needs_processing helpers

Set paid is performed once only for BW compatibility with #13375

* Should use set_date_completed

* Docblock and params
2017-02-28 19:08:12 +00:00
Mike Jolley f5a36778fd Move refund/payment method code out of abstract 2017-02-27 17:06:09 +00:00
Mike Jolley 6f02cda453 get_item_count_refunded should be positive
Closes #13307
2017-02-23 13:52:17 +00:00
Mike Jolley 7ff301e2ca Merge branch 'master' into crud-perf-tweaks
# Conflicts:
#	includes/data-stores/class-wc-order-item-data-store.php
2017-02-09 12:31:25 +00:00
Mike Jolley b17932f4e3 Fix test due to invalid amount and caching 2017-02-09 12:04:44 +00:00
Mike Jolley c63cec32b9 Fix; prevent duplicate queries 2017-02-08 16:19:01 +00:00
Mike Jolley ed51c8ac13 Pass order object to emails 2017-02-01 17:54:47 +01:00
Justin Shreve 3d55efffac Move order logic to wc-order 2017-01-23 13:08:55 -08:00
Mike Jolley 99527e8013 Merge pull request #12680 from franticpsyx/remaining-incorrect-inline-comments
[2.7] Remaining inline comments about pointers
2016-12-22 22:37:33 +00:00
Mike Jolley 364d4bd82c Merge pull request #12675 from maciekkus/feature/make-tax-includes-text-consistient
Make 'includes tax' text wrapping with <small> tag consistient across order and cart table
2016-12-22 22:37:06 +00:00
Maciej Kuś e5bae8b7af space preserved before "included_tax" small element 2016-12-22 20:05:46 +01:00
Manos Psychogyiopoulos 40bf6afc29 fix incorrect inline comments
Ref: 01aba1fd2b
2016-12-22 19:41:23 +02:00
Mike Jolley 03b581f72e Refunds API/get_data() missing ID
Fixes #12672
2016-12-22 14:52:37 +00:00
Maciej Kuś 53c7c4025f includes tax wrapping <small> consistient across order and cart table 2016-12-22 13:56:29 +01:00
Mike Jolley 20680203bb Add actions for all object types 2016-12-19 17:09:52 +00:00
Mike Jolley d46d00bd08 Order numbers should be a string
Closes #12616
2016-12-16 11:49:00 +00:00
Mike Jolley 3c06dab0e8 Change action order to be compat with 2.6
Closes #12606
2016-12-15 13:08:25 +00:00
Mike Jolley 4bacbaf90c Fix completed and paid date meta keys. 2016-12-08 11:19:32 +00:00
Justin Shreve 174aa38be6 Start moving meta to normal stores, instead of a separate meta store. 2016-11-22 04:05:05 -08:00
Mike Jolley ac3be6ba50 Order stores complete 2016-11-18 14:07:21 +00:00
Mike Jolley 5d9a9b4dec Fix tests 2016-11-18 11:14:09 +00:00
Mike Jolley 8d6f236d47 Fix save 2016-11-17 16:02:09 +00:00
Mike Jolley 717f712b3d save addresses 2016-11-17 15:32:52 +00:00
Mike Jolley d88b512143 Setters 2016-11-17 15:17:23 +00:00
Mike Jolley 87aadaa7cf getters 2016-11-17 15:02:33 +00:00
Mike Jolley 52c866c57b Main order interface 2016-11-17 14:37:29 +00:00
Claudio Sanches 1360f6fc3e Docblock for #12287 2016-11-09 10:54:08 -02:00
Dwain Maralack 5f87161c06 add function arguments to the filter to give more context when filter is applied 2016-11-09 12:49:38 +02:00
Claudio Sanches 2de494e105 Merge pull request #12219 from ramiy/i18n-translation-comments
i18n: add translators comments
2016-11-03 13:24:35 -02:00
Mike Jolley 32e814eef1 Use all paid statuses in $customer->get_total_spent() 2016-11-03 11:27:03 +00:00
Rami Yushuvaev 93d55dade9 add translators comments 2016-10-29 20:32:38 +03:00
Claudio Sanches 4a1d5d3b0c Use Order CRUD to save admin order data (#12181)
* Fixed downlodable permissions while updating orders.

- Fixed undefined $wpdb fatal error
- Fixed how to update permissions when updated the billing_email

cc @mikejolley

* Use order CRUD to update admin order data

* Updated WC_Meta_Box_Order_Data::save() params and updated docblocks

* Missing period

* Handle cache and status on CRUD side
2016-10-28 10:52:01 +01:00
Justin Shreve e1e6c682b5 * Stop using _ as a prefix for protected or private vars and functions. We have a keyword for that.
* Introduces set_id and get_id to WC_Data for the CRUD classes to share
2016-09-09 05:36:54 -07:00
Mike Jolley 311c540662 Merge pull request #11833 from aristath/master
Coding Standards (2nd pass)
2016-09-07 10:14:17 +01:00
Mike Jolley cf59524dd7 Fix order total race condition in CRUD 2016-09-07 09:28:11 +01:00
Aristeides Stathopoulos 9dc4949e0a Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis 2016-09-02 06:17:42 +03:00
Aristeides Stathopoulos fde1037757 fix failing tests. 2016-09-01 23:50:14 +03:00
Mike Jolley 1b2df3dd3b Merge branch 'pr/11797'
# Conflicts:
#	includes/admin/meta-boxes/class-wc-meta-box-coupon-data.php
#	includes/api/class-wc-rest-coupons-controller.php
#	includes/class-wc-coupon.php
#	tests/unit-tests/api/coupons.php
#	tests/unit-tests/coupon/crud.php
2016-09-01 11:46:05 +01:00
Claudio Sanches 06280a7003 HTTPS for google maps 2016-08-31 14:18:55 -03:00
Aristeides Stathopoulos 17961f6484 WordPress.Arrays.ArrayDeclaration.ValueNoNewline 2016-08-27 06:04:10 +03:00
Aristeides Stathopoulos b063bcfe4c last item in a multiline-array should end in a comma 2016-08-27 04:46:45 +03:00
Mike Jolley 9bd57414c5 Remove set and get prop - no longer need the extra overhead since functions won't return wp_error now. 2016-08-26 10:48:17 +01:00
Mike Jolley 461ec4da16 Return false instead of throwing exception 2016-08-25 17:48:36 +01:00
Mike Jolley 658970cbc8 No string required here 2016-08-25 17:12:32 +01:00
Mike Jolley 3637814b92 Revert use of default_data for default args and just set that in constructor 2016-08-25 13:31:03 +01:00
Mike Jolley 25883f8687 Set_props helper to load data from DB and handle errors 2016-08-25 13:05:27 +01:00
Mike Jolley 938361535f Exception handling 2016-08-24 16:02:19 +01:00
Mike Jolley d9798f7226 Set reading to prevent exceptions during DB load 2016-08-24 14:37:19 +01:00
Mike Jolley 7e30e8dda3 Set defaults and handle order reads without exceptions 2016-08-24 12:34:19 +01:00
Mike Jolley 53f01b52a8 Bring back WC_Data_Exception 2016-08-24 10:46:29 +01:00
Mike Jolley b727acd96e Implement get and set prop methods 2016-08-23 18:48:48 +01:00
Mike Jolley e08e5a816d 2d array handling 2016-08-23 15:49:34 +01:00
Mike Jolley 2636d04ba6 Setters 2016-08-23 15:25:50 +01:00
Mike Jolley fdd7e797ba API get refunds 2016-08-22 13:15:15 +01:00
Mike Jolley 9e45927803 Create refund with crud 2016-08-22 13:15:15 +01:00
Mike Jolley 1baef12395 qty -> quantity 2016-08-16 12:36:38 +01:00
Mike Jolley 837e08143b Merge branch 'master' into orders-crud-classes
# Conflicts:
#	includes/abstracts/abstract-wc-order.php
2016-08-03 12:32:27 +01:00
Mike Jolley b11794ceac @Since changes 2016-06-29 12:58:38 +01:00
Mike Jolley 46439ddba5 Refund unit tests 2016-06-22 16:31:05 +01:00
Mike Jolley 9da9d3bf69 Unit test conditional functions 2016-06-22 15:38:28 +01:00
Mike Jolley 8287b13cf1 Address and CRUD unit tests 2016-06-22 14:07:42 +01:00
Mike Jolley ece2b5bf57 Order class 2016-06-21 20:06:39 +01:00
Mike Jolley ee0798047e Merge branch 'wc-get-orders-10500' 2016-03-14 16:09:01 +00:00
Mike Jolley 733b0c8c93 Lowercase includes %s string only 2016-03-14 10:41:48 +00:00
Mike Jolley c1e8dd1fe8 Use wc_get_orders iternally 2016-03-09 16:11:05 +00:00
Mike Jolley 37003b2370 Round get_remaining_refund_amount
Fixes #10060
2016-01-13 11:07:05 +00:00
Mike Jolley 2e553cf220 Show order refunds in totals
Fixes #9589 @claudiosmweb
2015-11-30 15:25:48 +00:00
Nicola Mustone c9da4f928a check if ABSPATH is defined 2015-11-06 10:22:19 +01:00
Scrutinizer Auto-Fixer 08efaf84df Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
2015-11-05 16:05:03 +00:00
Claudio Sanches 5893875b0c Removed period for file headers 2015-11-03 11:53:50 -02:00
Claudio Sanches ee30b5b308 Fixed php docs standards 2015-11-03 11:31:20 -02:00
Mike Jolley abaa8f47d8 Moved refund hooks to avoid emails after API refund failure 2015-10-06 14:43:36 +01:00
Ewout Fernhout 535949b02e add $display_refunded parameter to get_formatted_order_total
#8793
2015-08-13 15:45:49 +02:00
Mike Jolley 7b2aec4791 Take item qty into consideration when refunding orders
Fixes #8675
2015-07-29 13:13:41 +01:00
Mike Jolley 7285ce74e6 Tax display notice 2015-07-16 10:15:45 +01:00
Mike Jolley db473cc369 Move refund logic into main order class.
These methods are not defined in the abstract.
2015-07-15 16:02:26 +01:00
Mike Jolley b9708c4df9 Show refunded total shipping and taxes
Closes #8222
2015-06-01 11:06:11 +01:00
Mike Jolley efb8be72c2 Round tax total 2015-05-01 14:57:56 +01:00
Claudio Sanches def250e912 Display taxes labels in order totals when order has refunded, closes #7229 2015-01-29 18:50:08 -02:00
Mike Jolley e03cf9c204 Set order_type property, and move actual order loading to separate method to make it easier for sub-classes to handle just that process.
Closes #6513
2014-10-14 14:25:53 +01:00
Nick Ivanter 3fcae6e63f Allow WC_Order to be constructed w/o Order ID
This was allowed in WooCommerce 2.1 and some plugins rely on this behavior. Also, there seems to be no downside, as the parent class WC_Abstract_Order similarly doesn't require an Order ID at construction.
2014-09-22 14:58:18 +04:00
shivapoudel 5f05a78669 Line and indendation fix 2014-09-21 00:39:33 +05:45
Mike Jolley c4ef86d44e scrutinizer patches 2014-09-08 00:37:55 +01:00
Mike Jolley 5e663a7fa8 Show refunded line items inline 2014-07-25 16:48:19 +01:00
claudiosmweb 7328212c03 fixed the get refunds method 2014-07-24 12:09:03 -03:00
claudiosmweb ef445aa1d7 removed a test ¬¬ 2014-07-21 00:00:18 -03:00
claudiosmweb 299c12bd57 fixed order get_total_refunded() method 2014-07-20 23:48:23 -03:00
Mike Jolley 755001f19b Use order types where required 2014-07-11 12:43:42 +01:00
claudiosmweb 31a8483b4f created method to get the total amount already refunded 2014-07-08 16:59:38 -03:00
claudiosmweb 7d340abd6d fixed the get_refunds() method in WC_Order class 2014-07-08 16:41:03 -03:00
claudiosmweb 235deeacfe created get_refunds() method for WC_Order class 2014-07-08 15:23:22 -03:00
Coen Jacobs 86a4add087 Merge remote-tracking branch 'upstream/master' into order-factory-refactor
Conflicts:
	includes/class-wc-order.php
2014-07-03 13:38:55 +02:00
Mike Jolley 529b471470 Merge pull request #5771 from helgatheviking/fix/order-add_product-meta
wc_add_order_item_meta() the _line_total doesn't use the correct total
2014-07-02 13:58:48 +01:00
Mike Jolley 101254a6a3 Have get_product_from_item only return variable product if it exists, and show on the order item row if the variation no longer exists.
Fixes #5536
2014-07-02 13:58:10 +01:00
Kathy Darling cf322e9625 wc_add_order_item_meta() the _line_total doesn't use the total 2014-07-01 10:48:30 -04:00
Mike Jolley 779613b062 Merge pull request #5660 from tamarazuk/upstream
Introduce 'woocommerce_get_order_item_totals_excl_free_fees' filter
2014-06-30 12:00:25 +01:00
Mike Jolley 50a4c5bd23 Merge branch 'variation-stock-management'
Conflicts:
	includes/class-wc-product-variation.php
2014-06-27 11:15:42 +01:00
Mike Jolley 0f6f04e017 Added wc_stock_amount() core function and replaced intval
#4612
2014-06-25 11:25:28 +01:00
Mike Jolley 85befad283 Use max() to prevent division by zero Closes #5696 2014-06-23 12:56:11 +01:00
Mike Jolley cf3cca4c8e Merge branch 'feature-wc-create-order' 2014-06-18 16:07:29 +01:00
Mike Jolley 94549e1462 Notices 2014-06-13 16:11:15 +01:00
Mike Jolley 93778e72b0 Tax class fixes + notices 2014-06-13 15:53:59 +01:00
Mike Jolley 0f22691767 Calculate tax and totals methods 2014-06-13 15:21:15 +01:00
Coen Jacobs 476870d9f2 Created WC_Abstract_Order, extended by WC_Order 2014-06-13 15:37:20 +02:00
Mike Jolley 76d160c8fc Fire action when adding product 2014-06-13 10:20:38 +01:00
Mike Jolley a6da6e3353 Also use qty 2014-06-13 10:18:03 +01:00
Mike Jolley 5aa8b47c6b When setting totals, if not set get the data from the product 2014-06-13 10:14:18 +01:00
Mike Jolley 375a0e2652 static WC_Tax class - no need for a constructor in this 2014-06-12 16:47:43 +01:00
Tamara Zuk ee5d294ed7 Introduce 'woocommerce_get_order_item_totals_excl_free_fees' filter
The new filter will allow plugins that add order item meta to choose to
display the free fee items on order details pages and emails.
2014-06-11 19:16:27 -04:00
Mike Jolley 80ba9aa9c9 woocommerce_order_add_fee 2014-06-11 16:53:49 +01:00
Coen Jacobs 386751addf Support storing transaction id in payment_complete method 2014-06-11 16:36:32 +02:00
Mike Jolley ef3e728855 Setters + wc_create_order + wc_update_order for #4169 2014-06-11 15:10:03 +01:00
Coen Jacobs 3ad8935b20 Removed ununsed global variables in local scopes 2014-06-08 22:33:11 +02:00
Mike Jolley 32e77897cc Placeholder functions 2014-06-06 15:51:09 +01:00
Mike Jolley f30e95663b Prefixes for queries 2014-06-03 11:29:01 +01:00
Mike Jolley 9307fcf66b Internal wc- prefix and get_status filter 2014-06-03 11:04:56 +01:00
Mike Jolley 66f36d3f08 woocommerce_order_has_status filter 2014-06-03 10:47:16 +01:00
Mike Jolley 309f700283 has_status 2014-06-03 10:45:33 +01:00
Mike Jolley e0a74fffc4 implement is_status() 2014-05-30 17:43:21 +01:00
Mike Jolley fca32a98de Implement is_status functions and update_status 2014-05-30 17:16:22 +01:00
Mike Jolley 05b9b8af4e get_status_name + my_orders 2014-05-30 16:29:44 +01:00
Mike Jolley 3e687d2a6e Get status and is_status helpers which compare against post_status 2014-05-30 15:26:28 +01:00
claudiosmweb 96ea1d8bc4 introduces the WC_Order::needs_shipping_address() method 2014-05-28 16:20:36 -03:00
Coen Jacobs 6ab76b7ab0 Added parameter to get line subtotal filters 2014-05-26 16:44:36 +02:00
Manos Psychogyiopoulos 86b8e3e372 Add punctuation to fees 2014-05-14 18:22:55 +03:00
Mike Jolley 439ec0d4f6 Merge pull request #5425 from superdave2u/master
Updated the get_download_url() function - fixes #5424
2014-05-08 15:18:29 +01:00
Mike Jolley 3670afdffb [2.2] get_user and get_user_id methods
Closes #5429
2014-05-07 15:11:34 +01:00
Dave Mainville cabc84bf61 Closes #5424 2014-05-05 16:37:57 -04:00
Mike Jolley ca9955fa9a Update stock amounts with DB queries Closes #5367
@claudiosmweb and @coenjacobs please review
2014-04-25 15:28:02 +01:00
Mike Jolley 9b873093eb Check has_file when sending order emails for downloadables
Fixes #5296
2014-04-24 16:00:01 +01:00
Mike Jolley bf0fafa17b If billing email is not set and user ID is set, use email
Fixes #5356
2014-04-24 14:45:57 +01:00
Mike Jolley c09f710775 Merge pull request #5334 from ragulka/valid-order-statuses-improvements
Valid order statuses improvements
2014-04-23 15:07:15 +01:00
Illimar Tambek f07ff6acb5 Introduce `woocommerce_valid_order_statuses_for_payment_complete` filter
Since it's possible to filter the valid order statuses for payments and cancels,
it only makes sense to be able to do the same when checking which statuses
are valid for completing a payment.
2014-04-17 19:28:52 +03:00
Akeda Bagus 2a97f07d47 Typo fix. 2014-04-15 22:56:35 +07:00
Mike 16463e339e Change \WC_Order::add_order_note cap to edit_shop_order instead of manage_woocommerce 2014-04-03 14:33:54 +02:00
Mike Jolley 2f9860c583 Expanding line item_meta causes conflicts if attributes are named with things like 'name', 'type' or 'qty'. Added blacklist to exclude unsafe values. Closes #5100 2014-03-19 12:58:39 +00:00
justinstern 6dfce64e47 Don't trailingslash Order Cancel URLs with a Query String
With non-pretty permalinks enabled, this was producing a URI like
http://example.com/?page_id=7/  That final unnecessary trailing slash
messes up some redirect gateways that are passed the cancel URL
2014-03-11 00:04:49 -04:00
Mike Jolley 41183d1663 wc_delete_shop_order_transients functions and trigger when order status updates. Closes #4875 2014-02-26 15:43:19 +00:00
claudiosmweb bc98201d26 added the payment method title in order details, closes #4281 2014-02-15 03:14:04 -02:00
Mike Jolley 3bfbc9dfc5 Fix paypal shipping via text 2014-02-13 16:06:48 +00:00
Mike Jolley 767eba990d Return strings. Closes #4739 2014-02-12 12:21:36 +00:00
Coen Jacobs 9ae5cc5d8f get_subtotal_to_display docblock update. Closes #4693 2014-02-10 13:38:25 +01:00
Coen Jacobs 8b8cc20dab Merge pull request #4681 from thenbrent/master
Fix completing order payment for an order containing a deleted product
2014-02-10 10:30:01 +01:00
thenbrent 3187bfc32c Fix completing order payment for deleted product
When marking payment as complete on an order which contains a product which has
since been deleted, a fatal error will be thrown because the product is assumed
to exist.

The specific error is `PHP Fatal error: Call to a member function is_downloadable()`.
It occurs when checking if the order status should be set as completed or processing,
by determining if the product on the order is downloadable and virtual.

This patch will mark an order as "processing" if the product has since been deleted.
2014-02-08 11:37:21 -08:00
claudiosmweb 7dd98549d9 updated the WC_Order version to 2.1.0 2014-02-07 15:55:30 -02:00
claudiosmweb 93b5678617 fixed some coding standards in includes/class-wc-order.php 2014-02-07 15:55:07 -02:00
claudiosmweb 1c13e994de fixed the indentation in includes/class-wc-order.php 2014-02-07 15:41:28 -02:00
claudiosmweb 0d9752c04b fixed docblock for WC_Order::get_formatted_line_subtotal, closes #4667 2014-02-07 15:41:09 -02:00
Mike Jolley f46e6aefd7 Only show taxes in cart when taxes are enabled 2014-01-22 14:10:11 +00:00
Mike Jolley 858416605d Don't resort meta in admin 2014-01-07 10:38:28 +00:00