Fix error message

This commit is contained in:
Laurent Destailleur 2018-01-18 17:51:39 +01:00
parent 3871c694f6
commit 1730feeb4f
3 changed files with 17 additions and 10 deletions

View File

@ -849,15 +849,22 @@ class BonPrelevement extends CommonObject
foreach ($factures as $key => $fac)
{
$fact = new Facture($this->db);
if ($fact->fetch($fac[0]) >= 0) // Field 0 of $fac is rowid of invoice
$resfetch = $fact->fetch($fac[0]);
if ($resfetch >= 0) // Field 0 of $fac is rowid of invoice
{
if ($soc->fetch($fact->socid) >= 0)
{
$bac = new CompanyBankAccount($this->db);
$bac->fetch(0, $soc->id);
if ($format == 'FRST' && $bac->frstrecur != 'FRST') continue;
if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR')) continue;
if ($format == 'FRST' && $bac->frstrecur != 'FRST')
{
continue;
}
if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR'))
{
continue;
}
if ($bac->verif() >= 1)
{
@ -865,28 +872,29 @@ class BonPrelevement extends CommonObject
/* second tableau necessaire pour BonPrelevement */
$factures_prev_id[$i] = $fac[0];
$i++;
//dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG);
}
else
{
dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING);
$this->invoice_in_error[$fac[0]]="Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
$this->thirdparty_in_error[$soc->id]="Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0);
}
}
else
{
dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_ERR);
dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_WARNING);
}
}
else
{
dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_ERR);
dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_WARNING);
}
}
}
else
{
dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_ERR);
dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_WARNING);
}
}

View File

@ -72,8 +72,7 @@ if ($action == 'create')
}
elseif ($result == 0)
{
$mesg='';
$mesg=$langs->trans("NoInvoiceCouldBeWithdrawed");
$mesg=$langs->trans("NoInvoiceCouldBeWithdrawed", $format);
setEventMessages($mesg, null, 'errors');
$mesg.='<br>'."\n";
foreach($bprev->invoice_in_error as $key => $val)

View File

@ -26,7 +26,7 @@ LastWithdrawalReceipt=Latest %s direct debit receipts
MakeWithdrawRequest=Make a direct debit payment request
WithdrawRequestsDone=%s direct debit payment requests recorded
ThirdPartyBankCode=Third party bank code
NoInvoiceCouldBeWithdrawed=No invoice withdrawed with success. Check that invoice are on companies with a valid BAN.
NoInvoiceCouldBeWithdrawed=No invoice withdrawed with success. Check that invoices are on companies with a valid default BAN and that BAN has a RUM with mode <strong>%s</strong>.
ClassCredited=Classify credited
ClassCreditedConfirm=Are you sure you want to classify this withdrawal receipt as credited on your bank account?
TransData=Transmission date