Fix: Removing chekstyle warning helps me to find real bugs

This commit is contained in:
Laurent Destailleur 2012-07-29 15:08:03 +02:00
parent 498ac04ad1
commit 8a77ffe58f
23 changed files with 129 additions and 117 deletions

View File

@ -211,7 +211,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! $_POST['addfile'] && ! $_P
$body=make_substitutions($body,$substitutionarrayfortest); $body=make_substitutions($body,$substitutionarrayfortest);
require_once(DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php");
$mailfile = new CMailFile( $mailfile = new CMailFile(
$subject, $subject,
$sendto, $sendto,
$email_from, $email_from,
@ -224,7 +224,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! $_POST['addfile'] && ! $_P
$deliveryreceipt, $deliveryreceipt,
$msgishtml, $msgishtml,
$errors_to $errors_to
); );
$result=$mailfile->sendfile(); $result=$mailfile->sendfile();

View File

@ -60,11 +60,11 @@ $substitutionarray=array(
if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE) if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE)
{ {
$substitutionarray=array_merge( $substitutionarray=array_merge(
$substitutionarray, $substitutionarray,
array( array(
'__CHECK_READ__' => 'CheckMail', '__CHECK_READ__' => 'CheckMail',
'__UNSUBSCRIBE__' => 'Unsubscribe' '__UNSUBSCRIBE__' => 'Unsubscribe'
) )
); );
} }
@ -83,13 +83,13 @@ $substitutionarrayfortest=array(
); );
if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE) if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE)
{ {
$substitutionarrayfortest=array_merge( $substitutionarrayfortest=array_merge(
$substitutionarrayfortest, $substitutionarrayfortest,
array( array(
'__CHECK_READ__' => 'TESTCheckMail', '__CHECK_READ__' => 'TESTCheckMail',
'__UNSUBSCRIBE__' => 'TESTUnsubscribe' '__UNSUBSCRIBE__' => 'TESTUnsubscribe'
) )
); );
} }
// Action clone object // Action clone object

View File

