FIX id of user not saved when making a payment of expense report
This commit is contained in:
parent
4290be7ee6
commit
7b6e60077a
@ -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>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user