Fix use ref instead of empty field in unstructured data sepa field

This commit is contained in:
Laurent Destailleur 2023-04-26 17:40:36 +02:00
parent fcb139cbd5
commit f99da75a9f
3 changed files with 11 additions and 11 deletions

View File

@ -188,7 +188,7 @@ print '</td></tr>';
//USTRD
print '<tr class="oddeven"><td>'.$langs->trans("USTRD").'</td>';
print '<td>';
print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->PRELEVEMENT_USTRD.'" class="width100"></td>';
print '<input type="text" name="CREDITTRANSFER_USTRD" value="'.$conf->global->CREDITTRANSFER_USTRD.'" class="width100"></td>';
print '</td></tr>';
*/

View File

@ -868,7 +868,7 @@ class BonPrelevement extends CommonObject
$error = 0;
$datetimeprev = dol_now('gmt');
//Choice the date of the execution direct debit
// Choice the date of the execution direct debit
if (!empty($executiondate)) {
$datetimeprev = $executiondate;
}
@ -1539,7 +1539,7 @@ class BonPrelevement extends CommonObject
$sql = "SELECT soc.rowid as socid, soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql .= " f.ref as fac, pf.fk_facture as idfac,";
$sql .= " f.ref as reffac, pf.fk_facture as idfac,";
$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
$sql .= " FROM";
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
@ -1575,7 +1575,7 @@ class BonPrelevement extends CommonObject
$cachearraytotestduplicate[$obj->idfac] = $obj->rowid;
$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->reffac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type);
$this->total = $this->total + $obj->somme;
$i++;
}
@ -1655,7 +1655,7 @@ class BonPrelevement extends CommonObject
$sql = "SELECT soc.rowid as socid, soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql .= " f.ref as fac, pf.fk_facture_fourn as idfac, f.ref_supplier as fac_ref_supplier,";
$sql .= " f.ref as reffac, pf.fk_facture_fourn as idfac, f.ref_supplier as fac_ref_supplier,";
$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
$sql .= " FROM";
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
@ -1691,7 +1691,7 @@ class BonPrelevement extends CommonObject
$cachearraytotestduplicate[$obj->idfac] = $obj->rowid;
$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac_ref_supplier, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type);
$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->reffac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type);
$this->total = $this->total + $obj->somme;
$i++;
}
@ -1922,7 +1922,7 @@ class BonPrelevement extends CommonObject
* @param string $row_cg pl.code_guichet AS cg, Not used for SEPA
* @param string $row_cc pl.number AS cc, Not used for SEPA
* @param string $row_somme pl.amount AS somme,
* @param string $row_ref f.ref
* @param string $row_ref Invoice ref (f.ref)
* @param string $row_idfac pf.fk_facture AS idfac,
* @param string $row_iban rib.iban_prefix AS iban,
* @param string $row_bic rib.bic AS bic,
@ -1992,7 +1992,7 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR .= ' </DbtrAcct>'.$CrLf;
$XML_DEBITOR .= ' <RmtInf>'.$CrLf;
// A string with some information on payment - 140 max
$XML_DEBITOR .= ' <Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135, 'right', 'UTF-8', 1)).'</Ustrd>'.$CrLf; // 140 max
$XML_DEBITOR .= ' <Ustrd>'.getDolGlobalString('PRELEVEMENT_USTRD', dol_trunc($row_ref, 135, 'right', 'UTF-8', 1)).'</Ustrd>'.$CrLf; // Free unstuctured data - 140 max
$XML_DEBITOR .= ' </RmtInf>'.$CrLf;
$XML_DEBITOR .= ' </DrctDbtTxInf>'.$CrLf;
return $XML_DEBITOR;
@ -2061,7 +2061,7 @@ class BonPrelevement extends CommonObject
$XML_CREDITOR .= ' </CdtrAcct>'.$CrLf;
$XML_CREDITOR .= ' <RmtInf>'.$CrLf;
// A string with some information on payment - 140 max
$XML_CREDITOR .= ' <Ustrd>'.(($conf->global->PRELEVEMENT_USTRD != "") ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135, 'right', 'UTF-8', 1)).'</Ustrd>'.$CrLf; // 140 max
$XML_CREDITOR .= ' <Ustrd>'.getDolGlobalString('CREDITTRANSFER_USTRD', dol_trunc($row_ref, 135, 'right', 'UTF-8', 1)).'</Ustrd>'.$CrLf; // Free unstructured data - 140 max
$XML_CREDITOR .= ' </RmtInf>'.$CrLf;
$XML_CREDITOR .= ' </CdtTrfTxInf>'.$CrLf;
return $XML_CREDITOR;

View File

@ -96,7 +96,7 @@ if (empty($reshook)) {
// Change customer bank information to withdraw
if ($action == 'modify') {
for ($i = 1; $i < 9; $i++) {
dolibarr_set_const($db, GETPOST("nom$i"), GETPOST("value$i"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, GETPOST("nom".$i), GETPOST("value".$i), 'chaine', 0, '', $conf->entity);
}
}
if ($action == 'create') {
@ -104,7 +104,7 @@ if (empty($reshook)) {
//var_dump($default_account);var_dump($conf->global->$default_account);var_dump($id_bankaccount);exit;
if ($id_bankaccount != $conf->global->$default_account) {
if ($id_bankaccount != getDolGlobalInt($default_account)) {
$res = dolibarr_set_const($db, $default_account, $id_bankaccount, 'chaine', 0, '', $conf->entity); // Set as default
}