@ -684,7 +684,7 @@ class Commande extends CommonObject
$this->lines[$i]->remise_percent, $this->lines[$i]->remise_percent,
$this->lines[$i]->info_bits, $this->lines[$i]->info_bits,
$this->lines[$i]->fk_remise_except, $this->lines[$i]->fk_remise_except,
'HT', 'HT',
0, 0,
$this->lines[$i]->date_start, $this->lines[$i]->date_start,
$this->lines[$i]->date_end, $this->lines[$i]->date_end,
@ -2110,7 +2110,7 @@ class Commande extends CommonObject
* @param int $skip_update_total Skip update of total * @param int $skip_update_total Skip update of total
* @return int < 0 if KO, > 0 if OK * @return int < 0 if KO, > 0 if OK
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0)
{ {
global $conf; global $conf;

View File

@ -45,7 +45,7 @@ class CommandeStats extends Stats
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
* @param int $socid Id third party for filter * @param int $socid Id third party for filter
* @param string $mode Option * @param string $mode Option
* @param int $userid Id user for filter * @param int $userid Id user for filter

View File

@ -146,20 +146,20 @@ class FactureRec extends Facture
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
{ {
$result_insert = $this->addline( $result_insert = $this->addline(
$this->id, $this->id,
$facsrc->lines[$i]->desc, $facsrc->lines[$i]->desc,
$facsrc->lines[$i]->subprice, $facsrc->lines[$i]->subprice,
$facsrc->lines[$i]->qty, $facsrc->lines[$i]->qty,
$facsrc->lines[$i]->tva_tx, $facsrc->lines[$i]->tva_tx,
$facsrc->lines[$i]->fk_product, $facsrc->lines[$i]->fk_product,
$facsrc->lines[$i]->remise_percent, $facsrc->lines[$i]->remise_percent,
'HT', 'HT',
0, 0,
'', '',
0, 0,
$facsrc->lines[$i]->product_type, $facsrc->lines[$i]->product_type,
$facsrc->lines[$i]->rang, $facsrc->lines[$i]->rang,
$facsrc->lines[$i]->special_code $facsrc->lines[$i]->special_code
); );
if ($result_insert < 0) if ($result_insert < 0)

View File

@ -349,7 +349,7 @@ class Facture extends CommonObject
$this->lines[$i]->fk_code_ventilation, $this->lines[$i]->fk_code_ventilation,
$this->lines[$i]->info_bits, $this->lines[$i]->info_bits,
$this->lines[$i]->fk_remise_except, $this->lines[$i]->fk_remise_except,
'HT', 'HT',
0, 0,
$this->lines[$i]->product_type, $this->lines[$i]->product_type,
$this->lines[$i]->rang, $this->lines[$i]->rang,
@ -400,7 +400,13 @@ class Facture extends CommonObject
$localtax2_tx, $localtax2_tx,
$_facrec->lines[$i]->fk_product, $_facrec->lines[$i]->fk_product,
$_facrec->lines[$i]->remise_percent, $_facrec->lines[$i]->remise_percent,
'','',0,0,'','HT',0, '',
'',
0,
0,
'',
'HT',
0,
$_facrec->lines[$i]->product_type, $_facrec->lines[$i]->product_type,
$_facrec->lines[$i]->rang, $_facrec->lines[$i]->rang,
$_facrec->lines[$i]->special_code $_facrec->lines[$i]->special_code

View File

@ -143,9 +143,12 @@ class FileUpload
} }
/** /**
* getFullUrl
* *
* @return string Full url
*/ */
protected function getFullUrl() { protected function getFullUrl()
{
$https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'; $https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
return return
($https ? 'https://' : 'http://'). ($https ? 'https://' : 'http://').
@ -159,9 +162,11 @@ class FileUpload
/** /**
* Set delete url * Set delete url
* *
* @param unknown_type $file * @param string $file File
* @return void
*/ */
protected function set_file_delete_url($file) { protected function set_file_delete_url($file)
{
$file->delete_url = $this->_options['script_url'] $file->delete_url = $this->_options['script_url']
.'?file='.rawurlencode($file->name).'&fk_element='.$this->_fk_element.'&element='.$this->_element; .'?file='.rawurlencode($file->name).'&fk_element='.$this->_fk_element.'&element='.$this->_element;
$file->delete_type = $this->_options['delete_type']; $file->delete_type = $this->_options['delete_type'];
@ -331,9 +336,10 @@ class FileUpload
/** /**
* Enter description here ... * Enter description here ...
* *
* @param unknown_type $name * @param string $name
* @param unknown_type $type * @param string $type
* @param unknown_type $index * @param string $index
* @return string Trimed string
*/ */
protected function trim_file_name($name, $type, $index) { protected function trim_file_name($name, $type, $index) {
// Remove path information and dots around the filename, to prevent uploading // Remove path information and dots around the filename, to prevent uploading

View File

@ -56,7 +56,6 @@ class HookManager
/** /**
* Init array this->hooks with instantiated action controlers. * Init array this->hooks with instantiated action controlers.
*
* First, a hook is declared by a module by adding a constant MAIN_MODULE_MYMODULENAME_HOOKS * First, a hook is declared by a module by adding a constant MAIN_MODULE_MYMODULENAME_HOOKS
* with value 'nameofcontext1:nameofcontext2:...' into $this->const of module descriptor file. * with value 'nameofcontext1:nameofcontext2:...' into $this->const of module descriptor file.
* This make conf->hooks_modules loaded with an entry ('modulename'=>array(nameofcontext1,nameofcontext2,...)) * This make conf->hooks_modules loaded with an entry ('modulename'=>array(nameofcontext1,nameofcontext2,...))

View File

@ -1028,7 +1028,7 @@ class Ldap
* Recupere le SID de l'utilisateur * Recupere le SID de l'utilisateur
* Required by Active Directory * Required by Active Directory
* *
* @param string $ldapuser Login de l'utilisateur * @param string $ldapUser Login de l'utilisateur
* @return string Sid * @return string Sid
*/ */
function getObjectSid($ldapUser) function getObjectSid($ldapUser)

View File

@ -203,16 +203,16 @@ class Notify
$mailfile = new CMailFile( $mailfile = new CMailFile(
$subject, $subject,
$sendto, $sendto,
$replyto, $replyto,
$message, $message,
array($file), array($file),
array($mimefile), array($mimefile),
array($filename[count($filename)-1]), array($filename[count($filename)-1]),
'', '',
'', '',
0, 0,
$msgishtml $msgishtml
); );
if ($mailfile->sendfile()) if ($mailfile->sendfile())

View File

@ -644,7 +644,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
date("m", $date_paques), date("m", $date_paques),
date("d", $date_paques) + 38, date("d", $date_paques) + 38,
date("Y", $date_paques) date("Y", $date_paques)
); );
$jour_ascension = date("d", $date_ascension); $jour_ascension = date("d", $date_ascension);
$mois_ascension = date("m", $date_ascension); $mois_ascension = date("m", $date_ascension);
if($jour_ascension == $jour && $mois_ascension == $mois) $ferie=true; if($jour_ascension == $jour && $mois_ascension == $mois) $ferie=true;
@ -652,12 +652,12 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
// Calcul de Pentecote (11 jours apres Paques) // Calcul de Pentecote (11 jours apres Paques)
$date_pentecote = mktime( $date_pentecote = mktime(
date("H", $date_ascension), date("H", $date_ascension),
date("i", $date_ascension), date("i", $date_ascension),
date("s", $date_ascension), date("s", $date_ascension),
date("m", $date_ascension), date("m", $date_ascension),
date("d", $date_ascension) + 11, date("d", $date_ascension) + 11,
date("Y", $date_ascension) date("Y", $date_ascension)
); );
$jour_pentecote = date("d", $date_pentecote); $jour_pentecote = date("d", $date_pentecote);
$mois_pentecote = date("m", $date_pentecote); $mois_pentecote = date("m", $date_pentecote);

View File

@ -490,6 +490,7 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
* Before= Capture d\'écran.doc After= Capture d'écran.doc * Before= Capture d\'écran.doc After= Capture d'écran.doc
* *
* @param string $filename Filename * @param string $filename Filename
* @return string Unescaped string
*/ */
function dol_unescapefile($filename) function dol_unescapefile($filename)
{ {

View File

@ -373,13 +373,13 @@ function dol_string_unaccent($str)
{ {
$string = strtr( $string = strtr(
$str, $str,
"\xC0\xC1\xC2\xC3\xC5\xC7 "\xC0\xC1\xC2\xC3\xC5\xC7
\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1 \xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1
\xD2\xD3\xD4\xD5\xD8\xD9\xDA\xDB\xDD \xD2\xD3\xD4\xD5\xD8\xD9\xDA\xDB\xDD
\xE0\xE1\xE2\xE3\xE5\xE7\xE8\xE9\xEA\xEB \xE0\xE1\xE2\xE3\xE5\xE7\xE8\xE9\xEA\xEB
\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF8 \xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF8
\xF9\xFA\xFB\xFD\xFF", \xF9\xFA\xFB\xFD\xFF",
"AAAAAC "AAAAAC
EEEEIIIIDN EEEEIIIIDN
OOOOOUUUY OOOOOUUUY
aaaaaceeee aaaaaceeee
@ -449,7 +449,6 @@ function dol_escape_htmltag($stringtoescape,$keepb=0)
* this, use logging to files instead of syslog (see setup of module). * this, use logging to files instead of syslog (see setup of module).
* Note: If SYSLOG_FILE_NO_ERROR defined, we never output any error message when writing to log fails. * Note: If SYSLOG_FILE_NO_ERROR defined, we never output any error message when writing to log fails.
* Note: You can get log message into html sources by adding parameter &logtohtml=1 (constant MAIN_LOGTOHTML must be set) * Note: You can get log message into html sources by adding parameter &logtohtml=1 (constant MAIN_LOGTOHTML must be set)
*
* This function works only if syslog module is enabled. * This function works only if syslog module is enabled.
* This must not use any call to other function calling dol_syslog (avoid infinite loop). * This must not use any call to other function calling dol_syslog (avoid infinite loop).
* *
@ -877,7 +876,6 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
/** /**
* Return an array with locale date info. * Return an array with locale date info.
* PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows * PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
*
* WARNING: This function always use PHP server timezone to return locale informations. * WARNING: This function always use PHP server timezone to return locale informations.
* Usage must be avoid. * Usage must be avoid.
* *

View File

@ -392,7 +392,7 @@ class pdf_oursin extends ModelePDFFactures
$invoice->fetch($obj->fk_facture_source); $invoice->fetch($obj->fk_facture_source);
$pdf->SetXY($tab3_posx, $tab3_top+$y ); $pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($obj->datef,'day',false,$outputlangs,true), 0, 'L', 0); $pdf->MultiCell(20, 3, dol_print_date($obj->datef,'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y); $pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($obj->amount_ttc), 0, 'L', 0); $pdf->MultiCell(20, 3, price($obj->amount_ttc), 0, 'L', 0);
@ -401,7 +401,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetXY($tab3_posx+58, $tab3_top+$y); $pdf->SetXY($tab3_posx+58, $tab3_top+$y);
$pdf->MultiCell(20, 3, $invoice->ref, 0, 'L', 0); $pdf->MultiCell(20, 3, $invoice->ref, 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 ); $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3);
$i++; $i++;
} }
@ -429,7 +429,7 @@ class pdf_oursin extends ModelePDFFactures
$y+=3; $y+=3;
$row = $this->db->fetch_object($resql); $row = $this->db->fetch_object($resql);
$pdf->SetXY($tab3_posx, $tab3_top+$y ); $pdf->SetXY($tab3_posx, $tab3_top+$y);
$pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date),'day',false,$outputlangs,true), 0, 'L', 0);
$pdf->SetXY($tab3_posx+21, $tab3_top+$y); $pdf->SetXY($tab3_posx+21, $tab3_top+$y);
$pdf->MultiCell(20, 3, price($row->amount), 0, 'L', 0); $pdf->MultiCell(20, 3, price($row->amount), 0, 'L', 0);
@ -440,7 +440,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetXY($tab3_posx+58, $tab3_top+$y); $pdf->SetXY($tab3_posx+58, $tab3_top+$y);
$pdf->MultiCell(30, 3, $row->num, 0, 'L', 0); $pdf->MultiCell(30, 3, $row->num, 0, 'L', 0);
$pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3 ); $pdf->line($tab3_posx, $tab3_top+$y+3, $tab3_posx+$tab3_width, $tab3_top+$y+3);
$i++; $i++;
} }

View File

@ -155,7 +155,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
/** /**
* Function to build a document on disk using the generic odt module. * Function to build a document on disk using the generic odt module.
* *
* @param Societe $object Object source to build document * @param Societe &$object Object source to build document
* @param Translate $outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $srctemplatepath Full path of source filename for generator using a template file
* @return int 1 if OK, <=0 if KO * @return int 1 if OK, <=0 if KO

View File

@ -364,7 +364,7 @@ abstract class ModeleAccountancyCode
* Create a document for third party * Create a document for third party
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param Societe $object Object of third party to use * @param Societe &$object Object of third party to use
* @param string $message Message * @param string $message Message
* @param string $modele Force model to use ('' to not force). model can be a model name or a template file. * @param string $modele Force model to use ('' to not force). model can be a model name or a template file.
* @param Translate $outputlangs Object lang to use for translation * @param Translate $outputlangs Object lang to use for translation

View File

@ -60,7 +60,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param Societe $object Third party providing order
*/ */
function __construct($db,$object) function __construct($db,$object)
{ {

View File

@ -26,6 +26,7 @@
* *
* @param int $id Element id * @param int $id Element id
* @param string $table Table of Element * @param string $table Table of Element
* @return boolean True if exists
*/ */
function checkElementExist($id, $table) function checkElementExist($id, $table)
{ {

View File

@ -549,8 +549,8 @@ if (empty($reshook))
$localtax2_tx, // localtax2 $localtax2_tx, // localtax2
$prod->id, $prod->id,
$_POST["remise_percent"], $_POST["remise_percent"],
'', '',
'', //Todo: voir si fk_remise_except est encore valable car n'apparait plus dans les propales '', //Todo: voir si fk_remise_except est encore valable car n'apparait plus dans les propales
$price_base_type, $price_base_type,
$pu_ttc $pu_ttc
); );
@ -631,11 +631,11 @@ if (empty($reshook))
$localtax2_tx, $localtax2_tx,
$prod->id, $prod->id,
$_POST["remise_percent"], $_POST["remise_percent"],
'', '',
'', '',
'', '',
'', '',
'', '',
$price_base_type, $price_base_type,
$pu_ttc $pu_ttc
); );

View File

@ -55,7 +55,7 @@ class Project extends CommonObject
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) function __construct($db)
{ {

View File

@ -64,7 +64,7 @@ class Task extends CommonObject
/** /**
* Constructor * Constructor
* *
* @param DoliDB $DB Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) function __construct($db)
{ {

View File

@ -1454,7 +1454,7 @@ class User extends CommonObject
'', '',
0, 0,
$msgishtml $msgishtml
); );
if ($mailfile->sendfile()) if ($mailfile->sendfile())
{ {

View File

@ -166,8 +166,8 @@ if ($resql)
array(), array(),
array(), array(),
array(), array(),
'', '',
'', '',
0, 0,
$msgishtml, $msgishtml,
$errorsto $errorsto