Skip to content

Commit

Permalink
Debug v21
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Nov 10, 2024
1 parent c7d0482 commit 46974bd
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions htdocs/compta/prelevement/class/bonprelevement.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1101,23 +1101,26 @@ public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL'

$sqlTable = $type != 'bank-transfer' ? "facture" : "facture_fourn";

// Check if there is an iban associated to bank transfer or if we take the default
$sql = "SELECT fk_societe_rib";
$sql .= " FROM " . $this->db->prefix() . "prelevement_demande as pd";
$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->escape($sqlTable) . " as f ON f.rowid = pd.fk_".$this->db->escape($sqlTable);
$sql .= " WHERE f.entity IN (" . $this->db->escape($entity) . ')';
$thirdpartyBANId = 0;

$resql = $this->db->query($sql);
// Check if there is an iban associated to the bank transfer request or if we take the default
if ($did > 0) {
$sql = "SELECT pd.fk_societe_rib";
$sql .= " FROM " . $this->db->prefix() . "prelevement_demande as pd";
$sql .= " WHERE pd.rowid = ".((int) $did);

$resql = $this->db->query($sql);

if (!$resql) {
$this->error = $this->db->lasterror();
dol_syslog(__METHOD__ . " Read fk_societe_rib error " . $this->db->lasterror(), LOG_ERR);
return -1;
}

if (!$resql) {
$this->error = $this->db->lasterror();
dol_syslog(__METHOD__ . " Read fk_societe_rib error " . $this->db->lasterror(), LOG_ERR);
return -1;
}
$thirdpartyBANId = 0;
if ($resql->num_rows) {
$obj = $this->db->fetch_object($resql);
$thirdpartyBANId = $obj->fk_societe_rib;
if ($obj) {
$thirdpartyBANId = $obj->fk_societe_rib;
}
$this->db->free($resql);
}

Expand Down

0 comments on commit 46974bd

Please sign in to comment.