{"action":"created","issue":{"url":"https://api.github.com/repos/cubecart/v6/issues/827","labels_url":"https://api.github.com/repos/cubecart/v6/issues/827/labels{/name}","comments_url":"https://api.github.com/repos/cubecart/v6/issues/827/comments","events_url":"https://api.github.com/repos/cubecart/v6/issues/827/events","html_url":"https://github.com/cubecart/v6/issues/827","id":107982846,"number":827,"title":"Condition to unset record fails for 'product_weight'","user":{"login":"briansandall","id":14335170,"avatar_url":"https://avatars.githubusercontent.com/u/14335170?v=3","gravatar_id":"","url":"https://api.github.com/users/briansandall","html_url":"https://github.com/briansandall","followers_url":"https://api.github.com/users/briansandall/followers","following_url":"https://api.github.com/users/briansandall/following{/other_user}","gists_url":"https://api.github.com/users/briansandall/gists{/gist_id}","starred_url":"https://api.github.com/users/briansandall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/briansandall/subscriptions","organizations_url":"https://api.github.com/users/briansandall/orgs","repos_url":"https://api.github.com/users/briansandall/repos","events_url":"https://api.github.com/users/briansandall/events{/privacy}","received_events_url":"https://api.github.com/users/briansandall/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cubecart/v6/labels/bug","name":"bug","color":"e11d21"}],"state":"closed","locked":false,"assignee":{"login":"abrookbanks","id":4520803,"avatar_url":"https://avatars.githubusercontent.com/u/4520803?v=3","gravatar_id":"","url":"https://api.github.com/users/abrookbanks","html_url":"https://github.com/abrookbanks","followers_url":"https://api.github.com/users/abrookbanks/followers","following_url":"https://api.github.com/users/abrookbanks/following{/other_user}","gists_url":"https://api.github.com/users/abrookbanks/gists{/gist_id}","starred_url":"https://api.github.com/users/abrookbanks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abrookbanks/subscriptions","organizations_url":"https://api.github.com/users/abrookbanks/orgs","repos_url":"https://api.github.com/users/abrookbanks/repos","events_url":"https://api.github.com/users/abrookbanks/events{/privacy}","received_events_url":"https://api.github.com/users/abrookbanks/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/cubecart/v6/milestones/17","html_url":"https://github.com/cubecart/v6/milestones/6.0.8","labels_url":"https://api.github.com/repos/cubecart/v6/milestones/17/labels","id":1293414,"number":17,"title":"6.0.8","description":"","creator":{"login":"abrookbanks","id":4520803,"avatar_url":"https://avatars.githubusercontent.com/u/4520803?v=3","gravatar_id":"","url":"https://api.github.com/users/abrookbanks","html_url":"https://github.com/abrookbanks","followers_url":"https://api.github.com/users/abrookbanks/followers","following_url":"https://api.github.com/users/abrookbanks/following{/other_user}","gists_url":"https://api.github.com/users/abrookbanks/gists{/gist_id}","starred_url":"https://api.github.com/users/abrookbanks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abrookbanks/subscriptions","organizations_url":"https://api.github.com/users/abrookbanks/orgs","repos_url":"https://api.github.com/users/abrookbanks/repos","events_url":"https://api.github.com/users/abrookbanks/events{/privacy}","received_events_url":"https://api.github.com/users/abrookbanks/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":19,"state":"open","created_at":"2015-09-07T09:47:12Z","updated_at":"2015-09-25T10:09:48Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-09-23T18:50:40Z","updated_at":"2015-09-25T10:09:48Z","closed_at":"2015-09-25T10:09:48Z","body":"In /admin/sources/products.index.inc.php on [line 68](https://github.com/cubecart/v6/blob/master/admin/sources/products.index.inc.php#L68):\r\n```php\r\nif (empty($record[$r]) && $record[$r]!=='0' && $record[$r]!=='0.0') {\r\n```\r\nProduct weight is of type DECIMAL(10,3) in the cubecart_inventory table, meaning that it will always be in the format '0.000' when pulled from the database with a zero value - as such, it will not match the above conditionals. It should probably use a regex such as:\r\n```php\r\nif (empty($record[$r]) && preg_match('/^(0|0\\.0+)$/', $record[$r])) {\r\n    unset($record[$r]);\r\n}\r\n```\r\nThere is a comment in the code explaining that the above is designed to prevent certain SQL errors - which ones would those be? 'stock_level' and 'stock_warning' both have a default of zero, and 'product_weight', while it defaults to null, should not have any issue being set to zero. Anyway, just curious."},"comment":{"url":"https://api.github.com/repos/cubecart/v6/issues/comments/143180202","html_url":"https://github.com/cubecart/v6/issues/827#issuecomment-143180202","issue_url":"https://api.github.com/repos/cubecart/v6/issues/827","id":143180202,"user":{"login":"abrookbanks","id":4520803,"avatar_url":"https://avatars.githubusercontent.com/u/4520803?v=3","gravatar_id":"","url":"https://api.github.com/users/abrookbanks","html_url":"https://github.com/abrookbanks","followers_url":"https://api.github.com/users/abrookbanks/followers","following_url":"https://api.github.com/users/abrookbanks/following{/other_user}","gists_url":"https://api.github.com/users/abrookbanks/gists{/gist_id}","starred_url":"https://api.github.com/users/abrookbanks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abrookbanks/subscriptions","organizations_url":"https://api.github.com/users/abrookbanks/orgs","repos_url":"https://api.github.com/users/abrookbanks/repos","events_url":"https://api.github.com/users/abrookbanks/events{/privacy}","received_events_url":"https://api.github.com/users/abrookbanks/received_events","type":"User","site_admin":false},"created_at":"2015-09-25T10:09:48Z","updated_at":"2015-09-25T10:09:48Z","body":"Thanks thats a nice tweak. I'm not sure what the SQL error would be."}}