Skip to content
Snippets Groups Projects
Commit 7b6e6007 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

FIX id of user not saved when making a payment of expense report

parent 4290be7e
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
......@@ -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 '<input type="hidden" name="id" value="'.$chid.'">';
print '<input type="hidden" name="chid" value="'.$chid.'">';
print '<input type="hidden" name="action" value="add_payment">';
dol_fiche_head();
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
......@@ -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 '</td></tr>';
}
// Number
print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment