diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 187a4ab7b8f..df226ad807e 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -63,7 +63,7 @@ $dateech = dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), $dateperiod = dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear')); $label = GETPOST('label', 'alpha'); $actioncode = GETPOST('actioncode'); -$fk_user = GETPOST('userid', 'int'); +$fk_user = GETPOST('userid', 'int') > 0 ? GETPOST('userid', 'int') : 0; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('taxcard', 'globalcard')); @@ -511,7 +511,7 @@ if ($id > 0) { // Employee if ($action != 'editfk_user') { - if ($object->getSommePaiement() > 0 && !empty($object->fk_user)) { + if ($object->getSommePaiement() > 0 && $object->fk_user > 0) { $userstatic = new User($db); $result = $userstatic->fetch($object->fk_user); if ($result > 0) { @@ -519,7 +519,7 @@ if ($id > 0) { } } else { $morehtmlref .= '
' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); - if (!empty($object->fk_user)) { + if ($object->fk_user > 0) { $userstatic = new User($db); $result = $userstatic->fetch($object->fk_user); if ($result > 0) {