Fix: error reported by scrutinizer

This commit is contained in:
Laurent Destailleur 2014-12-20 15:42:03 +01:00
parent d8838f9438
commit 8996953077
20 changed files with 40 additions and 42 deletions

View File

@ -141,7 +141,7 @@ $server->register(
* @param array $authentication Array of authentication information * @param array $authentication Array of authentication information
* @param int $id Id of object * @param int $id Id of object
* @param string $ref Ref of object * @param string $ref Ref of object
* @param ref_ext $ref_ext Ref external of object * @param string $ref_ext Ref external of object
* @return mixed * @return mixed
*/ */
function getSkeleton($authentication,$id,$ref='',$ref_ext='') function getSkeleton($authentication,$id,$ref='',$ref_ext='')

View File

@ -1045,7 +1045,7 @@ class Adherent extends CommonObject
* @param int $rowid Id of object to load * @param int $rowid Id of object to load
* @param string $ref To load member from its ref * @param string $ref To load member from its ref
* @param int $fk_soc To load member from its link to third party * @param int $fk_soc To load member from its link to third party
* @param int $ref_ext External reference * @param string $ref_ext External reference
* @return int >0 if OK, 0 if not found, <0 if KO * @return int >0 if OK, 0 if not found, <0 if KO
*/ */
function fetch($rowid,$ref='',$fk_soc='',$ref_ext='') function fetch($rowid,$ref='',$fk_soc='',$ref_ext='')

View File

@ -30,9 +30,7 @@
/** /**
* \class BankCateg * Class to manage bank categories
* \brief Class to manage bank categories
* \remarks Initialy built by build_class_from_table on 2009-01-02 15:26
*/ */
class BankCateg // extends CommonObject class BankCateg // extends CommonObject
{ {
@ -300,7 +298,7 @@ class BankCateg // extends CommonObject
$error=0; $error=0;
$object=new Bank_categ($this->db); $object=new BankCateg($this->db);
$this->db->begin(); $this->db->begin();

View File

@ -2479,7 +2479,7 @@ class Facture extends CommonInvoice
* Return next reference of customer invoice not already used (or last reference) * Return next reference of customer invoice not already used (or last reference)
* according to numbering module defined into constant FACTURE_ADDON * according to numbering module defined into constant FACTURE_ADDON
* *
* @param Society $soc object company * @param Societe $soc object company
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string free ref or last ref * @return string free ref or last ref
*/ */
@ -2838,7 +2838,7 @@ class Facture extends CommonInvoice
function demande_prelevement($user) function demande_prelevement($user)
{ {
$error=0; $error=0;
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
if ($this->statut > 0 && $this->paye == 0) if ($this->statut > 0 && $this->paye == 0)
@ -2896,12 +2896,12 @@ class Facture extends CommonInvoice
{ {
// Force payment mode of invoice to withdraw // Force payment mode of invoice to withdraw
$payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement'); $payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement');
if ($payment_mode_id > 0) if ($payment_mode_id > 0)
{ {
$result=$this->setPaymentMethods($payment_mode_id); $result=$this->setPaymentMethods($payment_mode_id);
} }
} }
if ($error) return -1; if ($error) return -1;
return 1; return 1;
} }
@ -3519,7 +3519,7 @@ class FactureLigne extends CommonInvoiceLine
return -1; return -1;
} }
} }
// POS or by external module, take lowest buying price // POS or by external module, take lowest buying price
if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) { if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) {
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';

View File

@ -58,7 +58,7 @@ class BonPrelevement extends CommonObject
var $invoice_in_error=array(); var $invoice_in_error=array();
/** /**
* Constructor * Constructor
* *
@ -1634,7 +1634,7 @@ class BonPrelevement extends CommonObject
* @param int $nombre 0 or 1 * @param int $nombre 0 or 1
* @param float $total Total * @param float $total Total
* @param string $CrLf End of line character * @param string $CrLf End of line character
* @return SEPA * @return string String with SEAP Sender
*/ */
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n') function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
{ // SEPA INITIALISATION { // SEPA INITIALISATION

View File

@ -343,7 +343,7 @@ class Tva extends CommonObject
} }
/** /**
* Total of the VAT from invoices emitted by the society. * Total of the VAT from invoices emitted by the thirdparty.
* *
* @param int $year Year * @param int $year Year
* @return double Amount * @return double Amount

View File

@ -88,7 +88,7 @@ class Contrat extends CommonObject
/** /**
* Return next contract ref * Return next contract ref
* *
* @param Societe $soc objet society * @param Societe $soc Thirdparty object
* @return string free reference for contract * @return string free reference for contract
*/ */
function getNextNumRef($soc) function getNextNumRef($soc)

