wp-e-commerce / WP-e-Commerce

WP eCommerce - The most popular independent eCommerce platform for WordPress
https://wpecommerce.org
GNU General Public License v2.0
215 stars 217 forks source link

updating purcahse log check if value exists #2357

Open mihaijoldis opened 6 years ago

mihaijoldis commented 6 years ago

An example:

$order = new WPSC_Purchase_Log( $log_id );
$order->set( 'my_custom_data', '1' )->save();

throws a notice since my_custom_data is not a field in the purchase log table but the value does get saved as a meta field. save() would normally do that on it’s own, but it supposes that you’re updating something on the purchase table as well. Seems to me that somewhere in here, we should be validating the $data. If it’s empty, we’ve got nothing to update, and should bail.

https://github.com/wp-e-commerce/WP-e-Commerce/blob/4ea716c80c874833bd909ca7c56581b654807b35/wpsc-includes/purchase-log.class.php#L1005-L1008