From 7fbf0b56d5dbba944a6f449f855170136e7d16d5 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 11 Feb 2021 11:13:12 +0100 Subject: [PATCH] NEW Bank Entries : add verif fk_user addPaymentToBank Social Contribution --- .../class/paymentsocialcontribution.class.php | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 3814a016b0c..7083740ae41 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -579,22 +579,23 @@ class PaymentSocialContribution extends CommonObject $result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc'); if ($result <= 0) dol_print_error($this->db); - $fuser = new User($this->db); - $fuser->fetch($socialcontrib->fk_user); + if($socialcontrib->fk_user) { + $fuser = new User($this->db); + $fuser->fetch($socialcontrib->fk_user); - // Add link 'user' in bank_url between operation and bank transaction - $result = $acc->add_url_line( - $bank_line_id, - $socialcontrib->fk_user, - DOL_URL_ROOT.'/user/card.php?id=', - $fuser->getFullName($langs), - 'user' - ); + // Add link 'user' in bank_url between operation and bank transaction + $result = $acc->add_url_line( + $bank_line_id, + $socialcontrib->fk_user, + DOL_URL_ROOT . '/user/card.php?id=', + $fuser->getFullName($langs), + 'user' + ); - if ($result <= 0) - { - $this->error = $acc->error; - $error++; + if ($result <= 0) { + $this->error = $acc->error; + $error++; + } } } }