diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 089533433ba..d0ffd822df3 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -224,9 +224,16 @@ if ($_GET["action"] == 'delete') // delete
$sql = "DELETE from ".$tabname[$_GET["id"]]." WHERE $rowidcol='".$_GET["rowid"]."'";
$result = $db->query($sql);
- if (!$result)
+ if (! $result)
{
- dolibarr_print_error($db);
+ if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
+ {
+ $msg='
'.$langs->trans("ErrorRecordIsUsedByChild").'
';
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
}
}
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 3686a474933..153da598291 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -19,6 +19,7 @@ ErrorInternalErrorDetected=Internal error detected
ErrorNoRequestRan=No request ran
ErrorWrongHostParameter=Wrong host parameter
ErrorYourCountryIsNotDefined=Your country is not defined. Go to Home-Setup-Edit and post again the form.
+ErrorRecordIsUsedByChild=Failed to delete this record. This record is used by at least on child records.
HomeArea=Home area
LastAccess=Last access
RequestedUrl=Requested Url
diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang
index d8e4ef03a56..6ca8ffe86c0 100644
--- a/htdocs/langs/fr_FR/main.lang
+++ b/htdocs/langs/fr_FR/main.lang
@@ -19,6 +19,7 @@ ErrorInternalErrorDetected=Erreur interne d
ErrorNoRequestRan=Aucune requête exécutée
ErrorWrongHostParameter=Mauvais paramètre Serveur
ErrorYourCountryIsNotDefined=Votre pays n'est pas défini. Aller dans Configuration-Général-Editer et resoumettez le formulaire.
+ErrorRecordIsUsedByChild=Impossible de supprimer cet enregistrement. Ce dernier est utilisé en tant que père par au moins un enregistrement fils.
HomeArea=Espace accueil
LastAccess=Dernière connexion
RequestedUrl=Url sollicitée