From 82fd84fb484fc4ee23bfb3437a5cced5b8e988d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Mar 2018 11:22:43 +0100 Subject: [PATCH] Fix scrutinizer errors --- htdocs/compta/facture/fiche-rec.php | 2 +- .../compta/localtax/class/localtax.class.php | 30 +++++++++---------- htdocs/core/class/commonobject.class.php | 6 ++-- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index e1b5af4e88d..8d955f1141d 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1189,7 +1189,7 @@ if ($action == 'create') $disableedit=1; $disablemove=1; $disableremove=1; - $ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice + $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice } print "\n"; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 570942590c2..79a88d11c4d 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -132,7 +132,7 @@ class Localtax extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update(User $user, $notrigger=0) { global $conf, $langs; @@ -149,8 +149,8 @@ class Localtax extends CommonObject $this->db->begin(); // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET"; - $sql.= " localtaxtype=".$this->ltt.","; + $sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET"; + $sql.= " localtaxtype=".$this->ltt.","; $sql.= " tms='".$this->db->idate($this->tms)."',"; $sql.= " datep='".$this->db->idate($this->datep)."',"; $sql.= " datev='".$this->db->idate($this->datev)."',"; @@ -160,7 +160,7 @@ class Localtax extends CommonObject $sql.= " fk_bank=".$this->fk_bank.","; $sql.= " fk_user_creat=".$this->fk_user_creat.","; $sql.= " fk_user_modif=".$this->fk_user_modif; - $sql.= " WHERE rowid=".$this->id; + $sql.= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); @@ -255,12 +255,12 @@ class Localtax extends CommonObject } - /** - * Delete object in database - * - * @param User $user User that delete - * @return int <0 if KO, >0 if OK - */ + /** + * Delete object in database + * + * @param User $user User that delete + * @return int <0 if KO, >0 if OK + */ function delete($user) { // Call trigger @@ -285,11 +285,11 @@ class Localtax extends CommonObject /** - * Initialise an instance with random values. - * Used to build previews or test instances. - * id must be 0 if object instance is a specimen. - * - * @return void + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fe4eaffc177..4179863400c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2739,7 +2739,7 @@ abstract class CommonObject * @param string $targettype Object target type (if not defined, elemennt name of object) * @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided * @param int $alsosametype 0=Return only links to object that differs from source. 1=Include also link to objects of same type. - * @return void + * @return int <0 if KO, >0 if OK * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR',$alsosametype=1) @@ -2920,10 +2920,12 @@ abstract class CommonObject } } } + return 1; } else { dol_print_error($this->db); + return -1; } } @@ -3582,7 +3584,7 @@ abstract class CommonObject * Return HTML table for object lines * TODO Move this into an output class file (htmlline.class.php) * If lines are into a template, title must also be into a template - * But for the moment we don't know if it'st possible as we keep a method available on overloaded objects. + * But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * * @param string $action Action code * @param string $seller Object of seller third party