FIX: accountancy lettering: correctly calculated number of lettering operations done

This commit is contained in:
Marc de Lima Lucio 2023-03-02 15:56:10 +01:00
parent 49afabd440
commit d3edbbb51b

View File

@ -297,6 +297,7 @@ class Lettering extends BookKeeping
// Update request // Update request
$now = dol_now(); $now = dol_now();
$affected_rows = 0;
if (!$error) { if (!$error) {
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
@ -309,6 +310,8 @@ class Lettering extends BookKeeping
if (!$resql) { if (!$resql) {
$error++; $error++;
$this->errors[] = "Error ".$this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} else {
$affected_rows = $this->db->affected_rows($resql);
} }
} }
@ -320,7 +323,7 @@ class Lettering extends BookKeeping
} }
return -1 * $error; return -1 * $error;
} else { } else {
return 1; return $affected_rows;
} }
} }
@ -355,7 +358,7 @@ class Lettering extends BookKeeping
} }
return -1 * $error; return -1 * $error;
} else { } else {
return 1; return $this->db->affected_rows($resql);
} }
} }
@ -457,7 +460,7 @@ class Lettering extends BookKeeping
else $result = $this->updateLettering($bookkeeping_lines); else $result = $this->updateLettering($bookkeeping_lines);
if ($result < 0) { if ($result < 0) {
$group_error++; $group_error++;
} else { } elseif ($result > 0) {
$nb_lettering++; $nb_lettering++;
} }
} }