fix phpcs

This commit is contained in:
Frédéric FRANCE 2020-10-23 08:12:19 +02:00 committed by GitHub
parent 81543df5e4
commit 0f1996759f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,6 +47,7 @@ class RejetPrelevement
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
* @param User $user Objet user * @param User $user Objet user
* @param string $type type
*/ */
public function __construct($db, $user, $type) public function __construct($db, $user, $type)
{ {
@ -137,13 +138,11 @@ class RejetPrelevement
} }
$num = count($facs); $num = count($facs);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++) {
{
if ($this->type == 'bank-transfer') { if ($this->type == 'bank-transfer') {
$fac = new FactureFournisseur($this->db); $fac = new FactureFournisseur($this->db);
$pai = new PaiementFourn($this->db); $pai = new PaiementFourn($this->db);
} } else {
else{
$fac = new Facture($this->db); $fac = new Facture($this->db);
$pai = new Paiement($this->db); $pai = new Paiement($this->db);
} }
@ -165,21 +164,19 @@ class RejetPrelevement
$pai->paiementid = 3; // type of payment: withdrawal $pai->paiementid = 3; // type of payment: withdrawal
$pai->num_payment = $fac->ref; $pai->num_payment = $fac->ref;
if ($pai->create($this->user) < 0) // we call with no_commit if ($pai->create($this->user) < 0) {
{ // we call with no_commit
$error++; $error++;
dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]); dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]);
} else { } else {
$result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', ''); $result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', '');
if ($result < 0) if ($result < 0) {
{
dol_syslog("RejetPrelevement::Create AddPaymentToBan Error"); dol_syslog("RejetPrelevement::Create AddPaymentToBan Error");
$error++; $error++;
} }
// Payment validation // Payment validation
if ($pai->validate($user) < 0) if ($pai->validate($user) < 0) {
{
$error++; $error++;
dol_syslog("RejetPrelevement::Create Error payment validation"); dol_syslog("RejetPrelevement::Create Error payment validation");
} }
@ -265,8 +262,7 @@ class RejetPrelevement
$mailfile = new CMailFile($subject, $sendto, $from, $message, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $this->user->email, '', $trackid); $mailfile = new CMailFile($subject, $sendto, $from, $message, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $this->user->email, '', $trackid);
$result = $mailfile->sendfile(); $result = $mailfile->sendfile();
if ($result) if ($result) {
{
dol_syslog("RejetPrelevement::_send_email email envoye"); dol_syslog("RejetPrelevement::_send_email email envoye");
} else { } else {
dol_syslog("RejetPrelevement::_send_email Erreur envoi email"); dol_syslog("RejetPrelevement::_send_email Erreur envoi email");
@ -293,8 +289,11 @@ class RejetPrelevement
$sql = "SELECT f.rowid as facid, pl.amount"; $sql = "SELECT f.rowid as facid, pl.amount";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf";
//$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)"; //$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)";
if ($this->type == 'bank-transfer') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON (pf.fk_facture_fourn = f.rowid)"; if ($this->type == 'bank-transfer') {
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON (pf.fk_facture_fourn = f.rowid)";
} else {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON (pf.fk_facture = f.rowid)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_lignes as pl ON (pf.fk_prelevement_lignes = pl.rowid)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_lignes as pl ON (pf.fk_prelevement_lignes = pl.rowid)";
$sql .= " WHERE pf.fk_prelevement_lignes = ".$this->id; $sql .= " WHERE pf.fk_prelevement_lignes = ".$this->id;
@ -311,8 +310,9 @@ class RejetPrelevement
while ($i < $num) while ($i < $num)
{ {
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
if (!$amounts) $arr[$i] = $row[0]; if (!$amounts) {
else { $arr[$i] = $row[0];
} else {
$arr[$i] = array( $arr[$i] = array(
$row[0], $row[0],
$row[1] $row[1]