Fix scrutinizer

This commit is contained in:
Laurent Destailleur 2017-11-29 16:25:12 +01:00
parent 2693e5db6d
commit 682afe8918
2 changed files with 22 additions and 19 deletions

View File

@ -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) {

View File

@ -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 = '<u>' . $langs->trans('ShowAction'.$objp->code) . '</u>';
$tooltip = '<u>' . $langs->trans('ShowAction') . '</u>';
if (! empty($this->ref))
$tooltip .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($label))