"Create product" without a valid "Family" throws SQL/PHP error

Just a bug report:

When I want to create a new product and don’t select a valid “Family”, I get the following SQL/PHP error.

A Database Error Occurred
Error Number: 1366


 Incorrect integer value: '' for column 'family_id' at row 1
 INSERT
 INTO `ip_products` (`family_id`, `product_sku`, `product_name`, 
`product_description`, `product_price`, `tax_rate_id`, `purchase_price`)
 VALUES ('', '1', 'IT consultancy (Tristan Terpelle)', '', '1', '1', 
'0')
 Filename: /usr/local/www/example.com/core/MY_Model.php
 Line Number: 207

It would be more user friendly to get a warning saying I need to select a Family rather than the SQL/PHP message.

[size=10]Last Update 05.06.2015 (updated status)[/size]

I couldn’t reproduce this SQL error but I think I fixed this with an added number.
Please try again after the release of 1.4.1 and report back then.

Hi Kovah,

Sorry for not checking back earlier. I upgraded from 1.4.0 to 1.4.3 and the issue is solved.

BUT, if I leave the purchase price empty, I still get a similar error:

A Database Error Occurred
Error Number: 1265Data truncated for column 'purchase_price' at row 1
    INSERT INTO `ip_products` (`family_id`, `product_sku`, `product_name`, `product_description`, `product_price`, `tax_rate_id`, `purchase_price`) VALUES ('0', '2', 'Test2', 'test', '100', '0', '')Filename: /usr/local/www/begaaid.be/invoiceplane-1.4.3/core/MY_Model.phpLine Number: 207

create product without purchase price

put purchase price and not show error

I think need validation in family and purchase price

:wink:

This is fixed in 1.4.6 (maybe sooner): I have created a number of products without purchase price and it worked flawlessly. Nice work! :clap: