From 0f1996759f2a90f53ccdd760059262e457120141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 23 Oct 2020 08:12:19 +0200 Subject: [PATCH] fix phpcs --- .../class/rejetprelevement.class.php | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index fce3096c41f..f1a396f131f 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -47,6 +47,7 @@ class RejetPrelevement * * @param DoliDb $db Database handler * @param User $user Objet user + * @param string $type type */ public function __construct($db, $user, $type) { @@ -137,13 +138,11 @@ class RejetPrelevement } $num = count($facs); - for ($i = 0; $i < $num; $i++) - { - if($this->type == 'bank-transfer'){ + for ($i = 0; $i < $num; $i++) { + if ($this->type == 'bank-transfer') { $fac = new FactureFournisseur($this->db); $pai = new PaiementFourn($this->db); - } - else{ + } else { $fac = new Facture($this->db); $pai = new Paiement($this->db); } @@ -165,21 +164,19 @@ class RejetPrelevement $pai->paiementid = 3; // type of payment: withdrawal $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++; dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]); } else { $result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', ''); - if ($result < 0) - { + if ($result < 0) { dol_syslog("RejetPrelevement::Create AddPaymentToBan Error"); $error++; } // Payment validation - if ($pai->validate($user) < 0) - { + if ($pai->validate($user) < 0) { $error++; 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); $result = $mailfile->sendfile(); - if ($result) - { + if ($result) { dol_syslog("RejetPrelevement::_send_email email envoye"); } else { dol_syslog("RejetPrelevement::_send_email Erreur envoi email"); @@ -293,8 +289,11 @@ class RejetPrelevement $sql = "SELECT f.rowid as facid, pl.amount"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf"; //$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)"; - else $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)"; + } 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 .= " WHERE pf.fk_prelevement_lignes = ".$this->id; @@ -311,8 +310,9 @@ class RejetPrelevement while ($i < $num) { $row = $this->db->fetch_row($resql); - if (!$amounts) $arr[$i] = $row[0]; - else { + if (!$amounts) { + $arr[$i] = $row[0]; + } else { $arr[$i] = array( $row[0], $row[1] @@ -349,9 +349,9 @@ class RejetPrelevement { $obj = $this->db->fetch_object($resql); - $this->id = $rowid; - $this->date_rejet = $this->db->jdate($obj->dr); - $this->motif = $this->motifs[$obj->motif]; + $this->id = $rowid; + $this->date_rejet = $this->db->jdate($obj->dr); + $this->motif = $this->motifs[$obj->motif]; $this->invoicing = $this->facturer[$obj->afacturer]; $this->db->free($resql);