Merge pull request #20173 from thomas-Ngr/develop_new_SEPA_PmtTpInf_CdtTrfTxInf
NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level
This commit is contained in:
commit
7d6cbe0800
@ -124,6 +124,7 @@ if (empty($reshook)) {
|
||||
$object->bic = trim(GETPOST("bic"));
|
||||
$object->iban = trim(GETPOST("iban"));
|
||||
$object->domiciliation = trim(GETPOST("domiciliation", "nohtml"));
|
||||
$object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1;
|
||||
|
||||
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
|
||||
$object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
|
||||
@ -224,6 +225,7 @@ if (empty($reshook)) {
|
||||
$object->bic = trim(GETPOST("bic"));
|
||||
$object->iban = trim(GETPOST("iban"));
|
||||
$object->domiciliation = trim(GETPOST("domiciliation", "nohtml"));
|
||||
$object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1;
|
||||
|
||||
$object->proprio = trim(GETPOST("proprio", 'alphanohtml'));
|
||||
$object->owner_address = trim(GETPOST("owner_address", 'nohtml'));
|
||||
@ -537,6 +539,13 @@ if ($action == 'create') {
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td><input maxlength="11" type="text" class="flat minwidth150" name="bic" value="'.(GETPOST('bic') ?GETPOST('bic', 'alpha') : $object->bic).'"></td></tr>';
|
||||
|
||||
if ($conf->paymentbybanktransfer->enabled) {
|
||||
print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td>';
|
||||
print '<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. (empty(GETPOST('pti_in_ctti')) ? '' : ' checked ') . '> ';
|
||||
print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="domiciliation" rows="'.ROWS_2.'">';
|
||||
print (GETPOST('domiciliation') ?GETPOST('domiciliation') : $object->domiciliation);
|
||||
@ -777,6 +786,11 @@ if ($action == 'create') {
|
||||
print '<tr><td>'.$langs->trans("ICS").' ('.$langs->trans("BankTransfer").')</td>';
|
||||
print '<td>'.$object->ics_transfer.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td><td>';
|
||||
print (empty($object->pti_in_ctti) ? $langs->trans("No") : $langs->trans("Yes")) . ' ';
|
||||
print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
||||
@ -1074,6 +1088,11 @@ if ($action == 'create') {
|
||||
if ($conf->paymentbybanktransfer->enabled) {
|
||||
print '<tr><td>'.$langs->trans("ICS").' ('.$langs->trans("BankTransfer").')</td>';
|
||||
print '<td><input class="minwidth150 maxwidth200onsmartphone" maxlength="32" type="text" class="flat" name="ics_transfer" value="'.(GETPOSTISSET('ics_transfer') ? GETPOST('ics_transfer', 'alphanohtml') : $object->ics_transfer).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation").'</td>';
|
||||
print '<td><input type="checkbox" class="flat minwidth150" name="pti_in_ctti"'. ($object->pti_in_ctti ? ' checked ' : '') . '> ';
|
||||
print img_picto($langs->trans("SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp"), 'info');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("BankAccountDomiciliation").'</td><td>';
|
||||
|
||||
@ -145,6 +145,12 @@ class Account extends CommonObject
|
||||
*/
|
||||
public $iban_prefix;
|
||||
|
||||
/**
|
||||
* XML SEPA format: place Payment Type Information (PmtTpInf) in Credit Transfer Transaction Information (CdtTrfTxInf)
|
||||
* @var int
|
||||
*/
|
||||
public $pti_in_ctti = 0;
|
||||
|
||||
/**
|
||||
* Name of account holder
|
||||
* @var string
|
||||
@ -680,6 +686,7 @@ class Account extends CommonObject
|
||||
$sql .= ", bic";
|
||||
$sql .= ", iban_prefix";
|
||||
$sql .= ", domiciliation";
|
||||
$sql .= ", pti_in_ctti";
|
||||
$sql .= ", proprio";
|
||||
$sql .= ", owner_address";
|
||||
$sql .= ", currency_code";
|
||||
@ -706,6 +713,7 @@ class Account extends CommonObject
|
||||
$sql .= ", '".$this->db->escape($this->bic)."'";
|
||||
$sql .= ", '".$this->db->escape($this->iban)."'";
|
||||
$sql .= ", '".$this->db->escape($this->domiciliation)."'";
|
||||
$sql .= ", ".((int) $this->pti_in_ctti);
|
||||
$sql .= ", '".$this->db->escape($this->proprio)."'";
|
||||
$sql .= ", '".$this->db->escape($this->owner_address)."'";
|
||||
$sql .= ", '".$this->db->escape($this->currency_code)."'";
|
||||
@ -828,6 +836,7 @@ class Account extends CommonObject
|
||||
$sql .= ",bic='".$this->db->escape($this->bic)."'";
|
||||
$sql .= ",iban_prefix = '".$this->db->escape($this->iban)."'";
|
||||
$sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'";
|
||||
$sql .= ",pti_in_ctti=".((int) $this->pti_in_ctti);
|
||||
$sql .= ",proprio = '".$this->db->escape($this->proprio)."'";
|
||||
$sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'";
|
||||
|
||||
@ -949,7 +958,7 @@ class Account extends CommonObject
|
||||
|
||||
$sql = "SELECT ba.rowid, ba.ref, ba.label, ba.bank, ba.number, ba.courant, ba.clos, ba.rappro, ba.url,";
|
||||
$sql .= " ba.code_banque, ba.code_guichet, ba.cle_rib, ba.bic, ba.iban_prefix as iban,";
|
||||
$sql .= " ba.domiciliation, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,";
|
||||
$sql .= " ba.domiciliation, ba.pti_in_ctti, ba.proprio, ba.owner_address, ba.state_id, ba.fk_pays as country_id,";
|
||||
$sql .= " ba.account_number, ba.fk_accountancy_journal, ba.currency_code,";
|
||||
$sql .= " ba.min_allowed, ba.min_desired, ba.comment,";
|
||||
$sql .= " ba.datec as date_creation, ba.tms as date_update, ba.ics, ba.ics_transfer,";
|
||||
@ -992,6 +1001,7 @@ class Account extends CommonObject
|
||||
$this->bic = $obj->bic;
|
||||
$this->iban = $obj->iban;
|
||||
$this->domiciliation = $obj->domiciliation;
|
||||
$this->pti_in_ctti = $obj->pti_in_ctti;
|
||||
$this->proprio = $obj->proprio;
|
||||
$this->owner_address = $obj->owner_address;
|
||||
|
||||
|
||||
@ -64,6 +64,7 @@ class BonPrelevement extends CommonObject
|
||||
public $emetteur_numero_compte;
|
||||
public $emetteur_code_banque;
|
||||
public $emetteur_number_key;
|
||||
public $sepa_xml_pti_in_ctti;
|
||||
|
||||
public $emetteur_iban;
|
||||
public $emetteur_bic;
|
||||
@ -107,6 +108,7 @@ class BonPrelevement extends CommonObject
|
||||
$this->emetteur_numero_compte = "";
|
||||
$this->emetteur_code_banque = "";
|
||||
$this->emetteur_number_key = "";
|
||||
$this->sepa_xml_pti_in_ctti = false;
|
||||
|
||||
$this->emetteur_iban = "";
|
||||
$this->emetteur_bic = "";
|
||||
@ -1038,10 +1040,11 @@ class BonPrelevement extends CommonObject
|
||||
}
|
||||
$account = new Account($this->db);
|
||||
if ($account->fetch($id) > 0) {
|
||||
$this->emetteur_code_banque = $account->code_banque;
|
||||
$this->emetteur_code_banque = $account->code_banque;
|
||||
$this->emetteur_code_guichet = $account->code_guichet;
|
||||
$this->emetteur_numero_compte = $account->number;
|
||||
$this->emetteur_number_key = $account->cle_rib;
|
||||
$this->emetteur_number_key = $account->cle_rib;
|
||||
$this->sepa_xml_pti_in_ctti = (bool) $account->pti_in_ctti;
|
||||
$this->emetteur_iban = $account->iban;
|
||||
$this->emetteur_bic = $account->bic;
|
||||
|
||||
@ -1881,6 +1884,24 @@ class BonPrelevement extends CommonObject
|
||||
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
|
||||
$XML_CREDITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_CREDITOR .= ' </PmtId>'.$CrLf;
|
||||
if ($this->sepa_xml_pti_in_ctti) {
|
||||
$XML_CREDITOR .= ' <PmtTpInf>' . $CrLf;
|
||||
|
||||
// Can be 'NORM' for normal or 'HIGH' for high priority level
|
||||
if (!empty($conf->global->PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY)) {
|
||||
$instrprty = 'HIGH';
|
||||
} else {
|
||||
$instrprty = 'NORM';
|
||||
}
|
||||
$XML_CREDITOR .= ' <InstrPrty>'.$instrprty.'</InstrPrty>' . $CrLf;
|
||||
$XML_CREDITOR .= ' <SvcLvl>' . $CrLf;
|
||||
$XML_CREDITOR .= ' <Cd>SEPA</Cd>' . $CrLf;
|
||||
$XML_CREDITOR .= ' </SvcLvl>' . $CrLf;
|
||||
$XML_CREDITOR .= ' <CtgyPurp>' . $CrLf;
|
||||
$XML_CREDITOR .= ' <Cd>CORE</Cd>' . $CrLf;
|
||||
$XML_CREDITOR .= ' </CtgyPurp>' . $CrLf;
|
||||
$XML_CREDITOR .= ' </PmtTpInf>' . $CrLf;
|
||||
}
|
||||
$XML_CREDITOR .= ' <Amt>'.$CrLf;
|
||||
$XML_CREDITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
$XML_CREDITOR .= ' </Amt>'.$CrLf;
|
||||
@ -2031,6 +2052,7 @@ class BonPrelevement extends CommonObject
|
||||
$this->emetteur_code_guichet = $account->code_guichet;
|
||||
$this->emetteur_numero_compte = $account->number;
|
||||
$this->emetteur_number_key = $account->cle_rib;
|
||||
$this->sepa_xml_pti_in_ctti = (bool) $account->pti_in_ctti;
|
||||
$this->emetteur_iban = $account->iban;
|
||||
$this->emetteur_bic = $account->bic;
|
||||
|
||||
@ -2125,17 +2147,17 @@ class BonPrelevement extends CommonObject
|
||||
//$XML_SEPA_INFO .= ' <BtchBookg>False</BtchBookg>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
|
||||
/*
|
||||
$XML_SEPA_INFO .= ' <PmtTpInf>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <SvcLvl>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Cd>SEPA</Cd>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </SvcLvl>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <LclInstrm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Cd>TRF</Cd>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </LclInstrm>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <CtgyPurp><Cd>SECU</Cd></CtgyPurp>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf;
|
||||
*/
|
||||
if (!$this->sepa_xml_pti_in_ctti) {
|
||||
$XML_SEPA_INFO .= ' <PmtTpInf>' . $CrLf;
|
||||
$XML_SEPA_INFO .= ' <SvcLvl>' . $CrLf;
|
||||
$XML_SEPA_INFO .= ' <Cd>SEPA</Cd>' . $CrLf;
|
||||
$XML_SEPA_INFO .= ' </SvcLvl>' . $CrLf;
|
||||
$XML_SEPA_INFO .= ' <LclInstrm>' . $CrLf;
|
||||
$XML_SEPA_INFO .= ' <Cd>CORE</Cd>' . $CrLf;
|
||||
$XML_SEPA_INFO .= ' </LclInstrm>' . $CrLf;
|
||||
$XML_SEPA_INFO .= ' <SeqTp>' . $format . '</SeqTp>' . $CrLf;
|
||||
$XML_SEPA_INFO .= ' </PmtTpInf>' . $CrLf;
|
||||
}
|
||||
$XML_SEPA_INFO .= ' <ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Dbtr>'.$CrLf;
|
||||
$XML_SEPA_INFO .= ' <Nm>'.dolEscapeXML(strtoupper(dol_string_unaccent($this->raison_sociale))).'</Nm>'.$CrLf;
|
||||
|
||||
@ -245,3 +245,5 @@ create table llx_inventory_extrafields
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
ALTER TABLE llx_inventory_extrafields ADD INDEX idx_inventory_extrafields (fk_object);
|
||||
|
||||
ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER domiciliation;
|
||||
|
||||
@ -42,6 +42,7 @@ create table llx_bank_account
|
||||
country_iban varchar(2), -- deprecated
|
||||
cle_iban varchar(2),
|
||||
domiciliation varchar(255),
|
||||
pti_in_ctti smallint DEFAULT 0,
|
||||
state_id integer DEFAULT NULL,
|
||||
fk_pays integer NOT NULL,
|
||||
proprio varchar(60),
|
||||
|
||||
@ -182,3 +182,5 @@ IfYouDontReconcileDisableProperty=If you don't make the bank reconciliations on
|
||||
NoBankAccountDefined=No bank account defined
|
||||
NoRecordFoundIBankcAccount=No record found in bank account. Commonly, this occurs when a record has been deleted manually from the list of transaction in the bank account (for example during a reconciliation of the bank account). Another reason is that the payment was recorded when the module "%s" was disabled.
|
||||
AlreadyOneBankAccount=Already one bank account defined
|
||||
SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformation=SEPA transfer: 'Payment Type' at 'Credit Transfer' level
|
||||
SEPAXMLPlacePaymentTypeInformationInCreditTransfertransactionInformationHelp=SEPA XML: PaymentTypeInformation is mandatory and can now be placed at CreditTransferTransactionInformation level (instead of Payment level). We strongly recommend to place PaymentTypeInformation at Payment level, as all banks will not necessarily accept it at CreditTransferTransactionInformation level. Contact your bank before placing PaymentTypeInformation at CreditTransferTransactionInformation level.
|
||||
Loading…
Reference in New Issue
Block a user