From 7b6e60077a51205a62e6801a6187da7c1ae0b196 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Jul 2017 21:53:28 +0200 Subject: [PATCH] FIX id of user not saved when making a payment of expense report --- .../class/paymentexpensereport.class.php | 18 +++++++++--------- htdocs/expensereport/payment/payment.php | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 9fc8c7627dd..e2f7536d86c 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -479,7 +479,7 @@ class PaymentExpenseReport extends CommonObject $total=$this->total; if ($mode == 'payment_expensereport') $amount=$total; - + // Insert payment into llx_bank $bank_line_id = $acc->addline( $this->datepaid, @@ -516,25 +516,25 @@ class PaymentExpenseReport extends CommonObject dol_print_error($this->db); } } - + // Add link 'user' in bank_url between user and bank transaction if (! $error) { - foreach ($this->amounts as $key => $value) // We should have always same third party but we loop in case of. + foreach ($this->amounts as $key => $value) // We should have always same user but we loop in case of. { if ($mode == 'payment_expensereport') { - $er = new ExpenseReport($this->db); - $er->fetch($key); - $er->fetch_user($er->fk_user_author); + $fuser = new User($this->db); + $fuser->fetch($key); + $result=$acc->add_url_line( $bank_line_id, - $er->user->id, + $fuser->id, DOL_URL_ROOT.'/user/card.php?id=', - $er->user->getFullName($langs), + $fuser->getFullName($langs), 'user' ); - if ($result <= 0) + if ($result <= 0) { $this->error=$this->db->lasterror(); dol_syslog(get_class($this).'::addPaymentToBank '.$this->error); diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index ebcc1056fe4..91839006b2f 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -78,7 +78,7 @@ if ($action == 'add_payment') setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToDebit")), null, 'errors'); $error++; } - + if (! $error) { $paymentid = 0; @@ -176,7 +176,7 @@ if (GETPOST("action") == 'create') print ''; print ''; print ''; - + dol_fiche_head(); print ''; @@ -225,7 +225,7 @@ if (GETPOST("action") == 'create') $form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '',1); // Show open bank account list print ''; } - + // Number print '
'.$langs->trans('Numero'); print ' ('.$langs->trans("ChequeOrTransferNumber").')';