From 6a5218b9b22c9a6b214dc0891433ec3b6fac28da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Tue, 10 Jan 2012 01:31:06 +0100 Subject: [PATCH] Qual: Ckeckstyle --- htdocs/compta/paiement.php | 7 +- .../class/bon-prelevement.class.php | 33 ++++------ .../class/ligne-prelevement.class.php | 29 ++++---- .../class/rejet-prelevement.class.php | 66 ++++++++++++------- htdocs/core/class/rssparser.class.php | 58 +++++++++------- 5 files changed, 107 insertions(+), 86 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 5d5604deb18..467448830a7 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -66,10 +66,7 @@ if ($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm=='ye { $error = 0; - $datepaye = dol_mktime(12, 0 , 0, - $_POST['remonth'], - $_POST['reday'], - $_POST['reyear']); + $datepaye = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $paiement_id = 0; // Verifie si des paiements sont superieurs au montant facture @@ -634,7 +631,7 @@ if (! GETPOST('action')) } $sql .= ' ORDER BY '.$sortfield.' '.$sortorder; - $sql .= $db->plimit($limit +1 ,$offset); + $sql .= $db->plimit($limit+1, $offset); $resql = $db->query($sql); if ($resql) diff --git a/htdocs/compta/prelevement/class/bon-prelevement.class.php b/htdocs/compta/prelevement/class/bon-prelevement.class.php index 356d2d597af..75fb2e0ac44 100644 --- a/htdocs/compta/prelevement/class/bon-prelevement.class.php +++ b/htdocs/compta/prelevement/class/bon-prelevement.class.php @@ -54,15 +54,15 @@ class BonPrelevement extends CommonObject /** * Constructor * - * @param DoliDB $DB Database handler + * @param DoliDB $db Database handler * @param string $filename Filename of withdraw receipt */ - function BonPrelevement($DB, $filename='') + function BonPrelevement($db, $filename='') { global $conf,$langs; $error = 0; - $this->db = $DB; + $this->db = $db; $this->filename=$filename; @@ -526,7 +526,7 @@ class BonPrelevement extends CommonObject global $conf,$langs; $error = 0; - + dol_syslog("bon-prelevement::set_infotrans Start",LOG_INFO); if ($this->db->begin()) { @@ -1209,14 +1209,14 @@ class BonPrelevement extends CommonObject $obj = $this->db->fetch_object($resql); $esaeb19->agregaRecibo( - $idOrdenante, + $idOrdenante, "idcliente".$i+1, - $obj->client_nom, - $obj->code_banque, - $obj->code_guichet, - $obj->cle_rib, - $obj->number, - $obj->amount, + $obj->client_nom, + $obj->code_banque, + $obj->code_guichet, + $obj->cle_rib, + $obj->number, + $obj->amount, "Fra.".$obj->facnumber." ".$obj->amount ); @@ -1303,16 +1303,7 @@ class BonPrelevement extends CommonObject { $row = $this->db->fetch_row($resql); - $this->EnregDestinataire( - $row[0], - $row[1], - $row[2], - $row[3], - $row[4], - $row[5], - $row[6], - $row[7] - ); + $this->EnregDestinataire($row[0],$row[1],$row[2],$row[3],$row[4],$row[5],$row[6],$row[7]); $this->total = $this->total + $row[5]; diff --git a/htdocs/compta/prelevement/class/ligne-prelevement.class.php b/htdocs/compta/prelevement/class/ligne-prelevement.class.php index e286e5a2fa2..b372d274f15 100644 --- a/htdocs/compta/prelevement/class/ligne-prelevement.class.php +++ b/htdocs/compta/prelevement/class/ligne-prelevement.class.php @@ -39,15 +39,16 @@ class LignePrelevement /** - * \brief Constructeur de la classe - * \param DB Handler acces base de donnees - * \param user Objet user + * Constructor + * + * @param DoliDb $db Database handler + * @param User $user Objet user */ - function LignePrelevement($DB, $user) + function LignePrelevement($db, $user) { global $conf,$langs; - $this->db = $DB ; + $this->db = $db; $this->user = $user; // List of language codes for status @@ -59,8 +60,10 @@ class LignePrelevement } /** - * \brief Recupere l'objet prelevement - * \param rowid id de la facture a recuperer + * Recupere l'objet prelevement + * + * @param int $rowid id de la facture a recuperer + * @return void */ function fetch($rowid) { @@ -110,8 +113,9 @@ class LignePrelevement /** * Return status label of object - * @param mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto - * @return string Label + * + * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto + * @return string Label */ function getLibStatut($mode=0) { @@ -120,9 +124,10 @@ class LignePrelevement /** * Return status label for a status - * @param statut id statut - * @param mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto - * @return string Label + * + * @param int $statut id statut + * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto + * @return string Label */ function LibStatut($statut,$mode=0) { diff --git a/htdocs/compta/prelevement/class/rejet-prelevement.class.php b/htdocs/compta/prelevement/class/rejet-prelevement.class.php index 46cfd1791d0..fcdb9dab703 100644 --- a/htdocs/compta/prelevement/class/rejet-prelevement.class.php +++ b/htdocs/compta/prelevement/class/rejet-prelevement.class.php @@ -36,20 +36,21 @@ class RejetPrelevement /** - * Class constructor - * @param DB Database Handler access - * @param user User + * Constructor + * + * @param DoliDb $db Database handler + * @param User $user Objet user */ - function RejetPrelevement($DB, $user) + function RejetPrelevement($db, $user) { global $langs; - - $this->db = $DB ; + + $this->db = $db; $this->user = $user; $this->motifs = array(); $this->facturer = array(); - + $this->motifs[0] = $langs->trans("StatusMotif0"); $this->motifs[1] = $langs->trans("StatusMotif1"); $this->motifs[2] = $langs->trans("StatusMotif2"); @@ -59,16 +60,27 @@ class RejetPrelevement $this->motifs[6] = $langs->trans("StatusMotif6"); $this->motifs[7] = $langs->trans("StatusMotif7"); $this->motifs[8] = $langs->trans("StatusMotif8"); - + $this->facturer[0]=$langs->trans("NoInvoiceRefused"); $this->facturer[1]=$langs->trans("InvoiceRefused"); - + } + /** + * Create + * + * @param User $user User object + * @param int $id Id + * @param string $motif Motif + * @param timestamp $date_rejet Date rejet + * @param int $bonid Bon id + * @param int $facturation Facturation + * @return void + */ function create($user, $id, $motif, $date_rejet, $bonid, $facturation=0) { global $langs,$conf; - + $error = 0; $this->id = $id; $this->bon_id = $bonid; @@ -115,7 +127,7 @@ class RejetPrelevement dol_syslog("RejetPrelevement::create Erreur 5"); $error++; } - + $num=count($facs); for ($i = 0; $i < $num; $i++) { @@ -126,12 +138,12 @@ class RejetPrelevement $pai = new Paiement($this->db); $pai->amounts = array(); - - /* + + /* * We replace the comma with a point otherwise some * PHP installs sends only the part integer negative */ - + $pai->amounts[$facs[$i]] = price2num($fac->total_ttc * -1); $pai->datepaye = $date_rejet; $pai->paiementid = 3; // type of payment: withdrawal @@ -150,14 +162,14 @@ class RejetPrelevement dol_syslog("RejetPrelevement::Create AddPaymentToBan Error"); $error++; } - + // Payment validation if ($pai->valide() < 0) { $error++; dol_syslog("RejetPrelevement::Create Error payment validation"); } - + } //Tag invoice as unpaid dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref); @@ -181,8 +193,10 @@ class RejetPrelevement } /** - * Envoi mail - * @param fac Invoice object + * Envoi mail + * + * @param Facture $fac Invoice object + * @return void */ function _send_email($fac) { @@ -232,12 +246,10 @@ class RejetPrelevement $socname = $soc->nom; $amount = price($fac->total_ttc); $userinfo = $this->user->getFullName($langs); - + $message = $langs->trans("InfoRejectMessage",$facref,$socname, $amount, $userinfo); - - $mailfile = new CMailFile($subject,$sendto,$from,$message, - $arr_file,$arr_mime,$arr_name, - '', '', 0, $msgishtml,$this->user->email); + + $mailfile = new CMailFile($subject,$sendto,$from,$message,$arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$this->user->email); $result=$mailfile->sendfile(); if ($result) @@ -257,13 +269,15 @@ class RejetPrelevement /** * Retrieve the list of invoices + * + * @return void */ function _get_list_factures() { global $conf; $arr = array(); - + //Returns all invoices of a withdrawal $sql = "SELECT f.rowid as facid"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_facture as pf"; @@ -300,7 +314,9 @@ class RejetPrelevement /** * Retrieve withdrawal object - * @param rowid id of invoice to retrieve + * + * @param int $rowid id of invoice to retrieve + * @return void */ function fetch($rowid) { diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index bf2a428ae96..de55ca6851c 100755 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -182,7 +182,7 @@ class RssParser } xml_set_object($xmlparser, $this); - xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element' ); + xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); xml_set_character_data_handler($xmlparser, 'feed_cdata'); $status = xml_parse($xmlparser, $str); xml_parser_free($xmlparser); @@ -371,9 +371,10 @@ class RssParser /** * Triggered when opened tag is found * - * @param $p - * @param $element Tag - * @param $attrs Attributes of tags + * @param string $p + * @param string $element Tag + * @param array &$attrs Attributes of tags + * @return void */ function feed_start_element($p, $element, &$attrs) { @@ -382,7 +383,7 @@ class RssParser // check for a namespace, and split if found $ns = false; - if ( strpos( $element, ':' ) ) { + if (strpos($element, ':' )) { list($ns, $el) = explode(':', $element, 2); } if ( $ns and $ns != 'rdf' ) { @@ -455,10 +456,7 @@ class RssParser elseif ($this->_format == 'atom' and $this->incontent ) { // if tags are inlined, then flatten - $attrs_str = join(' ', - array_map('map_attrs', - array_keys($attrs), - array_values($attrs) ) ); + $attrs_str = join(' ', array_map('map_attrs', array_keys($attrs), array_values($attrs))); $this->append_content("<$element $attrs_str>" ); @@ -491,8 +489,9 @@ class RssParser /** * Triggered when CDATA is found * - * @param $p - * @param $text Tag + * @param string $p + * @param string $text Tag + * @return void */ function feed_cdata($p, $text) { @@ -509,8 +508,9 @@ class RssParser /** * Triggered when closed tag is found * - * @param $p - * @param $el Tag + * @param string $p + * @param string $el Tag + * @return void */ function feed_end_element($p, $el) { @@ -562,8 +562,9 @@ class RssParser /** * To concat 2 string with no warning if an operand is not defined * - * @param $str1 - * @param $str2 + * @param string &$str1 Str1 + * @param string $str2 Str2 + * @return string String cancatenated */ function concat(&$str1, $str2="") { @@ -574,6 +575,10 @@ class RssParser } /** + * Enter description here ... + * + * @param string $text Text + * @return void */ function append_content($text) { @@ -587,6 +592,10 @@ class RssParser /** * smart append - field and namespace aware + * + * @param string $el El + * @param string $text Text + * @return void */ function append($el, $text) { @@ -596,30 +605,30 @@ class RssParser if ( $this->current_namespace ) { if ( $this->initem ) { - $this->concat( $this->current_item[ $this->current_namespace ][ $el ], $text); + $this->concat($this->current_item[ $this->current_namespace ][ $el ], $text); } elseif ($this->inchannel) { - $this->concat( $this->channel[ $this->current_namespace][ $el ], $text); + $this->concat($this->channel[ $this->current_namespace][ $el ], $text); } elseif ($this->intextinput) { - $this->concat( $this->textinput[ $this->current_namespace][ $el ], $text); + $this->concat($this->textinput[ $this->current_namespace][ $el ], $text); } elseif ($this->inimage) { - $this->concat( $this->image[ $this->current_namespace ][ $el ], $text); + $this->concat($this->image[ $this->current_namespace ][ $el ], $text); } } else { if ( $this->initem ) { - $this->concat( $this->current_item[ $el ], $text); + $this->concat($this->current_item[ $el ], $text); } elseif ($this->intextinput) { - $this->concat( $this->textinput[ $el ], $text); + $this->concat($this->textinput[ $el ], $text); } elseif ($this->inimage) { - $this->concat( $this->image[ $el ], $text); + $this->concat($this->image[ $el ], $text); } elseif ($this->inchannel) { - $this->concat( $this->channel[ $el ], $text); + $this->concat($this->channel[ $el ], $text); } } @@ -630,6 +639,9 @@ class RssParser /** * Function to convert an XML object into an array + * + * @param string $xml Xml + * @return void */ function xml2php($xml) { -- GitLab