Close #15870 manually

This commit is contained in:
Laurent Destailleur 2021-01-05 02:18:42 +01:00
parent 8afe9b3aa5
commit 64b4f1079d
2 changed files with 20 additions and 12 deletions

View File

@ -493,9 +493,10 @@ class Account extends CommonObject
* @param string $banque Bank of cheque writer * @param string $banque Bank of cheque writer
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on. * @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
* @param int $datev Date value * @param int $datev Date value
* @param string $num_releve Label of bank receipt for reconciliation
* @return int Rowid of added entry, <0 if KO * @return int Rowid of added entry, <0 if KO
*/ */
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null) public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '')
{ {
// Deprecation warning // Deprecation warning
if (is_numeric($oper)) { if (is_numeric($oper)) {
@ -555,6 +556,7 @@ class Account extends CommonObject
$accline->fk_account = $this->rowid; $accline->fk_account = $this->rowid;
$accline->fk_type = $oper; $accline->fk_type = $oper;
$accline->numero_compte = $accountancycode; $accline->numero_compte = $accountancycode;
$accline->num_releve = $num_releve;
if ($num_chq) { if ($num_chq) {
$accline->num_chq = $num_chq; $accline->num_chq = $num_chq;
@ -1886,6 +1888,7 @@ class AccountLine extends CommonObject
$sql .= ", emetteur,banque"; $sql .= ", emetteur,banque";
$sql .= ", rappro"; $sql .= ", rappro";
$sql .= ", numero_compte"; $sql .= ", numero_compte";
$sql .= ", num_releve";
$sql .= ") VALUES ("; $sql .= ") VALUES (";
$sql .= "'".$this->db->idate($this->datec)."'"; $sql .= "'".$this->db->idate($this->datec)."'";
$sql .= ", '".$this->db->idate($this->dateo)."'"; $sql .= ", '".$this->db->idate($this->dateo)."'";
@ -1900,6 +1903,7 @@ class AccountLine extends CommonObject
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null"); $sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
$sql .= ", ".(int) $this->rappro; $sql .= ", ".(int) $this->rappro;
$sql .= ", ".($this->numero_compte ? "'".$this->db->escape($this->numero_compte)."'" : "''"); $sql .= ", ".($this->numero_compte ? "'".$this->db->escape($this->numero_compte)."'" : "''");
$sql .= ", ".($this->num_releve ? "'".$this->db->escape($this->num_releve)."'" : "null");
$sql .= ")"; $sql .= ")";
dol_syslog(get_class($this)."::insert", LOG_DEBUG); dol_syslog(get_class($this)."::insert", LOG_DEBUG);

View File

@ -466,20 +466,23 @@ class BankAccounts extends DolibarrApi
/** /**
* Add a line to an account * Add a line to an account
* *
* @param int $id ID of account * @param int $id ID of account
* @param int $date Payment date (timestamp) {@from body} {@type timestamp} * @param int $date Payment date (timestamp) {@from body} {@type timestamp}
* @param string $type Payment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body} * @param string $type Payment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body}
* @param string $label Label {@from body} * @param string $label Label {@from body}
* @param float $amount Amount (may be 0) {@from body} * @param float $amount Amount (may be 0) {@from body}
* @param int $category Category * @param int $category Category
* @param string $cheque_number Cheque numberl {@from body} * @param string $cheque_number Cheque numero {@from body}
* @param string $cheque_writer Name of cheque writer {@from body} * @param string $cheque_writer Name of cheque writer {@from body}
* @param string $cheque_bank Bank of cheque writer {@from body} * @param string $cheque_bank Bank of cheque writer {@from body}
* @param string $accountancycode Accountancy code {@from body}
* @param int $datev Payment date value (timestamp) {@from body} {@type timestamp}
* @param string $num_releve Bank statement numero {@from body}
* @return int ID of line * @return int ID of line
* *
* @url POST {id}/lines * @url POST {id}/lines
*/ */
public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '') public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '', $accountancycode = '', $datev = null, $num_releve = '')
{ {
if (!DolibarrApiAccess::$user->rights->banque->modifier) { if (!DolibarrApiAccess::$user->rights->banque->modifier) {
throw new RestException(401); throw new RestException(401);
@ -499,7 +502,8 @@ class BankAccounts extends DolibarrApi
$cheque_number, $cheque_number,
$category, $category,
DolibarrApiAccess::$user, DolibarrApiAccess::$user,
$cheque_writer, $cheque_bank $cheque_writer, $cheque_bank, $accountancycode,
$datev, $num_releve
); );
if ($result < 0) { if ($result < 0) {
throw new RestException(503, 'Error when adding line to account: '.$account->error); throw new RestException(503, 'Error when adding line to account: '.$account->error);