View File

@ -669,7 +669,7 @@ class DoliDBPgsql extends DoliDB
/** /**
* Renvoie le code erreur generique de l'operation precedente. * Renvoie le code erreur generique de l'operation precedente.
* *
* @return error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) * @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/ */
function errno() function errno()
{ {
@ -735,7 +735,7 @@ class DoliDBPgsql extends DoliDB
/** /**
* Renvoie le texte de l'erreur pgsql de l'operation precedente * Renvoie le texte de l'erreur pgsql de l'operation precedente
* *
* @return error_text * @return string Error text
*/ */
function error() function error()
{ {

View File

@ -536,7 +536,7 @@ class DoliDBSqlite extends DoliDB
/** /**
* Renvoie le code erreur generique de l'operation precedente. * Renvoie le code erreur generique de l'operation precedente.
* *
* @return string $error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) * @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/ */
function errno() function errno()
{ {
@ -598,7 +598,7 @@ class DoliDBSqlite extends DoliDB
/** /**
* Renvoie le texte de l'erreur mysql de l'operation precedente. * Renvoie le texte de l'erreur mysql de l'operation precedente.
* *
* @return string $error_text * @return string Error text
*/ */
function error() function error()
{ {

View File

@ -1273,7 +1273,7 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
* *
* @param Object $object Object * @param Object $object Object
* @param int $i Current line number * @param int $i Current line number
* @param Tranlate $outputlangs Object langs for output * @param Translate $outputlangs Object langs for output
* @param int $hidedetails Hide value (0 = no, 1 = yes, 2 = just special lines) * @param int $hidedetails Hide value (0 = no, 1 = yes, 2 = just special lines)
* @return void * @return void
*/ */

View File

@ -44,7 +44,7 @@ interface LogHandlerInterface
/** /**
* Return if logger active * Return if logger active
* *
* @return boolen True if active * @return boolean True if active
*/ */
public function isActive(); public function isActive();

View File

@ -113,7 +113,7 @@ class Expedition extends CommonObject
/** /**
* Return next contract ref * Return next contract ref
* *
* @param Societe $soc Objet society * @param Societe $soc Thirdparty object
* @return string Free reference for contract * @return string Free reference for contract
*/ */
function getNextNumRef($soc) function getNextNumRef($soc)

View File

@ -572,7 +572,7 @@ class Fichinter extends CommonObject
* Returns the next non used reference of intervention * Returns the next non used reference of intervention
* depending on the module numbering assets within FICHEINTER_ADDON * depending on the module numbering assets within FICHEINTER_ADDON
* *
* @param Societe $soc Object society * @param Societe $soc Thirdparty object
* @return string Free reference for intervention * @return string Free reference for intervention
*/ */
function getNextNumRef($soc) function getNextNumRef($soc)

View File

@ -1493,7 +1493,7 @@ class FactureFournisseur extends CommonInvoice
* Return next reference of supplier invoice not already used (or last reference) * Return next reference of supplier invoice not already used (or last reference)
* according to numbering module defined into constant INVOICE_SUPPLIER_ADDON_NUMBER * according to numbering module defined into constant INVOICE_SUPPLIER_ADDON_NUMBER
* *
* @param Society $soc object company * @param Societe $soc Thirdparty object
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string free ref or last ref * @return string free ref or last ref
*/ */

View File

@ -46,7 +46,7 @@ llxHeader(array(),$langs->trans('CPTitreMenu'));
print_fiche_titre($langs->trans('MenuConfCP')); print_fiche_titre($langs->trans('MenuConfCP'));
$congespayes = new Holidays($db); $congespayes = new Holiday($db);
$listUsers = $congespayes->fetchUsers(false, true); $listUsers = $congespayes->fetchUsers(false, true);
// Si il y a une action de mise à jour // Si il y a une action de mise à jour

View File

@ -2382,7 +2382,7 @@ class Societe extends CommonObject
* *
* @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm) * @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm)
* @param string $value Value of profid * @param string $value Value of profid
* @param int $socid Id of society if update * @param int $socid Id of thirdparty if update
* @return boolean true if exists, false if not * @return boolean true if exists, false if not
*/ */
function id_prof_exists($idprof,$value,$socid=0) function id_prof_exists($idprof,$value,$socid=0)

View File

@ -138,7 +138,7 @@ class User extends CommonObject
* *
* @param int $id Si defini, id a utiliser pour recherche * @param int $id Si defini, id a utiliser pour recherche
* @param string $login Si defini, login a utiliser pour recherche * @param string $login Si defini, login a utiliser pour recherche
* @param strinf $sid Si defini, sid a utiliser pour recherche * @param string $sid Si defini, sid a utiliser pour recherche
* @param int $loadpersonalconf Also load personal conf of user (in $user->conf->xxx) * @param int $loadpersonalconf Also load personal conf of user (in $user->conf->xxx)
* @return int <0 if KO, 0 not found, >0 if OK * @return int <0 if KO, 0 not found, >0 if OK
*/ */

View File

@ -234,7 +234,7 @@ $server->register(
* @param array $authentication Array of authentication information * @param array $authentication Array of authentication information
* @param int $id Id of object * @param int $id Id of object
* @param string $ref Ref of object * @param string $ref Ref of object
* @param ref_ext $ref_ext Ref external of object * @param string $ref_ext Ref external of object
* @return mixed * @return mixed
*/ */
function getContact($authentication,$id,$ref='',$ref_ext='') function getContact($authentication,$id,$ref='',$ref_ext='')

View File

@ -327,7 +327,7 @@ $server->register(
* @param array $authentication Array of authentication information * @param array $authentication Array of authentication information
* @param int $id Id of object * @param int $id Id of object
* @param string $ref Ref of object * @param string $ref Ref of object
* @param ref_ext $ref_ext Ref external of object * @param string $ref_ext Ref external of object
* @param string $lang Lang to force * @param string $lang Lang to force
* @return mixed * @return mixed
*/ */
@ -378,7 +378,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang=''
if (! empty($product->multilangs[$langs->defaultlang]["label"])) $product->label = $product->multilangs[$langs->defaultlang]["label"]; if (! empty($product->multilangs[$langs->defaultlang]["label"])) $product->label = $product->multilangs[$langs->defaultlang]["label"];
if (! empty($product->multilangs[$langs->defaultlang]["description"])) $product->description = $product->multilangs[$langs->defaultlang]["description"]; if (! empty($product->multilangs[$langs->defaultlang]["description"])) $product->description = $product->multilangs[$langs->defaultlang]["description"];
if (! empty($product->multilangs[$langs->defaultlang]["note"])) $product->note = $product->multilangs[$langs->defaultlang]["note"]; if (! empty($product->multilangs[$langs->defaultlang]["note"])) $product->note = $product->multilangs[$langs->defaultlang]["note"];
$productorservice_result_fields = array( $productorservice_result_fields = array(
'id' => $product->id, 'id' => $product->id,
'ref' => $product->ref, 'ref' => $product->ref,
@ -396,7 +396,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang=''
'country_id' => $product->country_id>0?$product->country_id:'', 'country_id' => $product->country_id>0?$product->country_id:'',
'country_code' => $product->country_code, 'country_code' => $product->country_code,
'custom_code' => $product->customcode, 'custom_code' => $product->customcode,
'price_net' => $product->price, 'price_net' => $product->price,
'price' => $product->price_ttc, 'price' => $product->price_ttc,
'price_min_net' => $product->price_min, 'price_min_net' => $product->price_min,
@ -408,7 +408,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang=''
//! Spanish local taxes //! Spanish local taxes
'localtax1_tx' => $product->localtax1_tx, 'localtax1_tx' => $product->localtax1_tx,
'localtax2_tx' => $product->localtax2_tx, 'localtax2_tx' => $product->localtax2_tx,
'stock_real' => $product->stock_reel, 'stock_real' => $product->stock_reel,
'stock_alert' => $product->seuil_stock_alerte, 'stock_alert' => $product->seuil_stock_alerte,
'pmp' => $product->pmp, 'pmp' => $product->pmp,
@ -416,19 +416,19 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang=''
'dir' => $pdir, 'dir' => $pdir,
'images' => $product->liste_photos($dir,$nbmax=10) 'images' => $product->liste_photos($dir,$nbmax=10)
); );
//Retreive all extrafield for thirdsparty //Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('product',true); $extralabels=$extrafields->fetch_name_optionals_label('product',true);
//Get extrafield values //Get extrafield values
$product->fetch_optionals($product->id,$extralabels); $product->fetch_optionals($product->id,$extralabels);
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$productorservice_result_fields=array_merge($productorservice_result_fields,array('options_'.$key => $product->array_options['options_'.$key])); $productorservice_result_fields=array_merge($productorservice_result_fields,array('options_'.$key => $product->array_options['options_'.$key]));
} }
// Create // Create
$objectresp = array( $objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''), 'result'=>array('result_code'=>'OK', 'result_label'=>''),
@ -533,7 +533,7 @@ function createProductOrService($authentication,$product)
}*/ }*/
//var_dump($product['ref_ext']); //var_dump($product['ref_ext']);
//var_dump($product['lines'][0]['type']); //var_dump($product['lines'][0]['type']);
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('product',true); $extralabels=$extrafields->fetch_name_optionals_label('product',true);
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
@ -652,7 +652,7 @@ function updateProductOrService($authentication,$product)
}*/ }*/
//var_dump($product['ref_ext']); //var_dump($product['ref_ext']);
//var_dump($product['lines'][0]['type']); //var_dump($product['lines'][0]['type']);
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('product',true); $extralabels=$extrafields->fetch_name_optionals_label('product',true);
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
@ -965,19 +965,19 @@ function getProductsForCategory($authentication,$id,$lang='')
'dir' => $pdir, 'dir' => $pdir,
'images' => $obj->liste_photos($dir,$nbmax=10) 'images' => $obj->liste_photos($dir,$nbmax=10)
); );
//Retreive all extrafield for thirdsparty //Retreive all extrafield for thirdsparty
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields=new ExtraFields($db); $extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('product',true); $extralabels=$extrafields->fetch_name_optionals_label('product',true);
//Get extrafield values //Get extrafield values
$product->fetch_optionals($obj->id,$extralabels); $product->fetch_optionals($obj->id,$extralabels);
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$products[$iProduct]=array_merge($products[$iProduct],array('options_'.$key => $product->array_options['options_'.$key])); $products[$iProduct]=array_merge($products[$iProduct],array('options_'.$key => $product->array_options['options_'.$key]));
} }
$iProduct++; $iProduct++;
} }

View File

@ -299,7 +299,7 @@ $server->register(
* @param array $authentication Array of authentication information * @param array $authentication Array of authentication information
* @param int $id Id of object * @param int $id Id of object
* @param string $ref Ref of object * @param string $ref Ref of object
* @param ref_ext $ref_ext Ref external of object * @param string $ref_ext Ref external of object
* @return mixed * @return mixed
*/ */
function getUser($authentication,$id,$ref='',$ref_ext='') function getUser($authentication,$id,$ref='',$ref_ext='')