diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 1b3d231382c..8fb590d61b4 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -186,8 +186,12 @@ if (empty($reshook)) if ($ret < 0) $error++; if (! $error) { - $result = $object->insertExtraFields(); - if ($result < 0) $error++; + $result = $object->insertExtraFields(); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } } if ($error) $action = 'edit_extras'; } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 835d5971ed2..eedc6002dcc 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1176,7 +1176,11 @@ if (empty($reshook)) if (! $error) { $result = $object->insertExtraFields(); - if ($result < 0) $error++; + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } } if ($error) $action = 'edit_extras'; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 1402cc75870..549eab79d2f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1226,7 +1226,9 @@ if (empty($reshook)) // some hooks if (empty($reshook)) { $result = $object->insertExtraFields(); - if ($result < 0) { + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); $error++; } } else if ($reshook < 0) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a6f37ae4fc3..03ba1dccccc 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2041,8 +2041,10 @@ if (empty($reshook)) // some hooks if (empty($reshook)) { $result = $object->insertExtraFields(); - if ($result < 0) { - $error ++; + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; } } else if ($reshook < 0) $error ++; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index fbdabad8fa0..622b1bc7731 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -386,22 +386,16 @@ if (empty($reshook)) // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); - if ($ret < 0) - $error ++; + if ($ret < 0) $error++; - if (! $error) { - - $result = $object->insertExtraFields(); - if ($result < 0) { - $error ++; - } - } else if ($reshook < 0) - $error ++; - - if ($error) { - $action = 'edit_extras'; - setEventMessages($object->error, $object->errors, 'errors'); - } + if (! $error) { + $result = $object->insertExtraFields(); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } } // Add a new line diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index fd5898879ae..14913f5d2ee 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -821,21 +821,19 @@ if (empty($reshook)) // Fill array 'array_options' with data from update form $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); - if ($ret < 0) - $error ++; + if ($ret < 0) $error++; if (! $error) { - - $result = $object->insertExtraFields(); - if ($result < 0) { - $error ++; - } - } else if ($reshook < 0) - $error ++; + $result = $object->insertExtraFields(); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } if ($error) { $action = 'edit_extras'; - setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action=='setref_supplier') diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index e04f4e0cb92..fa8d3d6dea4 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -151,10 +151,10 @@ $langs->load("modulebuilder"); - textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?> - textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?> - textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?> - textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0)?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0,'', 0, 2, 'helpvalue1')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0,'', 0, 2, 'helpvalue2')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0,'', 0, 2, 'helpvalue3')?> + textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0,'', 0, 2, 'helpvalue4')?> diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8cecd906529..7e9213a2c9a 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -173,9 +173,11 @@ if (empty($reshook)) $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { $result = $object->insertExtraFields(); - if ($result < 0) { - $error++; - } + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } } else if ($reshook < 0) $error++; } diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 80274f9b579..957d9864e16 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -191,9 +191,11 @@ if (empty($reshook)) // some hooks if (empty($reshook)) { $result = $object->insertExtraFields(); - if ($result < 0) { - $error++; - } + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } } else if ($reshook < 0) $error++; } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 3af4709ee6c..29a058f2d33 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -296,9 +296,11 @@ if (empty($reshook)) // some hooks if (empty($reshook)) { $result = $object->insertExtraFields(); - if ($result < 0) { - $error++; - } + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } } else if ($reshook < 0) $error++; } diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 8cff2b885b0..b0de98ae2eb 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -207,7 +207,9 @@ if ($action == 'update_extras') $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { $result = $object->insertExtraFields(); - if ($result < 0) { + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); $error++; } } else if ($reshook < 0) diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 70d907ae5e9..3a8f4cbff4e 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -136,9 +136,11 @@ if (empty($reshook)) // some hooks if (empty($reshook)) { $result = $object->insertExtraFields(); - if ($result < 0) { - $error++; - } + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } } else if ($reshook < 0) $error++; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 3d3bfa1b6d1..5e02cb99eaf 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -290,11 +290,17 @@ if (empty($reshook)) $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); if ($ret < 0) $error++; + if (! $error) { $result = $object->insertExtraFields(); - if ($result < 0) $error++; + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } } + if ($error) $action = 'edit_extras'; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index cfdb94c42bb..75ea0cd12ed 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -930,11 +930,17 @@ if (empty($reshook)) $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); if ($ret < 0) $error++; + if (! $error) { $result = $object->insertExtraFields(); - if ($result < 0) $error++; + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } } + if ($error) $action = 'edit_extras'; } }