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

View File

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

View File

@ -684,7 +684,7 @@ class Commande extends CommonObject
$this->lines[$i]->remise_percent,
$this->lines[$i]->info_bits,
$this->lines[$i]->fk_remise_except,
'HT',
'HT',
0,
$this->lines[$i]->date_start,
$this->lines[$i]->date_end,
@ -2110,7 +2110,7 @@ class Commande extends CommonObject
* @param int $skip_update_total Skip update of total
* @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;

View File

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

View File

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

View File

@ -349,7 +349,7 @@ class Facture extends CommonObject
$this->lines[$i]->fk_code_ventilation,
$this->lines[$i]->info_bits,
$this->lines[$i]->fk_remise_except,
'HT',
'HT',
0,
$this->lines[$i]->product_type,
$this->lines[$i]->rang,
@ -400,7 +400,13 @@ class Facture extends CommonObject
$localtax2_tx,
$_facrec->lines[$i]->fk_product,
$_facrec->lines[$i]->remise_percent,
'','',0,0,'','HT',0,
'',
'',
0,
0,
'',
'HT',
0,
$_facrec->lines[$i]->product_type,
$_facrec->lines[$i]->rang,
$_facrec->lines[$i]->special_code
@ -1264,7 +1270,7 @@ class Facture extends CommonObject
}
}
}
$this->db->commit();
return 1;
}

View File

