Dolibarr / dolibarr

Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). it's an open source Web application (written in PHP) designed for businesses of any sizes, foundations and freelancers.
https://www.dolibarr.org
GNU General Public License v3.0
5.47k stars 2.8k forks source link

Weight / height can't be empty with unit pre-selected #31711

Open Themiller12 opened 1 week ago

Themiller12 commented 1 week ago

Bug

Hi, we created lot of products in previous versions of Dolibarr, and we are used to clone similars products to create new ones. But in 20.0.1 if you want to save a product with unit pre-selected and empty field, you'll have a blank page.

Simple fix in functions2.lib.php :

`function weight_convert($weight, &$from_unit, $to_unit) {

if(!empty($from_unit) AND $from_unit > 0) {

$weight = is_numeric($weight) ? $weight : 0;
while ($from_unit != $to_unit) {

[.....] `

Dolibarr Version

20.0.1

Environment PHP

8

Environment Database

No response

Steps to reproduce the behavior and expected behavior

No response

Attached files

bug doli 20
IC-Safa commented 15 hours ago

Hi, I'm not really to understand your issue here. Is it when you create the product you want to pre-define units but it doesn't save them if they are empty right ? if so, I can manage to replicate the bug