From 682afe8918a6cfa92ec1618ce75b58ecbe46e832 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Nov 2017 16:25:12 +0100 Subject: [PATCH] Fix scrutinizer --- htdocs/accountancy/class/lettering.class.php | 37 ++++++++++--------- htdocs/comm/action/class/actioncomm.class.php | 4 +- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index b30c0bdf9da..0fbb3872489 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -223,8 +223,10 @@ class lettering extends BookKeeping * @param boolean $notrigger no trigger * @return number */ - public function updateLettrage($ids = array(), $notrigger = false) { + public function updateLettrage($ids = array(), $notrigger = false) + { $error = 0; + $lettre = 'AAA'; dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); @@ -236,11 +238,10 @@ class lettering extends BookKeeping $obj = $this->db->fetch_object($result); $lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code); if (! empty($obj->lettering_code)) - $lettre ++; + $lettre++; } else { $this->errors[] = 'Error' . $this->db->lasterror(); - ; - $error ++; + $error++; } $sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE "; @@ -250,29 +251,31 @@ class lettering extends BookKeeping $obj = $this->db->fetch_object($result); if (! (round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) { $this->errors[] = 'Total not exacts ' . round(abs($obj->deb), 2) . ' vs ' . round(abs($obj->cred), 2); - $error ++; + $error++; } } else { $this->errors[] = 'Erreur sql' . $this->db->lasterror(); - ; - $error ++; + $error++; } // Update request $now = dol_now(); - $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET"; - $sql .= " lettering_code='" . $lettre . "'"; - $sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false - $sql .= " WHERE rowid IN (" . implode(',', $ids) . ") "; - $this->db->begin(); + if (! $error) + { + $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET"; + $sql .= " lettering_code='" . $lettre . "'"; + $sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false + $sql .= " WHERE rowid IN (" . implode(',', $ids) . ") "; + $this->db->begin(); - dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); - $resql = $this->db->query($sql); - if (! $resql) { - $error ++; - $this->errors[] = "Error " . $this->db->lasterror(); + dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) { + $error++; + $this->errors[] = "Error " . $this->db->lasterror(); + } } if (! $error) { diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 2eb14c6abf8..39e2f0a98f7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1215,7 +1215,7 @@ class ActionComm extends CommonObject */ function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto=0, $notooltip=0) { - global $conf, $langs, $user, $hookmanager; + global $conf, $langs, $user, $hookmanager, $action; if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips @@ -1231,7 +1231,7 @@ class ActionComm extends CommonObject if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL'); } - $tooltip = '' . $langs->trans('ShowAction'.$objp->code) . ''; + $tooltip = '' . $langs->trans('ShowAction') . ''; if (! empty($this->ref)) $tooltip .= '
' . $langs->trans('Ref') . ': ' . $this->ref; if (! empty($label))