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;
|
$total=$this->total;
|
||||||
if ($mode == 'payment_expensereport') $amount=$total;
|
if ($mode == 'payment_expensereport') $amount=$total;
|
||||||
|
|
||||||
// Insert payment into llx_bank
|
// Insert payment into llx_bank
|
||||||
$bank_line_id = $acc->addline(
|
$bank_line_id = $acc->addline(
|
||||||
$this->datepaid,
|
$this->datepaid,
|
||||||
@ -516,25 +516,25 @@ class PaymentExpenseReport extends CommonObject
|
|||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add link 'user' in bank_url between user and bank transaction
|
// Add link 'user' in bank_url between user and bank transaction
|
||||||
if (! $error)
|
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')
|
if ($mode == 'payment_expensereport')
|
||||||
{
|
{
|
||||||
$er = new ExpenseReport($this->db);
|
$fuser = new User($this->db);
|
||||||
$er->fetch($key);
|
$fuser->fetch($key);
|
||||||
$er->fetch_user($er->fk_user_author);
|
|
||||||
$result=$acc->add_url_line(
|
$result=$acc->add_url_line(
|
||||||
$bank_line_id,
|
$bank_line_id,
|
||||||
$er->user->id,
|
$fuser->id,
|
||||||
DOL_URL_ROOT.'/user/card.php?id=',
|
DOL_URL_ROOT.'/user/card.php?id=',
|
||||||
$er->user->getFullName($langs),
|
$fuser->getFullName($langs),
|
||||||
'user'
|
'user'
|
||||||
);
|
);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
$this->error=$this->db->lasterror();
|
||||||
dol_syslog(get_class($this).'::addPaymentToBank '.$this->error);
|
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');
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToDebit")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$paymentid = 0;
|
$paymentid = 0;
|
||||||
@ -176,7 +176,7 @@ if (GETPOST("action") == 'create')
|
|||||||
print '<input type="hidden" name="id" value="'.$chid.'">';
|
print '<input type="hidden" name="id" value="'.$chid.'">';
|
||||||
print '<input type="hidden" name="chid" value="'.$chid.'">';
|
print '<input type="hidden" name="chid" value="'.$chid.'">';
|
||||||
print '<input type="hidden" name="action" value="add_payment">';
|
print '<input type="hidden" name="action" value="add_payment">';
|
||||||
|
|
||||||
dol_fiche_head();
|
dol_fiche_head();
|
||||||
|
|
||||||
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
|
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
|
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '',1); // Show open bank account list
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number
|
// Number
|
||||||
print '<tr><td>'.$langs->trans('Numero');
|
print '<tr><td>'.$langs->trans('Numero');
|
||||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user