diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php
index 067c021fe75..83a6a8f3b3a 100644
--- a/htdocs/compta/sociales/card.php
+++ b/htdocs/compta/sociales/card.php
@@ -445,12 +445,24 @@ if ($id > 0) {
// Employee
if ($action != 'editfk_user') {
- $morehtmlref .= '
' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
-
- if (!empty($object->fk_user)) {
+ if ($object->getSommePaiement() > 0 && !empty($object->fk_user)) {
$userstatic = new User($db);
- $userstatic->fetch($object->fk_user);
- $morehtmlref .= $userstatic->getNomUrl(1);
+ $result = $userstatic->fetch($object->fk_user);
+ if ($result > 0) {
+ $morehtmlref .= '
' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(1);
+ }
+ } else {
+ $morehtmlref .= '
' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1);
+ if (!empty($object->fk_user)) {
+ $userstatic = new User($db);
+ $result = $userstatic->fetch($object->fk_user);
+ if ($result > 0) {
+ $morehtmlref .= $userstatic->getNomUrl(1);
+ } else {
+ dol_print_error($db);
+ exit();
+ }
+ }
}
} else {
$morehtmlref .= '
'.$langs->trans('Employee').' : ';