@ -34,10 +34,10 @@ class FileUpload
protected $_options;
protected $_fk_element;
protected $_element;
/**
* Constructor
*
*
* @param array $options Options array
* @param int $fk_element fk_element
* @param string $element element
@ -46,17 +46,17 @@ class FileUpload
{
global $db, $conf;
global $object;
$this->_fk_element=$fk_element;
$this->_element=$element;
$pathname=$filename=$element;
if (preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
{
$pathname = $regs[1];
$filename = $regs[2];
}
// For compatibility
if ($element == 'propal') {
$pathname = 'comm/propal';
@ -82,18 +82,18 @@ class FileUpload
}
dol_include_once('/'.$pathname.'/class/'.$filename.'.class.php');
$classname = ucfirst($filename);
if ($element == 'order_supplier') {
$classname = 'CommandeFournisseur';
}
$object = new $classname($db);
$object->fetch($fk_element);
$object->fetch_thirdparty();
$this->_options = array(
'script_url' => $_SERVER['PHP_SELF'],
'upload_dir' => $dir_output . '/' . $object->ref . '/',
@ -141,11 +141,14 @@ class FileUpload
$this->_options = array_replace_recursive($this->_options, $options);
}
}
/**
*
* getFullUrl
*
* @return string Full url
*/
protected function getFullUrl() {
protected function getFullUrl()
{
$https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
return
($https ? 'https://' : 'http://').
@ -155,13 +158,15 @@ class FileUpload
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
}
/**
* 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='.rawurlencode($file->name).'&fk_element='.$this->_fk_element.'&element='.$this->_element;
$file->delete_type = $this->_options['delete_type'];
@ -169,7 +174,7 @@ class FileUpload
$file->delete_url .= '&_method=DELETE';
}
}
/**
* Enter description here ...
*
@ -218,7 +223,7 @@ class FileUpload
protected function create_scaled_image($file_name, $options)
{
global $maxwidthmini, $maxheightmini;
$file_path = $this->_options['upload_dir'].$file_name;
$new_file_path = $options['upload_dir'].$file_name;
@ -302,10 +307,10 @@ class FileUpload
}
return true;
}
/**
* Enter description here ...
*
*
* @param unknown_type $matches
*/
protected function upcount_name_callback($matches) {
@ -313,10 +318,10 @@ class FileUpload
$ext = isset($matches[2]) ? $matches[2] : '';
return ' ('.$index.')'.$ext;
}
/**
* Enter description here ...
*
*
* @param unknown_type $name
*/
protected function upcount_name($name) {
@ -327,13 +332,14 @@ class FileUpload
1
);
}
/**
* Enter description here ...
*
* @param unknown_type $name
* @param unknown_type $type
* @param unknown_type $index
*
* @param string $name
* @param string $type
* @param string $index
* @return string Trimed string
*/
protected function trim_file_name($name, $type, $index) {
// Remove path information and dots around the filename, to prevent uploading
@ -352,20 +358,20 @@ class FileUpload
}
return $file_name;
}
/**
* Enter description here ...
*
*
* @param unknown_type $file
* @param unknown_type $index
*/
protected function handle_form_data($file, $index) {
// Handle form data, e.g. $_REQUEST['description'][$index]
}
/**
* Enter description here ...
*
*
* @param unknown_type $file_path
*/
protected function orient_image($file_path) {

View File

@ -56,7 +56,6 @@ class HookManager
/**
* Init array this->hooks with instantiated action controlers.
*
* 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.
* This make conf->hooks_modules loaded with an entry ('modulename'=>array(nameofcontext1,nameofcontext2,...))

View File

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

View File

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

View File

@ -644,7 +644,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $countrycode='FR')
date("m", $date_paques),
date("d", $date_paques) + 38,
date("Y", $date_paques)
);
);
$jour_ascension = date("d", $date_ascension);
$mois_ascension = date("m", $date_ascension);
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)
$date_pentecote = mktime(
date("H", $date_ascension),
date("i", $date_ascension),
date("s", $date_ascension),
date("m", $date_ascension),
date("d", $date_ascension) + 11,
date("Y", $date_ascension)
date("H", $date_ascension),
date("i", $date_ascension),
date("s", $date_ascension),
date("m", $date_ascension),
date("d", $date_ascension) + 11,
date("Y", $date_ascension)
);
$jour_pentecote = date("d", $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
*
* @param string $filename Filename
* @return string Unescaped string
*/
function dol_unescapefile($filename)
{

View File

@ -373,13 +373,13 @@ function dol_string_unaccent($str)
{
$string = strtr(
$str,
"\xC0\xC1\xC2\xC3\xC5\xC7
"\xC0\xC1\xC2\xC3\xC5\xC7
\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1
\xD2\xD3\xD4\xD5\xD8\xD9\xDA\xDB\xDD
\xE0\xE1\xE2\xE3\xE5\xE7\xE8\xE9\xEA\xEB
\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF8
\xF9\xFA\xFB\xFD\xFF",
"AAAAAC
"AAAAAC
EEEEIIIIDN
OOOOOUUUY
aaaaaceeee
@ -449,7 +449,6 @@ function dol_escape_htmltag($stringtoescape,$keepb=0)
* 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: 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 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.
* 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.
* Usage must be avoid.
*

View File

@ -392,7 +392,7 @@ class pdf_oursin extends ModelePDFFactures
$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->SetXY($tab3_posx+21, $tab3_top+$y);
$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->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++;
}
@ -429,7 +429,7 @@ class pdf_oursin extends ModelePDFFactures
$y+=3;
$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->SetXY($tab3_posx+21, $tab3_top+$y);
$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->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++;
}

View File

@ -155,7 +155,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
/**
* 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 string $srctemplatepath Full path of source filename for generator using a template file
* @return int 1 if OK, <=0 if KO

View File

@ -364,7 +364,7 @@ abstract class ModeleAccountancyCode
* Create a document for third party
*
* @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 $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
@ -416,7 +416,7 @@ function thirdparty_doc_create($db, &$object, $message, $modele, $outputlangs)
if ($obj->write_file($object, $outputlangs, $srctemplatepath) > 0)
{
$outputlangs->charset_output=$sav_charset_output;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
@ -425,7 +425,7 @@ function thirdparty_doc_create($db, &$object, $message, $modele, $outputlangs)
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
return 1;
}
else

View File

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

View File

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

View File

@ -251,7 +251,7 @@ if (empty($reshook))
if ($object->fetch($id,$ref))
{
$object->oldcopy=dol_clone($object);
$object->ref = $ref;
$object->libelle = $_POST["libelle"];
$object->description = dol_htmlcleanlastbr($_POST["desc"]);
@ -549,8 +549,8 @@ if (empty($reshook))
$localtax2_tx, // localtax2
$prod->id,
$_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,
$pu_ttc
);
@ -631,11 +631,11 @@ if (empty($reshook))
$localtax2_tx,
$prod->id,
$_POST["remise_percent"],
'',
'',
'',
'',
'',
'',
'',
'',
'',
'',
$price_base_type,
$pu_ttc
);
@ -825,7 +825,7 @@ else
// Note (private, no output on invoices, propales...)
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
$doleditor = new DolEditor('note', $_POST["note"], '', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 8, 70);
$doleditor->Create();
@ -939,7 +939,7 @@ else
// Description (used in invoice, propal...)
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">';
$doleditor = new DolEditor('desc', $object->description, '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, 90);
$doleditor->Create();
@ -1032,7 +1032,7 @@ else
// Note
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
$doleditor = new DolEditor('note', $object->note, '', 200, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 8, 70);
$doleditor->Create();

View File

@ -55,7 +55,7 @@ class Project extends CommonObject
/**
* Constructor
*
* @param DoliDB $DB Database handler
* @param DoliDB $db Database handler
*/
function __construct($db)
{
@ -210,7 +210,7 @@ class Project extends CommonObject
}
// End call triggers
}
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref))
{
// We remove directory

View File

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

View File

@ -595,7 +595,7 @@ class User extends CommonObject
}
$this->db->free($resql);
}
// For backward compatibility
if (isset($this->rights->propale))
{
@ -1454,7 +1454,7 @@ class User extends CommonObject
'',
0,
$msgishtml
);
);
if ($mailfile->sendfile())
{

View File

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