Perf: Reduce nb of requests
This commit is contained in:
parent
fbfff99b80
commit
0370e06c84
@ -287,10 +287,11 @@ class Paiement extends CommonObject
|
|||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$accline = new AccountLine($this->db);
|
||||||
|
|
||||||
// Delete bank urls. If payment is on a conciliated line, return error.
|
// Delete bank urls. If payment is on a conciliated line, return error.
|
||||||
if ($bank_line_id)
|
if ($bank_line_id)
|
||||||
{
|
{
|
||||||
$accline = new AccountLine($this->db);
|
|
||||||
$result=$accline->fetch($bank_line_id);
|
$result=$accline->fetch($bank_line_id);
|
||||||
if ($result == 0) $accline->rowid=$bank_line_id; // If not found, we set artificially rowid to allow delete of llx_bank_url
|
if ($result == 0) $accline->rowid=$bank_line_id; // If not found, we set artificially rowid to allow delete of llx_bank_url
|
||||||
|
|
||||||
@ -306,11 +307,13 @@ class Paiement extends CommonObject
|
|||||||
// Delete payment (into paiement_facture and paiement)
|
// Delete payment (into paiement_facture and paiement)
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiement_facture';
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiement_facture';
|
||||||
$sql.= ' WHERE fk_paiement = '.$this->id;
|
$sql.= ' WHERE fk_paiement = '.$this->id;
|
||||||
|
dol_syslog($sql);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiement';
|
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'paiement';
|
||||||
$sql.= ' WHERE rowid = '.$this->id;
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
|
dol_syslog($sql);
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
@ -322,9 +325,7 @@ class Paiement extends CommonObject
|
|||||||
// Supprimer l'ecriture bancaire si paiement lie a ecriture
|
// Supprimer l'ecriture bancaire si paiement lie a ecriture
|
||||||
if ($bank_line_id)
|
if ($bank_line_id)
|
||||||
{
|
{
|
||||||
$accline = new AccountLine($this->db);
|
$result=$accline->delete($user);
|
||||||
$accline->fetch($bank_line_id);
|
|
||||||
$result=$accline->delete();
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error=$accline->error;
|
$this->error=$accline->error;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user