Commit Graph

1178 Commits

Author SHA1 Message Date
Mike Jolley f47bb39a06 Merge pull request #15479 from woocommerce/add/poc-no-managing-meta-directly
Proof of concept to error when internal meta props are accessed directly
2017-07-27 15:54:24 +01:00
Mike Jolley 306db69eaf Remove order subclass 2017-07-27 10:49:47 +01:00
claudiulodro cfb04f0ead Boolval wasnt added til php 5.5 2017-07-26 13:48:36 -07:00
claudiulodro d15a2f5f6a Make tax calculation optional 2017-07-26 13:46:50 -07:00
claudiulodro 77838d05bb Fix unknown item variable 2017-07-26 10:25:08 -07:00
Mike Jolley b9b4336c1b Removed some duplicate keys 2017-07-26 16:50:34 +01:00
Mike Jolley abdb325d83 Order items 2017-07-26 15:47:30 +01:00
Mike Jolley 1faae6a7aa Order subclass 2017-07-26 14:32:43 +01:00
Mike Jolley 250dabaf41 WC_Cart_Totals subclass 2017-07-26 12:44:06 +01:00
Jaydeep Rami 46d3638089 Fix missing return statement (#16148)
* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement

* Fix missing return statement
2017-07-20 18:01:14 +01:00
Jaydeep Rami 3522857d23 Fix typo in WooCommerce plugin (#16135)
* Fixed typo

* Fixed more typo

* Fixed more typo

* Fix tyop

* Fix more typo

* Fix more typo

* Fix typo

* Fix typo

* Fix typo

* Fix typo datatime object

* Fix short name of compat

* Fix typo: update short name

* Fix typo "deactive" to "deactivate" and short BW - Compat

* Fix typo "Backwards compat"

* Fix typo 'parameters'

* Fix more typo 'pararmeters'

* Fix typo 'compund'

* FIx typo order

* Fix typo

* Fix typo 'incorrecly'

* Fix typo 'genarate'

* Fix typo 'reletive'

* Fix typo 'Handly'

* Fix typo 'rotatated'

* Fix typo

* Fix typo 'additonal'

* Fix typos
2017-07-17 11:10:52 +01:00
Akeda Bagus 53807185a8
Fixed typos.
These typos are catched by `misspell` program.

```
find . -type f | grep -v assets | grep -v dummy-data | grep -v i18n | grep -v node_modules | grep -v .git | grep -v apigen |  xargs misspell -w
```

Some results were excluded because of 3rd party ownership and non-english
sentences.
2017-07-10 12:56:28 +07:00
Mike Jolley e539d3125a Refactor shipping rate to include instance IDs 2017-07-07 14:14:29 +01:00
Brent Shepherd 1992d90d37 Revert "Merge pull request #14706 from crodas/make_get_item_consistent"
This reverts commit 56ffa3d2aa, reversing
changes made to 64a60de24f.
2017-06-27 22:28:23 -07:00
claudiulodro 4515e5fca9 Fix undefined/incorrectly used variables 2017-06-09 14:10:55 -07:00
Boro Sitnikovski 68d512ae01 Address PR comments 2017-06-08 13:00:28 +02:00
Boro Sitnikovski 0271a9e2fe Update version 2017-06-07 16:20:09 +02:00
Boro Sitnikovski 00847da730 Fix 2017-06-07 12:33:05 +02:00
Boro Sitnikovski 1584836fa9 Code style fixes 2017-06-07 12:31:42 +02:00
Boro Sitnikovski b5fd62274f Map the correct function and use notice instead of exception 2017-06-07 12:30:03 +02:00
jgacuca567 4a9950b4c5 Changed their to there 2017-06-06 17:30:20 -04:00
Boro Sitnikovski efd42e6bc4 Proof of concept to error when internal meta props are accessed directly 2017-06-06 19:13:53 +02:00
Claudio Sanches 46846ed4e0 Merge pull request #15416 from woocommerce/fix/15407
Correctly append cache
2017-06-02 12:18:55 -03:00
Mike Jolley da91857a84 Correctly append cache
Fixes #15407
2017-06-02 13:34:09 +01:00
Cesar Rodas c96c62f380 Improved how taxes are applied
If by default the taxes are based on the shipping address and the current order doesn't have any, it would use the billing address rather than using the Shopping base location.

It's basically what WooCommerce is [doing already in Javascript](https://github.com/woocommerce/woocommerce/blob/master/assets/js/admin/meta-boxes-order.js#L526-L575). This kind of checks should be done in the backend, never in the client side.
2017-06-01 15:51:55 -04:00
Cesar Rodas 5997ffd4b1 Fixed coding styles issues 2017-06-01 11:46:05 -04:00
David de Boer d788b15073 Set delete_meta_data @param to accept a string
Set delete_meta_data @param to accept a string
2017-06-01 01:47:52 +02:00
Claudio Sanches d9e946491f Merge pull request #15357 from woocommerce/fix/15274-meta
Add ability to invalidate cache by object ID
2017-05-31 11:53:53 -03:00
Mike Jolley cb59bd0487 Merge pull request #15351 from woocommerce/fix/15329
Use get_max_purchase_quantityin cart template and fix logic
2017-05-31 11:39:53 +01:00
Mike Jolley 56ffa3d2aa Merge pull request #14706 from crodas/make_get_item_consistent
Make get item consistent
2017-05-31 11:10:09 +01:00
Mike Jolley 2366a036e3 Add id cache group to invalidate by ID 2017-05-30 14:37:29 +01:00
Mike Jolley 38bcdcfb28 Use get_max_purchase_quantityin cart template and fix logic
Closes #15329
2017-05-30 11:02:56 +01:00
Cesar Rodas 8c67ae6a7a Make `get_item` to rely no `get_items` 2017-05-29 12:38:25 -04:00
Cesar Rodas 563aa887f7 Apply woocommerce_order_get_items filter to get_item 2017-05-24 17:30:14 -04:00
Cesar Rodas ea9c573f2c Improved WC_Order::get_item()
Do not load all items, just load the items with a given order_item_type.
2017-05-23 20:12:47 -04:00
Cesar Rodas b612bab38b Fixed coding styles 2017-05-23 19:18:31 -04:00
Cesar Rodas b158ba2c47 Merge remote-tracking branch 'origin/master' into improve_meta_data_updates 2017-05-23 17:34:12 -04:00
Mike Jolley a3b89a9efc Merge pull request #15144 from timondavis/fix/15103-cannot_set_default_variation_to_string_zero
#15103 Variation default value of '0' fails to save on product.
2017-05-23 19:31:38 +01:00
Mike Jolley 6dfdc86111 Merge branch 'pr/14678' 2017-05-23 19:16:37 +01:00
Mike Jolley 109e951de3 Renamed filters and actions 2017-05-23 19:16:30 +01:00
Mike Jolley c16acc6b51 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	assets/css/wc-setup-rtl.css
#	assets/css/wc-setup.css
2017-05-23 19:00:24 +01:00
Mike Jolley d3666738d8 Merge branch 'pr/15069' 2017-05-23 18:56:58 +01:00
Mike Jolley 00e5189a05 Merge pull request #15070 from rasmusbe/phpdoc-missing-return-throws
Phpdoc: Add missing return and throws
2017-05-23 18:50:58 +01:00
Mike Jolley db012b3a12 Merge pull request #15011 from woocommerce/fix/14999
Add abspath checks
2017-05-23 15:57:35 +01:00
Mike Jolley d31a58b117 More abspath 2017-05-23 15:40:19 +01:00
Timon Davis af308da6b9 Fix bug #15103 where site operator cannot assign a variation with value of '0' as the default choice on the customer facing form.
The WC_Product::set_default_attributes function uses an array_filter (using the default callback for filtration)
to remove null and false values from the defaults array for a given product.  The issue here is that, in the above use case,
the array_filter will evaluate '0' as 0 and therefore as false.  Ultimately, array_filter then prevents the value from being
recorded, moving forward.

I've added a new filter callback to includes/wc-attribute-functions which will disregard all FALSE PHP equivalents except for
'0' (as a a string).  Also, I've updated the filter_array call in WC_Product::set_default_attributes so that it uses this new callback,
instead of the PHP default. Finally, I've added a phpunit test to assert that, when storing default variations / attributes on a product,
the false/true PHP synonyms are evaluating and storing like one would normally expect, with the exception that (string) '0'
evaluates as true in this special case.

This solution could potentially be broadened to facililate similar rules elsewhere, but the need raised in the bug is specific and
this is a specific solution.
2017-05-18 02:43:14 -07:00
Mike Jolley dd798d219e Make calculate tax function clear taxes if disabled on recalculation
Fixes #15057
2017-05-15 14:55:39 +01:00
Rasmus Bengtsson 185934fad9 Fix phpdoc to include params and correct types 2017-05-15 13:50:52 +02:00
Rasmus Bengtsson 4f00d7e5e3 PHPDoc: Add missing return statement 2017-05-15 13:37:59 +02:00
claudiulodro 3861e32803 Migrate wc_get_orders 2017-05-12 11:45:01 -07:00
Mike Jolley bc4d36fd3f Add abspath checks
Closes #14999
2017-05-10 19:03:19 +01:00
Rasmus 98833fa9c5 Fix param documentation for WC_Product::is_type 2017-05-09 14:10:27 +02:00
Claudio Sanches 257594a67c Merge pull request #14945 from woocommerce/pr/14875
Pr/14875
2017-05-08 13:56:12 -03:00
Mike Jolley 03a69e1d44 Prepend new item keys with `$items_key` to make them unique.
Fixes #14875
2017-05-08 17:44:10 +01:00
Mike Jolley dd3be1278b Merge pull request #14733 from woocommerce/feature/13646
WC_Object_Query & WC_Order_Query
2017-05-07 14:24:12 +01:00
Claudio Sanches 9930099b98 Merge pull request #14846 from woocommerce/fix/non-numeric-warning-order
Fix non numeric warning for orders.
2017-05-04 18:35:51 -03:00
Boro Sitnikovski f493afe718 intval -> floatval 2017-05-04 10:09:16 +02:00
Claudio Sanches 84dfaf3c09 Merge pull request #14851 from franticpsyx/clone-meta-data
[3.0] Clone each meta stdClass object when cloning a WC_Data object
2017-05-03 18:03:54 -03:00
Manos Psychogyiopoulos 8f7671f066 Clone each meta object when cloning WC_Data object to avoid modifying original meta stdClass objects 2017-05-03 16:37:01 +03:00
Boro Sitnikovski 8f63211f1c Fix non numeric warning for orders. 2017-05-03 08:31:35 +02:00
claudiulodro c93c45b15e Docblock 2017-04-28 09:55:49 -07:00
claudiulodro 30d2332f48 Handle paginate 2017-04-27 19:14:48 -07:00
claudiulodro 4eb1396e85 Offload more to subclasses 2017-04-27 14:09:10 -07:00
claudiulodro db3de7375d Tweaks from feedback 2017-04-27 11:07:03 -07:00
Mike Jolley 796ab0f257 Merge pull request #14756 from woocommerce/fix/14753
Compare with timestamp and remove start date once passed for sale products
2017-04-27 18:06:18 +01:00
Cesar Rodas 7a8011e878 Merge remote-tracking branch 'origin/master' into improve_meta_data_updates 2017-04-27 12:29:09 -04:00
Mike Jolley a68934d7db Merge pull request #14731 from crodas/make_sure_meta_data_cache_is_not_shared
Make sure the meta data cache is not shared among instances
2017-04-27 16:50:10 +01:00
claudiulodro 6aecb15505 Reduce scope 2017-04-27 08:38:18 -07:00
Mike Jolley eedcdd97ba Compare with timestamp and remove start date once passed for sale products
Fixes #14753
2017-04-27 14:35:33 +01:00
Cesar Rodas 2e6dc17bd5 Improved update_meta_data function
Also updated unit tests that was expecting the meta data as stdclass objects
2017-04-27 09:28:19 -04:00
Mike Jolley a6329fa68c Merge pull request #14752 from woocommerce/pr/14732
revert price handling of get_price_html()
2017-04-27 13:03:15 +01:00
Mike Jolley db5e2572f6 clean up 2017-04-27 13:01:52 +01:00
claudiulodro 2fad12221d Better comments 2017-04-26 11:04:28 -07:00
Cesar Rodas 91de312eb2 Make sure the meta data cache is not shared among instances
See #14620 for more context. In there I thought this was the desired behaviour and I enhanced it. After talking with @mikejolley he explained to me that it was not by designed.

This commit makes sure the meta data cache is not shared among instances
2017-04-26 13:51:52 -04:00
Kathy Darling 36dbe64170 revert price handling so null price still is filtered by woocommerce_get_price_html. closes #14727. 2017-04-26 12:37:30 -05:00
Cesar Rodas 6eb7dcabf2 Added WC_Meta_Data object
It wraps an array, and tells if there were any changes before saving it
2017-04-26 10:18:41 -04:00
Cesar Rodas 7f357b18ba Fixed typo
This expression had a typo from the refactoring
2017-04-26 03:21:10 -04:00
Cesar Rodas d3fd16617c Improved phpdoc 2017-04-26 02:57:00 -04:00
Cesar Rodas 38f379a7d7 Make get_item() consistent (like get_items())
Right now get_item() is loading an item from the database directly. It doesn't
take advantage of our cache and it doesn't check if the item is already loaded in memory.

There is also another bug (or feature?) that it will let you load any item, even if the item is not related to the current order. I believe this is a bug, if somebody really wants to load any item regardless of the order they should use `WC_Order_Factory::get_order_item`.

Another bug is that items loaded with get_item() are not related to the order object, therefore any calls to Order::save() won't persist the changes made to the item.

This commits makes sure the item returned by get_item is loaded similarly like get_items() does, taking advantage of the cache and the $items protected property (chances are the item is already in memory, ready to be used).

If a given item is not found false will be returned. If item exists but it is not related to the current object it will return false as well (If this behaviour is wanted, I can easily change it load the item anyways instead of returning false).
2017-04-26 02:54:14 -04:00
claudiulodro efa1dbbda5 Basic working order queries 2017-04-25 14:52:17 -07:00
Petar Petrov fdb28218ea items_type_key filter and woocommerce_order_line_item_object fix 2017-04-25 18:07:40 +03:00
Mike Jolley 9923612832 Prevent orders being their own parent (!)
Closes #14660
2017-04-25 14:18:27 +01:00
Petar Petrov 2b3ec357ad fix-14302 2017-04-25 14:12:36 +03:00
claudiulodro 553a12203b WC_Order_Query 2017-04-24 16:28:13 -07:00
claudiulodro 29fa59a0b7 WC_Object_Query 2017-04-24 11:33:17 -07:00
Mike Jolley 4a6c87d1cc docblock 2017-04-20 16:03:40 +01:00
Mike Jolley 8e28af8b87 define get_user_id/get_user methods for bw compat
Closes #14543
2017-04-20 16:02:10 +01:00
Mike Jolley 69a8b6c9b5 When on backorder without notifications, hide the text
Fixes #14530
2017-04-19 16:57:49 +01:00
Claudio Sanches d94f3883da Merge pull request #14497 from woocommerce/fix/14416
Fixed docblocks in REST API v1
2017-04-18 18:43:06 -03:00
Claudio Sanches 81dcd6e79e Fixed docblocks in REST API v1 for #14416 2017-04-18 13:40:10 -03:00
Mike Jolley de016c6615 Fix call to is_compound method
Fixes #14484
2017-04-18 12:00:21 +01:00
Govind Kumar 200cd2de63 Fixed: get_term() returns objects not array. 2017-04-18 13:00:04 +05:30
Mike Jolley 71929666ac Merge pull request #14404 from thenbrent/fix_get_meta_returning_deleted_values
Don't return deleted meta in get_meta_data()
2017-04-17 11:38:12 +01:00
Beka Rice d35621f166 Cast unmodified tax as float as well 2017-04-15 12:01:37 -04:00
Brent Shepherd 0e40d2c764 Don't return deleted meta
By using $this->get_meta_data() which passed meta through the
WC_Data::filter_null_meta() method, rather than $this->meta_data
which still has null values set.
2017-04-14 13:58:00 -07:00
Beka Rice 9de8589c9c Fix PHP 7.1 warnings when manually adding order items 2017-04-14 11:12:53 -04:00
Mike Jolley 76d962b606 since 2017-04-10 21:52:06 +01:00
Mike Jolley e14d85d0a3 __clone meta correctly on object clone
Fixes #14118
2017-04-10 17:12:17 +01:00
Claudiu Lodromanean 19361127a9 Array filter before saving 2017-04-06 14:47:22 -07:00
Mike Jolley fbcb46b273 filter items which are false
https://wordpress.org/support/topic/call-to-a-member-function-is_type-cl
ass-wc-order-php-on-line-1305/
2017-04-06 22:15:42 +01:00