diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 685c8780e8b..cfefdaf7ab3 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -146,6 +146,15 @@ if ($action == 'other') $value = GETPOST('activate_useProdFournDesc', 'alpha'); $res = dolibarr_set_const($db, "PRODUIT_FOURN_TEXTS", $value,'chaine',0,'',$conf->entity); + if ($value) { + $sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1"; + $resql = $db->query($sql_test); + if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') // if the field does not exist, we create it + { + $sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN desc_fourn text"; + $resql_new = $db->query($sql_new); + } + } } if ($action == 'specimen') // For products